[tor-bugs] #6542 [Torify]: curl 7.27.0 doesn't work with torsocks
Tor Bug Tracker & Wiki
torproject-admin at torproject.org
Sat Aug 4 06:07:21 UTC 2012
#6542: curl 7.27.0 doesn't work with torsocks
-------------------------+--------------------------------------------------
Reporter: cypherpunks | Owner:
Type: defect | Status: new
Priority: major | Milestone:
Component: Torify | Version:
Keywords: | Parent:
Points: | Actualpoints:
-------------------------+--------------------------------------------------
Comment(by cypherpunks):
Replying to [comment:3 arma]:
> Turn off your Tor and run nc -l -p 9050 and see what it's receiving.
That only shows the SOCKS4 hostname lookup request that torsocks does
before initiating the V5 handshake.
Here's a dump of what I'm seeing. Note the first two bytes and the final
byte.
{{{
$ usewithtor curl -iI http://en.wikipedia.org/ | hexdump -C
00000000 05 00 48 54 54 50 2f 31 2e 30 20 35 30 31 20 54 |..HTTP/1.0
501 T|
00000010 6f 72 20 69 73 20 6e 6f 74 20 61 6e 20 48 54 54 |or is not an
HTT|
00000020 50 20 50 72 6f 78 79 0d 0a 43 6f 6e 74 65 6e 74 |P
Proxy..Content|
00000030 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74 6d 6c |-Type:
text/html|
00000040 3b 20 63 68 61 72 73 65 74 3d 69 73 6f 2d 38 38 |;
charset=iso-88|
00000050 35 39 2d 31 0d 0a 0d 0a 3c 68 74 6d 6c 3e 0a 3c
|59-1....<html>.<|
00000060 68 65 61 64 3e 0a 3c 74 69 74 6c 65 3e 54 6f 72
|head>.<title>Tor|
00000070 20 69 73 20 6e 6f 74 20 61 6e 20 48 54 54 50 20 | is not an
HTTP |
00000080 50 72 6f 78 79 3c 2f 74 69 74 6c 65 3e 0a 3c 2f
|Proxy</title>.</|
00000090 68 65 61 64 3e 0a 3c 62 6f 64 79 3e 0a 3c 68 31
|head>.<body>.<h1|
000000a0 3e 54 6f 72 20 69 73 20 6e 6f 74 20 61 6e 20 48 |>Tor is not
an H|
000000b0 54 54 50 20 50 72 6f 78 79 3c 2f 68 31 3e 0a 3c |TTP
Proxy</h1>.<|
000000c0 70 3e 0a 49 74 20 61 70 70 65 61 72 73 20 79 6f |p>.It appears
yo|
000000d0 75 20 68 61 76 65 20 63 6f 6e 66 69 67 75 72 65 |u have
configure|
000000e0 64 20 79 6f 75 72 20 77 65 62 20 62 72 6f 77 73 |d your web
brows|
000000f0 65 72 20 74 6f 20 75 73 65 20 54 6f 72 20 61 73 |er to use Tor
as|
00000100 20 61 6e 20 48 54 54 50 20 70 72 6f 78 79 2e 0a | an HTTP
proxy..|
00000110 54 68 69 73 20 69 73 20 6e 6f 74 20 63 6f 72 72 |This is not
corr|
00000120 65 63 74 3a 20 54 6f 72 20 69 73 20 61 20 53 4f |ect: Tor is a
SO|
00000130 43 4b 53 20 70 72 6f 78 79 2c 20 6e 6f 74 20 61 |CKS proxy,
not a|
00000140 6e 20 48 54 54 50 20 70 72 6f 78 79 2e 0a 50 6c |n HTTP
proxy..Pl|
00000150 65 61 73 65 20 63 6f 6e 66 69 67 75 72 65 20 79 |ease
configure y|
00000160 6f 75 72 20 63 6c 69 65 6e 74 20 61 63 63 6f 72 |our client
accor|
00000170 64 69 6e 67 6c 79 2e 0a 3c 2f 70 3e 0a 3c 70 3e
|dingly..</p>.<p>|
00000180 0a 53 65 65 20 3c 61 20 68 72 65 66 3d 22 68 74 |.See <a
href="ht|
00000190 74 70 73 3a 2f 2f 77 77 77 2e 74 6f 72 70 72 6f
|tps://www.torpro|
000001a0 6a 65 63 74 2e 6f 72 67 2f 64 6f 63 75 6d 65 6e
|ject.org/documen|
000001b0 74 61 74 69 6f 6e 2e 68 74 6d 6c 22 3e 68 74 74
|tation.html">htt|
000001c0 70 73 3a 2f 2f 77 77 77 2e 74 6f 72 70 72 6f 6a
|ps://www.torproj|
000001d0 65 63 74 2e 6f 72 67 2f 64 6f 63 75 6d 65 6e 74
|ect.org/document|
000001e0 61 74 69 6f 6e 2e 68 74 6d 6c 3c 2f 61 3e 20 66
|ation.html</a> f|
000001f0 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 |or more
informat|
00000200 69 6f 6e 2e 0a 3c 21 2d 2d 20 50 6c 75 73 20 74 |ion..<!--
Plus t|
00000210 68 69 73 20 63 6f 6d 6d 65 6e 74 2c 20 74 6f 20 |his comment,
to |
00000220 6d 61 6b 65 20 74 68 65 20 62 6f 64 79 20 72 65 |make the body
re|
00000230 73 70 6f 6e 73 65 20 6d 6f 72 65 20 74 68 61 6e |sponse more
than|
00000240 20 35 31 32 20 62 79 74 65 73 2c 20 73 6f 20 20 | 512 bytes,
so |
00000250 20 20 20 20 49 45 20 77 69 6c 6c 20 62 65 20 77 | IE will
be w|
00000260 69 6c 6c 69 6e 67 20 74 6f 20 64 69 73 70 6c 61 |illing to
displa|
00000270 79 20 69 74 2e 20 43 6f 6d 6d 65 6e 74 20 63 6f |y it. Comment
co|
00000280 6d 6d 65 6e 74 20 63 6f 6d 6d 65 6e 74 20 63 6f |mment comment
co|
00000290 6d 6d 65 6e 74 20 20 20 20 20 20 63 6f 6d 6d 65 |mment
comme|
000002a0 6e 74 20 63 6f 6d 6d 65 6e 74 20 63 6f 6d 6d 65 |nt comment
comme|
*
000002d0 6e 74 20 63 6f 6d 6d 65 6e 74 2e 2d 2d 3e 0a 3c |nt
comment.-->.<|
000002e0 2f 70 3e 0a 3c 2f 62 6f 64 79 3e 0a 3c 2f 68 74
|/p>.</body>.</ht|
000002f0 6d 6c 3e 0a 00 |ml>..|
000002f5
}}}
Now if I pass the debugging environment variables to torsocks (which slows
down its execution), I get the following result. Note that curl seems to
be handing us the entire buffer with the SOCKS header before the HTTP
reply from the remote server.
{{{
$ TORSOCKS_DEBUG=3 TORSOCKS_DEBUG_FILE=trace usewithtor curl -iI
http://en.wikipedia.org/ | hexdump -C
00000000 05 00 00 01 00 00 00 00 00 00 48 54 54 50 2f 31
|..........HTTP/1|
00000010 2e 30 20 33 30 31 20 4d 6f 76 65 64 20 50 65 72 |.0 301 Moved
Per|
00000020 6d 61 6e 65 6e 74 6c 79 0d 0a 44 61 74 65 3a 20
|manently..Date: |
00000030 53 61 74 2c 20 30 34 20 41 75 67 20 32 30 31 32 |Sat, 04 Aug
2012|
00000040 20 30 36 3a 30 33 3a 35 38 20 47 4d 54 0d 0a 53 | 06:03:58
GMT..S|
00000050 65 72 76 65 72 3a 20 41 70 61 63 68 65 0d 0a 58 |erver:
Apache..X|
00000060 2d 43 6f 6e 74 65 6e 74 2d 54 79 70 65 2d 4f 70 |-Content-
Type-Op|
00000070 74 69 6f 6e 73 3a 20 6e 6f 73 6e 69 66 66 0d 0a |tions:
nosniff..|
00000080 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 73 |Cache-
Control: s|
00000090 2d 6d 61 78 61 67 65 3d 31 32 30 30 2c 20 6d 75 |-maxage=1200,
mu|
000000a0 73 74 2d 72 65 76 61 6c 69 64 61 74 65 2c 20 6d |st-
revalidate, m|
000000b0 61 78 2d 61 67 65 3d 30 0d 0a 56 61 72 79 3a 20 |ax-
age=0..Vary: |
000000c0 41 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e 67 2c |Accept-
Encoding,|
000000d0 58 2d 46 6f 72 77 61 72 64 65 64 2d 50 72 6f 74 |X-Forwarded-
Prot|
000000e0 6f 2c 43 6f 6f 6b 69 65 0d 0a 4c 61 73 74 2d 4d
|o,Cookie..Last-M|
000000f0 6f 64 69 66 69 65 64 3a 20 53 61 74 2c 20 30 34 |odified: Sat,
04|
00000100 20 41 75 67 20 32 30 31 32 20 30 36 3a 30 33 3a | Aug 2012
06:03:|
00000110 35 38 20 47 4d 54 0d 0a 4c 6f 63 61 74 69 6f 6e |58
GMT..Location|
00000120 3a 20 68 74 74 70 3a 2f 2f 65 6e 2e 77 69 6b 69 |:
http://en.wiki|
00000130 70 65 64 69 61 2e 6f 72 67 2f 77 69 6b 69 2f 4d
|pedia.org/wiki/M|
00000140 61 69 6e 5f 50 61 67 65 0d 0a 43 6f 6e 74 65 6e
|ain_Page..Conten|
00000150 74 2d 4c 65 6e 67 74 68 3a 20 30 0d 0a 43 6f 6e |t-Length:
0..Con|
00000160 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f |tent-Type:
text/|
00000170 68 74 6d 6c 3b 20 63 68 61 72 73 65 74 3d 75 74 |html;
charset=ut|
00000180 66 2d 38 0d 0a 41 67 65 3a 20 32 0d 0a 58 2d 43 |f-8..Age:
2..X-C|
00000190 61 63 68 65 3a 20 48 49 54 20 66 72 6f 6d 20 63 |ache: HIT
from c|
000001a0 70 31 30 31 37 2e 65 71 69 61 64 2e 77 6d 6e 65
|p1017.eqiad.wmne|
000001b0 74 0d 0a 58 2d 43 61 63 68 65 2d 4c 6f 6f 6b 75 |t..X-Cache-
Looku|
000001c0 70 3a 20 48 49 54 20 66 72 6f 6d 20 63 70 31 30 |p: HIT from
cp10|
000001d0 31 37 2e 65 71 69 61 64 2e 77 6d 6e 65 74 3a 33
|17.eqiad.wmnet:3|
000001e0 31 32 38 0d 0a 58 2d 43 61 63 68 65 3a 20 4d 49 |128..X-Cache:
MI|
000001f0 53 53 20 66 72 6f 6d 20 63 70 31 30 31 30 2e 65 |SS from
cp1010.e|
00000200 71 69 61 64 2e 77 6d 6e 65 74 0d 0a 58 2d 43 61
|qiad.wmnet..X-Ca|
00000210 63 68 65 2d 4c 6f 6f 6b 75 70 3a 20 4d 49 53 53 |che-Lookup:
MISS|
00000220 20 66 72 6f 6d 20 63 70 31 30 31 30 2e 65 71 69 | from
cp1010.eqi|
00000230 61 64 2e 77 6d 6e 65 74 3a 38 30 0d 0a 43 6f 6e
|ad.wmnet:80..Con|
00000240 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 65 0d 0a |nection:
close..|
00000250 0d 0a |..|
00000252
}}}
Weird, huh? I'm not sure if this is a curl bug or a torsocks bug.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6542#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list