cURL / Mailing Lists / curl-library / Single Mail


[PATCH] SOCKS4a support

From: Richard Atterer <>
Date: Wed, 2 Jan 2008 12:55:41 +0100


I noticed that libcurl doesn't currently have SOCKS4a support, which is
especially interesting for tor and other anonymizing networks because it
avoids (non-anonymized) DNS lookups.

So here is a quick patch against current CVS for SOCKS4a. It's quite small,
the differences between v4 and v4a are really minimal. It has been lightly
tested and seems to work fine: HTTP downloads with "curl --socks4a" through
tor no longer trigger tor's "Your application is giving Tor only an IP
address" message, plus you can actually download from .onion sites! :)
The test suite continues to work after applying my patch.

I'm assuming that hostnames can have arbitrary lengths, which complicates
things a bit - Curl_write() is called a second time to send long hostnames.
I've tested my code with SOCKS4REQLEN set to 12, that code path seems to



PS: ObLegal: My contribution has the same license as libcurl's.

  __   _
  |_) /|  Richard Atterer     |  GnuPG key: 888354F7
  | \/|  |  08A9 7B7D 3D13 3EF2 3D25  D157 79E6 F6DC 8883 54F7

Received on 2008-01-02