curl-library
Any reason why:
Date: Mon, 15 Oct 2001 14:26:17 -0700 (PDT)
I would get a situation where both the HTTP code and the return code from
libcurl are 0? 2 examples where this has happened (4 total out of about 450
attempts):
Both were regular GET requests. No discernable pattern here, just happens
sporadically. Otherwise I get a 200...
Got: http://www.kaosarts.com/ with code 0
pretransfer_time: 1.53964 req size: 174 head size: 0
download speed: 0 upload speed: 0 download size: 0 upload size: 0
totaltime: 5.84992 lookuptime: 0.794927 connect_time: 1.53947 Total download
size: 0
Got: http://www.cnn.com/ with code 0
pretransfer_time: 1.52611 req size: 169 head size: 0
download speed: 0 upload speed: 0 download size: 0 upload size: 0
totaltime: 8.74254 lookuptime: 0.753966 connect_time: 1.52592 Total download
size: 0
Source fragment:
char *error_buffer;
long return_code;
string return_string;
int curl_status;
error_buffer=new char[CURL_ERROR_SIZE];
// Setup error buffer for result
curl_easy_setopt(curlhand, CURLOPT_ERRORBUFFER, error_buffer);
time(&start_time);
// Get the URL
curl_status=curl_easy_perform(curlhand);
curl_easy_getinfo(curlhand, CURLINFO_HTTP_CODE, &return_code);
return_code=(curl_status ? curl_status+1000 : return_code);
if(!ok()) return_string=error_buffer;
delete [] error_buffer;
// Get all that good info
curl_easy_getinfo(curlhand, CURLINFO_HEADER_SIZE, &header_size);
curl_easy_getinfo(curlhand, CURLINFO_REQUEST_SIZE, &request_size);
curl_easy_getinfo(curlhand, CURLINFO_PRETRANSFER_TIME, &pretransfer_time);
cout << "Got: " << url << " with code " << return_code << endl
<< "pretransfer_time: " << pretransfer_time << " req size: " <<
request_size << " head size: " << header_size << endl;
return;
}
bool ok() {
if(return_code >= 400)
return FALSE;
else
return TRUE;
}
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
Received on 2001-10-15