-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Daniel Stenberg
Sent: 21 December 2010 08:48
To: libcurl development
Subject: RE: problems doing a HTTPS GET via an authenticating proxy when
setting CURLOPT_MAX_RECV_SPEED_LARGE to 25k
On Tue, 21 Dec 2010, [email protected] wrote:
> yes the easy interface behaves ok, but I am using the multi-interface and
> attempting to use the CURLOPT_MAX_RECV_SPEED_LARGE set to 25kBytesper sec.
> If I don't set CURLOPT_MAX_RECV_SPEED_LARGE then it works fine, so I'm
> guessing a problem somewhere with the throttling mechanism under https.
So now you drop a few more details of what's needed to repeat this. So instead
of having us guess any further, can you please provide a small source code
that repeats the problem? Are you saying that this problem only happens with
HTTPS transfers and not HTTP?
What libcurl version are you using and on what OS?
(and please don't top-post)
--
/ daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
1) yes, I've only seen this with HTTPS transfers
2) 7.21.3 on windows XP sp3
unsigned int GetFile(char *url,char *file,char *proxy,char *szUser,char
*szPass,char *szUserAgent,int nRxDownloadMaxKbPerSec)
{
void *p = NULL;
CURL *http_handle;
CURLM *multi_handle;
int still_running; /* keep number of running handles */
FILE * hd_dst;
int hd;
unsigned int httpRespCode=0;
/* create an empty local file, truncate it if it exists already */
hd = open(file, _O_BINARY | _O_CREAT | _O_TRUNC ) ;
if(hd == -1)
{
printf("failed to open %s\n",file);
return -1;
}
//fstat(hd, &file_info);
close(hd) ;
/* get a FILE * of the same file */
hd_dst = fopen(file, "wb");
http_handle = curl_easy_init();
/* we want to use our own write function */
curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(http_handle, CURLOPT_WRITEDATA,hd_dst);
/* set the options */
if(szUserAgent)
{
curl_easy_setopt(http_handle,CURLOPT_USERAGENT,szUserAgent);
}
curl_easy_setopt(http_handle, CURLOPT_URL,url);
if(proxy[0])
{
curl_easy_setopt(http_handle, CURLOPT_PROXY,proxy);
}
if(nRxDownloadMaxKbPerSec)
{
curl_easy_setopt(http_handle,
CURLOPT_MAX_RECV_SPEED_LARGE,(curl_off_t)(nRxDownloadMaxKbPerSec * 1024));
//curl wants bytes per second !
}
if(szUser[0] && szPass[0])
{
char *pszAuth = new char [ 1 + strlen(szUser) + 1 +
strlen(szPass)];
wsprintf(pszAuth,"%s:%s",szUser,szPass);
curl_easy_setopt(http_handle,CURLOPT_USERPWD,pszAuth);
delete [] pszAuth;
}
curl_easy_setopt(http_handle,CURLOPT_HTTPAUTH,CURLAUTH_BASIC);
curl_easy_setopt(http_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
// ignore self signed cert errors
curl_easy_setopt(http_handle, CURLOPT_SSL_VERIFYHOST,2); // ensures cert
common name matches server
curl_easy_setopt(http_handle, CURLOPT_VERBOSE, 1);
// set up progress info reporting with a data item
curl_easy_setopt(http_handle,CURLOPT_PROGRESSFUNCTION,ProgressCallback);
// we pass our CURL_CONTEXT to the progress callback function
curl_easy_setopt(http_handle,CURLOPT_PROGRESSDATA,(void *)p);
// turn ON progress reporting
curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS,0);
/* init a multi stack */
multi_handle = curl_multi_init();
/* add the individual transfers */
curl_multi_add_handle(multi_handle, http_handle);
/* we start some action by calling perform right away */
while(CURLM_CALL_MULTI_PERFORM ==
curl_multi_perform(multi_handle, &still_running));
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
fd_set fdread;
fd_set fdwrite;
fd_set fdexcep;
int maxfd;
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
FD_ZERO(&fdexcep);
/* set a suitable timeout to play around with */
timeout.tv_sec = 1;
timeout.tv_usec = 0;
/* get file descriptors from the transfers */
curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
/* In a real-world program you OF COURSE check the return code of the
function calls, *and* you make sure that maxfd is bigger than -1 so
that the call to select() below makes sense! */
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
if(rc == -1)
{
ATLTRACE("-1,");
::Sleep(100);
continue;
}
switch(rc) {
case -1:
/* select error */
still_running = 0;
printf("select() returns error, this is badness\n");
break;
case 0:
default:
/* timeout or readable/writable sockets */
while(CURLM_CALL_MULTI_PERFORM ==
curl_multi_perform(multi_handle, &still_running));
break;
}
}
// query http status code here
int nRet2 = curl_easy_getinfo(http_handle, CURLINFO_RESPONSE_CODE,
&httpRespCode);
if(nRet2==CURLE_OK)
{
if(httpRespCode==0)
{
;// not an http response code
}
else
{
ATLTRACE("GetFile() http response code is
%d\n",httpRespCode);
}
}
curl_multi_cleanup(multi_handle);
curl_easy_cleanup(http_handle);
fclose(hd_dst); /* close the local file */
return httpRespCode;
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html