Skip to content

Commit bdf9f4b

Browse files
committed
fix: add missing http payload length
the http metadata should have a payload length... of zero see: ttps://github.com/storacha/ipni/pull/15 License: MIT Signed-off-by: Oli Evans <[email protected]>
1 parent c06d368 commit bdf9f4b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@ipld/dag-cbor": "^7.0.3",
2323
"@ipld/dag-json": "^8.0.11",
2424
"@libp2p/peer-id-factory": "^2.0.3",
25-
"@web3-storage/ipni": "^2.0.0",
25+
"@web3-storage/ipni": "^3.0.0",
2626
"bl": "^5.0.0",
2727
"dotenv": "^10.0.0",
2828
"hdr-histogram-js": "^3.0.0",

test/advertisement.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ t.test('advertisement - extended provider', async t => {
143143
t.equal(ad.PreviousID.toString(), head)
144144
t.equal(ad.ExtendedProvider.Providers.length, 2)
145145
t.equal(ad.ExtendedProvider.Providers[1].Addresses[0], '/dns4/freeway.dag.house/tcp/443/https' )
146-
t.same(ad.ExtendedProvider.Providers[1].Metadata, new Uint8Array(varint.encode(0x0920)))
146+
// the last byte is a varint 0 denoting the empty payload length see: https://github.com/web3-storage/ipni/pull/15
147+
const httpMetaWith0lengthpayload = varint.encode(0x0920, new Uint8Array(3)) // [ 160, 18, 0 ]
148+
t.same(ad.ExtendedProvider.Providers[1].Metadata, httpMetaWith0lengthpayload)
147149
})
148150

149151
t.test('advertisement - handles head fetching HTTP error', async t => {

0 commit comments

Comments
 (0)