Hi,
If I run “Announce extension support #pk2” locally with any of the three provided test links, my code works and I’m receiving a full response which includes the field interval
. I’ve included debug output below.
./your_bittorrent.sh magnet_handshake "magnet:?xt=urn:btih:c5fb9894bdaba464811b088d806bdd611ba490af&dn=magnet3.gif&tr=http%3A%2F%2Fbittorrent-test-tracker.codecrafters.io%2Fannounce"
req = http://bittorrent-test-tracker.codecrafters.io/announce/?info_hash=%C5%FB%98%94%BD%AB%A4d%81%1B%08%8D%80k%DDa%1B%A4%90%AF
redirecting 'http://bittorrent-test-tracker.codecrafters.io/announce/?info_hash=%C5%FB%98%94%BD%AB%A4d%81%1B%08%8D%80k%DDa%1B%A4%90%AF&peer_id=AAA3AAAAAAA7AAAABAAA&port=6881&uploaded=0&downloaded=0&left=999&compact=1' to 'http://bittorrent-test-tracker.codecrafters.io/announce?info_hash=%C5%FB%98%94%BD%AB%A4d%81%1B%08%8D%80k%DDa%1B%A4%90%AF&peer_id=AAA3AAAAAAA7AAAABAAA&port=6881&uploaded=0&downloaded=0&left=999&compact=1'
resp = b"d8:completei3e10:incompletei1e8:intervali60e12:min intervali60e5:peers18:\xa7G\x8f6\xc8\xe2\xa5\xe8#\x8b\xc8\xef\x8b;\xb8\xff\xc90e"
Peer ID: 2d524e302e302e302de33db7666c49ec504ffdcb
But, if I run codecrafters test
with the same code, the interval
field is missing:
[tester::#PK2] Running tests for Stage #PK2 (Magnet Links - Announce extension support)
[tester::#PK2] Running ./your_bittorrent.sh magnet_handshake "magnet:?xt=urn:btih:c5fb9894bdaba464811b088d806bdd611ba490af&dn=magnet3.gif&tr=http%3A%2F%2F127.0.0.1:36787%2Fannounce"
[your_program] req = http://127.0.0.1:36787/announce/?info_hash=%C5%FB%98%94%BD%AB%A4d%81%1B%08%8D%80k%DDa%1B%A4%90%AF
[your_program] resp = b"d8:completei1e10:incompletei0e11:minintervali1800e5:peers6:\x7f\0\0\x01\xa7\xcfe"
[your_program] Error: "Missing Field: `interval`"
[tester::#PK2] Application didn't terminate successfully without errors. Expected 0 as exit code, got: 1
Do you have any idea about why this is happening?
I can’t pass the test, even though my code works if I run it locally.