cURL / Mailing Lists / curl-library / Single Mail

curl-library

HTTP proxy authentication with wrong username:password hangs

From: Jane Liu <jliu_at_n-able.com>
Date: Tue, 09 Dec 2003 10:59:34 -0500

Hi,

  I need help.
  When I am using HTTP/HTTPS proxy authentication, if username:password
is correct, there is no problem. But if the username:password is wrong,
then the program using HTTP hangs, while the program using HTTPS will
tell me Proxy connect aborted. This is happening on both Linux and
Windows.

Here is my code for Linux:

#include <stdio.h>
#include <curl/curl.h>
 
int main(void)
{
  CURL *curl;
  CURLcode res;
  FILE *fp;
  char *error_buffer[CURL_ERROR_SIZE];
 
  fp = fopen("/tmp/kill.exe", "wb");
 
  curl = curl_easy_init();
  if(curl) {
    /* First set the URL that is about to receive our POST. This URL can
       just as well be a https:// URL if that is what should receive the
       data. */
    curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
    curl_easy_setopt(curl, CURLOPT_URL,
"http://192.168.40.7/ui/download/3.0.0.37/win32/kill.exe");
    /* Now specify the POST data */
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_easy_setopt(curl, CURLOPT_PROXY,"http://192.168.20.110");
    curl_easy_setopt(curl, CURLOPT_PROXYPORT, 8095);
    curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "test:");
 
    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);
    printf("res = %d, message: %s\n", res, error_buffer);
 
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
 
  fclose(fp);
  return 0;
}

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-09