diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2000-11-06 15:31:10 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2000-11-06 15:31:10 +0000 | 
| commit | 71fb70116891920a71eeaa9daac7f54294e8caf7 (patch) | |
| tree | 4633d0fc0f89434836686674c1bd320fb55c8685 | |
| parent | b6bb734215a40238ada3a02c9fcddcf5bf934c2c (diff) | |
adjusted the time-keeping function to work better for location following
requests
| -rw-r--r-- | lib/getinfo.c | 9 | ||||
| -rw-r--r-- | lib/highlevel.c | 8 | ||||
| -rw-r--r-- | lib/urldata.h | 9 | 
3 files changed, 16 insertions, 10 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c index dbcaa1b07..786692c89 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -94,16 +94,13 @@ CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)      *param_doublep = data->progress.timespent;      break;    case CURLINFO_NAMELOOKUP_TIME: -    *param_doublep = tvdiff(data->progress.t_nslookup, -                            data->progress.start); +    *param_doublep = data->progress.t_nslookup;      break;    case CURLINFO_CONNECT_TIME: -    *param_doublep =  tvdiff(data->progress.t_connect, -                             data->progress.start); +    *param_doublep = data->progress.t_connect;      break;    case CURLINFO_PRETRANSFER_TIME: -    *param_doublep =  tvdiff(data->progress.t_pretransfer, -                             data->progress.start); +    *param_doublep =  data->progress.t_pretransfer;      break;    case CURLINFO_SIZE_UPLOAD:      *param_doublep =  data->progress.uploaded; diff --git a/lib/highlevel.c b/lib/highlevel.c index 7a9dad308..a67e0f024 100644 --- a/lib/highlevel.c +++ b/lib/highlevel.c @@ -625,6 +625,7 @@ CURLcode curl_transfer(CURL *curl)    pgrsStartNow(data);    do { +    pgrsTime(data, TIMER_STARTSINGLE);      res = curl_connect(curl, (CURLconnect **)&c_connect);      if(res == CURLE_OK) {        res = curl_do(c_connect); @@ -635,13 +636,18 @@ CURLcode curl_transfer(CURL *curl)        }        if((res == CURLE_OK) && data->newurl) { -        /* Location: redirect */ +        /* Location: redirect + +           This is assumed to happen for HTTP(S) only! +         */          char prot[16];          char path[URL_MAX_LENGTH];          /* mark the next request as a followed location: */          data->bits.this_is_a_follow = TRUE; +        data->proto.http->followlocation++; /* count location-followers */ +          if(data->bits.http_auto_referer) {            /* We are asked to automatically set the previous URL as the               referer when we get the next URL. We pick the ->url field, diff --git a/lib/urldata.h b/lib/urldata.h index 12046bfda..857e5e93f 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -244,10 +244,11 @@ struct Progress {    double ulspeed;    struct timeval start; +  struct timeval t_startsingle;    /* various data stored for possible later report */ -  struct timeval t_nslookup; -  struct timeval t_connect; -  struct timeval t_pretransfer; +  double t_nslookup; +  double t_connect; +  double t_pretransfer;    int httpcode;  #define CURR_TIME 5 @@ -271,6 +272,8 @@ struct HTTP {    struct Form form;    size_t (*storefread)(char *, size_t , size_t , FILE *);    FILE *in; + +  long followlocation;  };  /****************************************************************************  | 
