| |
|
|
|
cURL Mailing List Monthly Index Single Mail
curl-library Mailing List Archives
Re: CURLE_RECV_ERROR
From: dr cs <sproutsnew_at_gmail.com>
Date: Mon, 26 Oct 2009 13:11:55 -0600
On Mon, Oct 26, 2009 at 8:52 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 23 Oct 2009, dr cs wrote:
Let me add my code snippet and try explaining things.
When debugging the connection on my Linux box, I see the following message:
Proxy Settings:
Proxy IP: 10.103.12.15
Proxy Port : 8080
Proxy Username: Rajesh
* About to connect() to 10.103.12.15 port 8080
* Trying 10.103.12.15... * connected
* Connected to 10.103.12.15 (10.103.12.15) port 8080
* Establish HTTP proxy tunnel to upload.bluecoat.com:443
* Proxy auth using (nil) with user 'Rajesh'
< HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request
< Cache-Control: no-cache
Cache-Control: no-cache
< Pragma: no-cache
Pragma: no-cache
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< Proxy-Connection: close
Proxy-Connection: close
< Connection: close
Connection: close
< Content-Length: 691
Content-Length: 691
<
* Closing connection #0
res = failure when receiving data from the peer
HTTP response code = 0
-------------
Packet capture on my box reveals that :
CONNECT servername:443 HTTP/1.0..(nil)...
Is it expecting some header? If not, why would CURL place a (nil) here?
----------
/* get a curl handle */
curl = (*fp_curl_easy_init)();
if(curl) {
/* we want to use our own read function */
(*fp_curl_easy_setopt)(curl, CURLOPT_READFUNCTION, read_callback);
/* enable uploading */
(*fp_curl_easy_setopt)(curl, CURLOPT_UPLOAD, 1) ;
/* HTTP PUT please */
(*fp_curl_easy_setopt)(curl, CURLOPT_PUT, 1);
/* Uncomment following line when debugging connection */
(*fp_curl_easy_setopt)(curl, CURLOPT_VERBOSE, 1);
/* specify target URL, and note that this URL should include a file name,
(*fp_curl_easy_setopt)(curl,CURLOPT_URL, m_uploadURL);
#ifdef SKIP_PEER_VERIFICATION
/*
* If you want to connect to a site who isn't using a certificate that
* signed by one of the certs in the CA bundle you have, you can skip
* verification of the server's certificate. This makes the connection
* A LOT LESS SECURE.
*
* If you have a CA cert for the server stored someplace else than in
* default bundle, then the CURLOPT_CAPATH option might come handy for
* you.
*/
(*fp_curl_easy_setopt)(curl, CURLOPT_SSL_VERIFYPEER, 0);
#endif
#ifdef SKIP_HOSTNAME_VERFICATION
/*
* If the site you're connecting to uses a different host name that what
* they have mentioned in their server certificate's commonName (or
* subjectAltName) fields, libcurl will refuse to connect. You can skip
* this check, but this will make the connection less secure.
*/
(*fp_curl_easy_setopt)(curl, CURLOPT_SSL_VERIFYHOST, 0);
#endif
if (m_proxyInUse)
{
sprintf(tmpBuf1, "%s:%s", m_proxyIP, m_proxyPort);
(*fp_curl_easy_setopt)(curl, CURLOPT_PROXY, tmpBuf1
sprintf(tmpBuf2, "%s:%s", m_proxyUsername,
(*fp_curl_easy_setopt)(curl, CURLOPT_PROXYUSERPWD,
(*fp_curl_easy_setopt)(curl, CURLOPT_PROXYAUTH,
//(*fp_curl_easy_setopt)(curl,
(*fp_curl_easy_setopt)(curl,
}
/* now specify which file to upload */
(*fp_curl_easy_setopt)(curl, CURLOPT_READDATA, hd_src);
/* provide the size of the upload, we specicially typecast the value
to curl_off_t since we must be sure to use the correct data size */
(*fp_curl_easy_setopt)(curl, CURLOPT_INFILESIZE_LARGE,
(curl_off_t)filesize);
/* Now run off and do what you've been told! */
res = (*fp_curl_easy_perform)(curl);
(*fp_curl_easy_getinfo)(curl, CURLINFO_RESPONSE_CODE,
fprintf(stderr, "\nres = %s\nHTTP response code = %ld\n",
if (response_code != 201)
{
returnVal = -1;
}
/* always cleanup */
(*fp_curl_easy_cleanup)(curl);
}
fclose(hd_src); /* close the local file */
(*fp_curl_global_cleanup)();
return returnVal;
}
>
-------------------------------------------------------------------
These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info