cURL / Mailing Lists / curl-library / Single Mail


More socks5

From: Andy Cedilnik <>
Date: 15 Jan 2003 10:08:25 -0500

Hi All,

So, after my first happyness when I discovered that SOCKS5 proxying
works, I tried to upload file using it. This is the code:

int main(void)
  CURL *curl;
  CURLcode res;

  struct HttpPost *formpost=NULL;
  struct HttpPost *lastptr=NULL;

  /* Fill in the file upload field */
  curl_formadd(&formpost, &lastptr,
                        CURLFORM_COPYNAME, "FileData",
                        CURLFORM_FILE, "file.txt",
  curl_formadd(&formpost, &lastptr,
                        CURLFORM_COPYNAME, "FileName",
                        CURLFORM_COPYCONTENTS, "uploadname.txt",

  curl = curl_easy_init();
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
    curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
    curl_easy_setopt(curl, CURLOPT_PROXY, "proxy");
    curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
    curl_easy_setopt(curl, CURLOPT_URL,
    res = curl_easy_perform(curl);
    printf("Res: %d\n", res);
  return 0;

If I comment out line:

curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);

then things work fine. I get the page. If I have that line, then I get
the following output:

* About to connect() to proxy:1080
* Connected to ((nil)) port 1080
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Content-Length: 146
Expect: 100-continue
Content-Type: multipart/form-data;

And then it waits for long time.

I know that connection is established, since I see that script was run
on the server. Even more, I wrote environment from the script and I can
see things like:

CONTENT_TYPE -> multipart/form-data;

The moment I try to do:
form = cgi.FieldStorage()

The script locks and waits. I assume the curl does not send the data.
After log time of waiting I get the following output on curl side:

* Connection #0 left intact
Res: 0
* Closing connection #0

So, I think the socks5 code has some problems. Except if I am doing
something wrong?

Any help apreciated.

Thank you.


This SF.NET email is sponsored by: Take your first step towards giving
your online business a competitive advantage. Test-drive a Thawte SSL
certificate - our easy online guide will show you how. Click here to get
Received on 2003-01-15