Skip to content
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

HTTP request with wrong infoHash #196

Closed
tnako opened this issue Dec 1, 2014 · 6 comments
Closed

HTTP request with wrong infoHash #196

tnako opened this issue Dec 1, 2014 · 6 comments

Comments

@tnako
Copy link

@tnako tnako commented Dec 1, 2014

Hello. I have torrent file - https://github.com/tnako/DP/blob/master/my/liferace.torrent
That data cannot be downloaded. It cooked for local XBT.

If I started webtorrent, it send wrong infoHash to tracker server. For example, I use your cmd.js:

DEBUG=* node cmd.js liferace.torrent 2>&1 | grep a2a1553754

It will give right infoHash:

Mon, 01 Dec 2014 15:18:45 GMT bittorrent-swarm new swarm i a2a15537542b22925ad10486bf7a8b2a9c42f0d1 p 2d5757303030312d386238633332336161343163
Mon, 01 Dec 2014 15:18:45 GMT torrent-discovery setTorrent a2a15537542b22925ad10486bf7a8b2a9c42f0d1
Mon, 01 Dec 2014 15:18:45 GMT bittorrent-tracker new client a2a15537542b22925ad10486bf7a8b2a9c42f0d1

But the same time tcpdump -s 0 -A port 2710 give me:

.i.7....GET /announce?info_hash=%a2%a1U7T%2b%22%92Z%d1%04%86%bfz%8b*%9cB%f0%d1&peer_id=-qB31A0-!I_EUqrSvcsd&port=6881&uploaded=0&downloaded=0&left=1091506387&corrupt=0&redundant=0&compact=1&numwant=0&key=c60fff68&no_peer_id=1&supportcrypto=1&event=stopped&ip=...

With this info_hash i go to http://url-encode.online-domain-tools.com/ and make url decode, in hex it will be:

a2  a1  55  37  54  20  22  92  5a  d1  04  86  bf  7a  8b  2a    9c    42  f0  d1   

The error after a2a1553754, it must be 0x2b, not 0x20


Versions:

webtorrent@0.16.0 node_modules/webtorrent                                                                                                                                                                                                                                      
├── thunky@0.1.0                                                                                                                                                                                                                                                               
├── speedometer@0.1.3                                                                                                                                                                                                                                                          
├── network-address@0.0.5                                                                                                                                                                                                                                                      
├── clivas@0.1.4                                                                                                                                                                                                                                                               
├── http-https@1.0.0                                                                                                                                                                                                                                                           
├── git-sha1@0.1.2                                                                                                                                                                                                                                                             
├── range-parser@1.0.2                                                                                                                                                                                                                                                         
├── inherits@2.0.1                                                                                                                                                                                                                                                             
├── end-of-stream@1.1.0
├── bitfield@1.0.2
├── pump@1.0.0
├── extend.js@0.0.1
├── hat@0.0.3
├── addr-to-ip-port@1.4.0
├── prettysize@0.0.3
├── random-access-file@0.3.1
├── re-emitter@1.0.0
├── rimraf@2.2.8
├── run-parallel@1.0.0
├── multistream@1.4.2
├── block-stream@0.0.7
├── mime@1.2.11
├── minimist@1.1.0
├── windows-no-runnable@0.0.6
├── moment@2.8.4
├── mkdirp@0.5.0 (minimist@0.0.8)
├── once@1.3.1 (wrappy@1.0.1)
├── filestream@2.1.1 (typedarray-to-buffer@1.0.4)
├── nodebmc@0.0.5 (mdns-js@0.1.0)
├── dezalgo@1.0.1 (wrappy@1.0.1, asap@1.0.0)
├── debug@2.1.0 (ms@0.6.2)
├── ut_metadata@2.6.0 (bencode@0.6.0)
├── webtorrent-swarm@0.3.3 (bittorrent-protocol@1.4.2)
├── bittorrent-swarm@0.16.4 (bittorrent-protocol@1.4.2)
├── concat-stream@1.4.7 (typedarray@0.0.6, readable-stream@1.1.13)
├── bittorrent-dht@2.6.4 (compact2string@1.3.0, buffer-equal@0.0.1, k-bucket@0.4.2, bencode@0.6.0, is-ip@1.0.0, string2compact@1.2.0)
├── load-ip-set@1.0.5 (split@0.3.2, ip-set@1.0.0)
├── ut_pex@1.0.1 (compact2string@1.3.0, bencode@0.6.0, string2compact@1.2.0)
├── airplay-js@0.2.6 (plist-with-patches@0.5.1, mdns-js@0.2.2)
├── torrent-discovery@2.0.4 (bittorrent-tracker@2.9.1, webtorrent-tracker@0.5.0)
└── chromecast-js@0.1.4 (debug@1.0.4, mdns-js2@0.0.5, castv2-client@0.0.4)
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 8, 2014

What version of webtorrent are you using? Please run webtorrent --version and report back here. Several tracker bugs were fixed a few versions back.

@tnako

This comment has been minimized.

Copy link
Author

@tnako tnako commented Dec 8, 2014

Fresh install of webtorrent have the same issue:

$ node cmd.js --version
0.16.0

Added versions to the main post

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 18, 2014

@tnako When I looked at the output from your tcpdump and decode the info_hash, which is shown as:

%a2%a1U7T**%2b**%22%92Z%d1%04%86%bfz%8b*%9cB%f0%d1

I get:

a2 a1 55 37 54 2b 22 92 5a d1 04 86 bf 7a 8b 2a 9c 42 f0 d1

Which is correct! This means the correct http request is being made to the tracker server. I also confirmed that the correct request is made using a different tracker server (since the one in this torrent is down).

It seems to me like %2b (which decodes to a + character) is likely being converted into %20 by the http server. What tracker software is running at http://lr1.gamingboom.ru:2710/?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 18, 2014

Could there be a proxy server (like Apache or Nginx) in front of the tracker that is incorrectly converting %2b into a space character?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 18, 2014

This is interesting. On my local machine, the info_hash was actually:

%a2%a1U7T+%22%92Z%d1%04%86%bfz%8b*%9cB%f0%d1

Note: the unescaped + and * characters. These should definitely be escaped, but aren't. This could definitely cause the bug you saw, and it shouldn't be happening.

PR out to bittorrent-tracker to fix this: webtorrent/bittorrent-tracker#52

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 26, 2014

I believe this issue is fixed now. Released as 0.17.0.

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.