aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-04-16 07:59:20 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-04-16 07:59:20 +0000
commit62d205a2ec38ed54e359625d69a7210dc274f093 (patch)
treedaafe4a6819326a2a00694a6352844770dfef2b4 /lib
parent29e873b12d9723a7becb6fb2a06f7f346d3e3157 (diff)
Dirk Manske brought the patch that introduces two new CURLINFO_* values:
CURLINFO_REDIRECT_TIME and CURLINFO_REDIRECT_COUNT.
Diffstat (limited to 'lib')
-rw-r--r--lib/getinfo.c7
-rw-r--r--lib/progress.c13
-rw-r--r--lib/progress.h2
-rw-r--r--lib/transfer.c2
-rw-r--r--lib/urldata.h1
5 files changed, 25 insertions, 0 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 5be124fff..20a7db1e4 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -54,6 +54,7 @@ CURLcode Curl_initinfo(struct SessionHandle *data)
pro->t_pretransfer = 0;
pro->t_starttransfer = 0;
pro->timespent = 0;
+ pro->t_redirect = 0;
info->httpcode = 0;
info->httpversion=0;
@@ -148,6 +149,12 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
case CURLINFO_CONTENT_LENGTH_UPLOAD:
*param_doublep = data->progress.size_ul;
break;
+ case CURLINFO_REDIRECT_TIME:
+ *param_doublep = data->progress.t_redirect;
+ break;
+ case CURLINFO_REDIRECT_COUNT:
+ *param_longp = data->set.followlocation;
+ break;
case CURLINFO_CONTENT_TYPE:
*param_charp = data->info.contenttype;
break;
diff --git a/lib/progress.c b/lib/progress.c
index 8c48c1ac1..b3052e425 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -103,6 +103,15 @@ void Curl_pgrsDone(struct connectdata *conn)
}
}
+/* reset all times except redirect */
+void Curl_pgrsResetTimes(struct SessionHandle *data)
+{
+ data->progress.t_nslookup = 0.0;
+ data->progress.t_connect = 0.0;
+ data->progress.t_pretransfer = 0.0;
+ data->progress.t_starttransfer = 0.0;
+}
+
void Curl_pgrsTime(struct SessionHandle *data, timerid timer)
{
switch(timer) {
@@ -134,6 +143,10 @@ void Curl_pgrsTime(struct SessionHandle *data, timerid timer)
case TIMER_POSTRANSFER:
/* this is the normal end-of-transfer thing */
break;
+ case TIMER_REDIRECT:
+ data->progress.t_redirect =
+ (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0;
+ break;
}
}
diff --git a/lib/progress.h b/lib/progress.h
index 409e5d51d..2dc19a73e 100644
--- a/lib/progress.h
+++ b/lib/progress.h
@@ -34,6 +34,7 @@ typedef enum {
TIMER_STARTTRANSFER,
TIMER_POSTRANSFER,
TIMER_STARTSINGLE,
+ TIMER_REDIRECT,
TIMER_LAST /* must be last */
} timerid;
@@ -44,6 +45,7 @@ void Curl_pgrsSetUploadSize(struct SessionHandle *data, double size);
void Curl_pgrsSetDownloadCounter(struct SessionHandle *data, double size);
void Curl_pgrsSetUploadCounter(struct SessionHandle *data, double size);
int Curl_pgrsUpdate(struct connectdata *);
+void Curl_pgrsResetTimes(struct SessionHandle *data);
void Curl_pgrsTime(struct SessionHandle *data, timerid timer);
diff --git a/lib/transfer.c b/lib/transfer.c
index f1f13d3ff..dcdb4708d 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1312,6 +1312,8 @@ CURLcode Curl_perform(struct SessionHandle *data)
*/
break;
}
+ Curl_pgrsTime(data, TIMER_REDIRECT);
+ Curl_pgrsResetTimes(data);
continue;
}
}
diff --git a/lib/urldata.h b/lib/urldata.h
index 43d2f5fe1..0a0416996 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -451,6 +451,7 @@ struct Progress {
double t_connect;
double t_pretransfer;
double t_starttransfer;
+ double t_redirect;
struct timeval start;
struct timeval t_startsingle;