torsocks
torsocks copied to clipboard
Bug3711 - Provide optimistic data by default
Add support for Torsocks to provide optimistic data, by default, during the SOCKS handshake.
Overload write/read/send/recv/writev/readv/sendmmsg/recvmmsg/recvmsg/recvfrom Overload pselect/ppoll
This looks good in terms of code review but it seems there is a regression going on from master to this branch which is that I'm unable to perform a simple "wget http://google.com" with this branch.
Here is the strace output where the first one is what it should be from master and the second one is this branch where is stalls until an http timeout.
8231 sendto(3, "\4\1\0P\0\0\0\1dgoulet\0google.com\0", 27, 0, NULL, 0) = 27 8231 recvfrom(3, "\0Z\0\0\0\0\0\0", 8, 0, NULL, NULL) = 8 8231 write(2, "connected.\n", 11) = 11 8231 select(4, NULL, [3], NULL, {900, 0}) = 1 (out [3], left {899, 999998}) 8231 write(3, "GET / HTTP/1.1\r\nUser-Agent: Wget"..., 110) = 110 [...]
This branch:
11711 sendto(3, "\4\1\0P\0\0\0\1dgoulet\0google.com\0", 27, 0, NULL, 0) = 27 11711 write(2, "connected.\n", 11) = 11 11711 select(4, [3], [], [3], {900, 0}) = 1 (in [3], left {899, 445663}) 11711 recvfrom(3, "\0Z\0\0\0\0\0\0", 8, 0, NULL, NULL) = 8 11711 select(4, [3], [], [], {899, 445663}) = ? ERESTARTNOHAND (To be restarted) <...stalled>
Wow. hm. strange. I guess somehow I never tested http, only https (really bad assumption). Working on a fix now.
Ok, moderately bad hack, but please test/review and I'll adjust as is needed.