adjusted the time-keeping function to work better for location following

requests
This commit is contained in:
Daniel Stenberg
2000-11-06 15:31:10 +00:00
parent b6bb734215
commit 71fb701168
3 changed files with 16 additions and 10 deletions

View File

@@ -94,16 +94,13 @@ CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
*param_doublep = data->progress.timespent; *param_doublep = data->progress.timespent;
break; break;
case CURLINFO_NAMELOOKUP_TIME: case CURLINFO_NAMELOOKUP_TIME:
*param_doublep = tvdiff(data->progress.t_nslookup, *param_doublep = data->progress.t_nslookup;
data->progress.start);
break; break;
case CURLINFO_CONNECT_TIME: case CURLINFO_CONNECT_TIME:
*param_doublep = tvdiff(data->progress.t_connect, *param_doublep = data->progress.t_connect;
data->progress.start);
break; break;
case CURLINFO_PRETRANSFER_TIME: case CURLINFO_PRETRANSFER_TIME:
*param_doublep = tvdiff(data->progress.t_pretransfer, *param_doublep = data->progress.t_pretransfer;
data->progress.start);
break; break;
case CURLINFO_SIZE_UPLOAD: case CURLINFO_SIZE_UPLOAD:
*param_doublep = data->progress.uploaded; *param_doublep = data->progress.uploaded;

View File

@@ -625,6 +625,7 @@ CURLcode curl_transfer(CURL *curl)
pgrsStartNow(data); pgrsStartNow(data);
do { do {
pgrsTime(data, TIMER_STARTSINGLE);
res = curl_connect(curl, (CURLconnect **)&c_connect); res = curl_connect(curl, (CURLconnect **)&c_connect);
if(res == CURLE_OK) { if(res == CURLE_OK) {
res = curl_do(c_connect); res = curl_do(c_connect);
@@ -635,13 +636,18 @@ CURLcode curl_transfer(CURL *curl)
} }
if((res == CURLE_OK) && data->newurl) { if((res == CURLE_OK) && data->newurl) {
/* Location: redirect */ /* Location: redirect
This is assumed to happen for HTTP(S) only!
*/
char prot[16]; char prot[16];
char path[URL_MAX_LENGTH]; char path[URL_MAX_LENGTH];
/* mark the next request as a followed location: */ /* mark the next request as a followed location: */
data->bits.this_is_a_follow = TRUE; data->bits.this_is_a_follow = TRUE;
data->proto.http->followlocation++; /* count location-followers */
if(data->bits.http_auto_referer) { if(data->bits.http_auto_referer) {
/* We are asked to automatically set the previous URL as the /* We are asked to automatically set the previous URL as the
referer when we get the next URL. We pick the ->url field, referer when we get the next URL. We pick the ->url field,

View File

@@ -244,10 +244,11 @@ struct Progress {
double ulspeed; double ulspeed;
struct timeval start; struct timeval start;
struct timeval t_startsingle;
/* various data stored for possible later report */ /* various data stored for possible later report */
struct timeval t_nslookup; double t_nslookup;
struct timeval t_connect; double t_connect;
struct timeval t_pretransfer; double t_pretransfer;
int httpcode; int httpcode;
#define CURR_TIME 5 #define CURR_TIME 5
@@ -271,6 +272,8 @@ struct HTTP {
struct Form form; struct Form form;
size_t (*storefread)(char *, size_t , size_t , FILE *); size_t (*storefread)(char *, size_t , size_t , FILE *);
FILE *in; FILE *in;
long followlocation;
}; };
/**************************************************************************** /****************************************************************************