Skip to content

fix: support http(s) multiaddr with no tcp port #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6bb3726
add support for smart contracts
NikolasHaimerl Mar 10, 2025
68359b6
fmt
NikolasHaimerl Mar 10, 2025
62be1e6
reanbled tests
NikolasHaimerl Mar 10, 2025
2bbbeca
add client file
NikolasHaimerl Mar 10, 2025
9697f26
fmt
NikolasHaimerl Mar 10, 2025
1262327
comments
NikolasHaimerl Mar 10, 2025
544d4c4
comments
NikolasHaimerl Mar 10, 2025
87e6ec0
Update lib/miner-info.js
NikolasHaimerl Mar 10, 2025
e16ae0c
Update lib/miner-info.js
NikolasHaimerl Mar 10, 2025
3a60176
resolve PR threads
NikolasHaimerl Mar 10, 2025
c3894a0
merged with main
NikolasHaimerl Mar 10, 2025
66a2d4a
resolve PR threads
NikolasHaimerl Mar 10, 2025
3eb9eff
auth
NikolasHaimerl Mar 10, 2025
3e827ce
fix ethers import
Mar 11, 2025
1b93104
fix cid
Mar 11, 2025
e95b9e7
fix cid
Mar 11, 2025
c26916a
move constant
NikolasHaimerl Mar 11, 2025
08dacb9
Update lib/smart-contract-client.js
NikolasHaimerl Mar 11, 2025
5b63a20
address pr threads
NikolasHaimerl Mar 12, 2025
baafc99
address pr threads
NikolasHaimerl Mar 12, 2025
ec2a53b
Update lib/miner-info.js
NikolasHaimerl Mar 12, 2025
9a8a972
fmt
NikolasHaimerl Mar 12, 2025
4eb4faa
change failure behaviour
NikolasHaimerl Mar 13, 2025
00b0fc0
fmt
NikolasHaimerl Mar 13, 2025
40c3261
fmt
NikolasHaimerl Mar 13, 2025
a7c0198
address pr threads
NikolasHaimerl Mar 13, 2025
52067ba
add support for dns path
NikolasHaimerl Mar 13, 2025
78d2c4b
fmt
NikolasHaimerl Mar 13, 2025
b71f5fc
resolve PR threads
NikolasHaimerl Mar 14, 2025
baa8d8b
add https test
NikolasHaimerl Mar 14, 2025
228dcd4
Merge branch 'main' into nhaimerl-dns-http-url-support
NikolasHaimerl Mar 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/multiaddr.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export function multiaddrToHttpUrl (addr) {
new Error(`Cannot parse "${addr}": unsupported http path`, { cause: err }),
{ code: 'INVALID_HTTP_PATH' }
)
}
} // Handle HTTP/HTTPs addresses using the default port
} else if (multiAddrParts[0] === 'http' || multiAddrParts[0] === 'https') {
[scheme, ...rest] = multiAddrParts
} else {
let ipProtocol
;[ipProtocol, port, scheme, ...rest] = multiAddrParts
Expand Down
6 changes: 5 additions & 1 deletion test/multiaddr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ const HAPPY_CASES = [
['/dns6/meridian.space/tcp/8080/http', 'http://meridian.space:8080'],
['/dns/meridian.space/https/http-path/%2Fipni-provider%2FproviderID', 'https://meridian.space/ipni-provider/providerID'],
['/dns/meridian.space/https/http-path/', 'https://meridian.space'],
['/dns/meridian.space/https/http-path', 'https://meridian.space']
['/dns/meridian.space/https/http-path', 'https://meridian.space'],
['/dns/meridian.space/https', 'https://meridian.space'],
['/dns/meridian.space/http', 'http://meridian.space'],
['/ip4/127.0.0.1/http', 'http://127.0.0.1'],
['/ip4/127.0.0.1/https', 'https://127.0.0.1']
]

for (const [multiaddr, expectedUri] of HAPPY_CASES) {
Expand Down