diff options
-rw-r--r-- | CHANGES | 8 | ||||
-rw-r--r-- | RELEASE-NOTES | 1 | ||||
-rw-r--r-- | docs/curl.1 | 8 | ||||
-rw-r--r-- | docs/libcurl/curl_easy_getinfo.3 | 34 | ||||
-rw-r--r-- | include/curl/curl.h | 3 | ||||
-rw-r--r-- | lib/getinfo.c | 3 | ||||
-rw-r--r-- | lib/progress.c | 6 | ||||
-rw-r--r-- | lib/progress.h | 3 | ||||
-rw-r--r-- | lib/ssh.c | 2 | ||||
-rw-r--r-- | lib/sslgen.c | 11 | ||||
-rw-r--r-- | lib/url.c | 1 | ||||
-rw-r--r-- | lib/urldata.h | 1 | ||||
-rw-r--r-- | src/writeout.c | 14 |
13 files changed, 74 insertions, 21 deletions
@@ -6,6 +6,14 @@ Changelog +Daniel Stenberg (3 Jul 2008) +- Introcuding a new timestamp for curl_easy_getinfo(): + CURLINFO_APPCONNECT_TIME. This is set with the "application layer" + handshake/connection is completed. Which typically is SSL, TLS or SSH and by + using this you can figure out the application layer's own connect time. You + can extract the time stamp using curl's -w option and the new variable named + 'time_appconnect'. This feature was sponsored by Lenny Rachitsky at NeuStar. + Daniel Fandrich (2 Jul 2008) - Support Open Watcom C on Linux (as well as Windows). diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7c9490542..0b87536fe 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -16,6 +16,7 @@ This release includes the following changes: o curl's option parser for boolean options reworked o Added --remote-name-all o Now builds for the INTEGRITY operating system + o Added CURLINFO_APPCONNECT_TIME This release includes the following bugfixes: diff --git a/docs/curl.1 b/docs/curl.1 index 15a338666..129939cd0 100644 --- a/docs/curl.1 +++ b/docs/curl.1 @@ -1241,8 +1241,12 @@ The time, in seconds, it took from the start until the name resolving was completed. .TP .B time_connect -The time, in seconds, it took from the start until the connect to the remote -host (or proxy) was completed. +The time, in seconds, it took from the start until the TCP connect to the +remote host (or proxy) was completed. +.TP +.B time_appconnect +The time, in seconds, it took from the start until the SSL/SSH/etc +connect/handshake to the remote host was completed. (Added in 7.19.0) .TP .B time_pretransfer The time, in seconds, it took from the start until the file transfer is just diff --git a/docs/libcurl/curl_easy_getinfo.3 b/docs/libcurl/curl_easy_getinfo.3 index fc45b01ae..b8fdf466e 100644 --- a/docs/libcurl/curl_easy_getinfo.3 +++ b/docs/libcurl/curl_easy_getinfo.3 @@ -71,6 +71,12 @@ start until the name resolving was completed. .IP CURLINFO_CONNECT_TIME Pass a pointer to a double to receive the time, in seconds, it took from the start until the connect to the remote host (or proxy) was completed. +.IP CURLINFO_APPCONNECT_TIME +Pass a pointer to a double to receive the time, in seconds, it took from the +start until the SSL/SSH connect/handshake to the remote host was completed. +This time is most often very near to the PRETRANSFER time, except for cases +such as HTTP pippelining where the pretransfer time can be delayed due to +waits in line for the pipeline and more. (Added in 7.19.0) .IP CURLINFO_PRETRANSFER_TIME Pass a pointer to a double to receive the time, in seconds, it took from the start until the file transfer is just about to begin. This includes all @@ -190,29 +196,33 @@ An overview of the six time values available from curl_easy_getinfo() curl_easy_perform() | - |--NT - |--|--CT - |--|--|--PT - |--|--|--|--ST - |--|--|--|--|--TT - |--|--|--|--|--RT + |--NAMELOOKUP + |--|--CONNECT + |--|--|--APPCONNECT + |--|--|--|--PRETRANSFER + |--|--|--|--|--STARTTRANSFER + |--|--|--|--|--|--TOTAL + |--|--|--|--|--|--REDIRECT .FI -.IP NT +.IP NAMELOOKUP \fICURLINFO_NAMELOOKUP_TIME\fP. The time it took from the start until the name resolving was completed. -.IP CT +.IP CONNECT \fICURLINFO_CONNECT_TIME\fP. The time it took from the start until the connect to the remote host (or proxy) was completed. -.IP PT +.IP APPCONNECT +\fICURLINFO_APPCONNECT_TIME\fP. The time it took from the start until the SSL +connect/handshake with the remote host was completed. (Added in in 7.19.0) +.IP PRETRANSFER \fICURLINFO_PRETRANSFER_TIME\fP. The time it took from the start until the file transfer is just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved. -.IP ST +.IP STARTTRANSFER \fICURLINFO_STARTTRANSFER_TIME\fP. The time it took from the start until the first byte is just about to be transferred. -.IP TT +.IP TOTAL \fICURLINFO_TOTAL_TIME\fP. Total time of the previous request. -.IP RT +.IP REDIRECT \fICURLINFO_REDIRECT_TIME\fP. The time it took for all redirection steps include name lookup, connect, pretransfer and transfer before final transaction was started. So, this is zero if no redirection took place. diff --git a/include/curl/curl.h b/include/curl/curl.h index 8182e9c28..af3a0d8a9 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -1608,9 +1608,10 @@ typedef enum { CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, + CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, /* Fill in new entries below here! */ - CURLINFO_LASTONE = 32 + CURLINFO_LASTONE = 33 } CURLINFO; /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as diff --git a/lib/getinfo.c b/lib/getinfo.c index bef2ebac4..2b7b08aee 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -137,6 +137,9 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) case CURLINFO_CONNECT_TIME: *param_doublep = data->progress.t_connect; break; + case CURLINFO_APPCONNECT_TIME: + *param_doublep = data->progress.t_appconnect; + break; case CURLINFO_PRETRANSFER_TIME: *param_doublep = data->progress.t_pretransfer; break; diff --git a/lib/progress.c b/lib/progress.c index f473e8227..2956d1a99 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -172,6 +172,10 @@ void Curl_pgrsTime(struct SessionHandle *data, timerid timer) data->progress.t_connect = Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); break; + case TIMER_APPCONNECT: + data->progress.t_appconnect = + Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + break; case TIMER_PRETRANSFER: data->progress.t_pretransfer = Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); diff --git a/lib/progress.h b/lib/progress.h index ad9d6623e..15a45cc24 100644 --- a/lib/progress.h +++ b/lib/progress.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -30,6 +30,7 @@ typedef enum { TIMER_NONE, TIMER_NAMELOOKUP, TIMER_CONNECT, + TIMER_APPCONNECT, TIMER_PRETRANSFER, TIMER_STARTTRANSFER, TIMER_POSTRANSFER, @@ -715,6 +715,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn) */ infof(data, "Authentication complete\n"); + Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSH is connected */ + conn->sockfd = sock; conn->writesockfd = CURL_SOCKET_BAD; diff --git a/lib/sslgen.c b/lib/sslgen.c index a6824090d..0001cd8d3 100644 --- a/lib/sslgen.c +++ b/lib/sslgen.c @@ -60,6 +60,7 @@ #include "strequal.h" #include "url.h" #include "memory.h" +#include "progress.h" /* The last #include file should be: */ #include "memdebug.h" @@ -178,11 +179,17 @@ void Curl_ssl_cleanup(void) CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex) { + CURLcode res; /* mark this is being ssl-enabled from here on. */ conn->ssl[sockindex].use = TRUE; conn->ssl[sockindex].state = ssl_connection_negotiating; - return curlssl_connect(conn, sockindex); + res = curlssl_connect(conn, sockindex); + + if(!res) + Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */ + + return res; } CURLcode @@ -192,7 +199,7 @@ Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex, #ifdef curlssl_connect_nonblocking /* mark this is being ssl requested from here on. */ conn->ssl[sockindex].use = TRUE; - return Curl_ossl_connect_nonblocking(conn, sockindex, done); + return curlssl_connect_nonblocking(conn, sockindex, done); #else *done = TRUE; /* fallback to BLOCKING */ conn->ssl[sockindex].use = TRUE; @@ -4328,6 +4328,7 @@ static CURLcode setup_conn(struct connectdata *conn, } else { Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */ + Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */ conn->bits.tcpconnect = TRUE; *protocol_done = TRUE; if(data->set.verbose) diff --git a/lib/urldata.h b/lib/urldata.h index 2e0f69204..6eb6539d5 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1067,6 +1067,7 @@ struct Progress { double t_nslookup; double t_connect; + double t_appconnect; double t_pretransfer; double t_starttransfer; double t_redirect; diff --git a/src/writeout.c b/src/writeout.c index 2a0e37af2..1e77d062c 100644 --- a/src/writeout.c +++ b/src/writeout.c @@ -45,6 +45,7 @@ typedef enum { VAR_TOTAL_TIME, VAR_NAMELOOKUP_TIME, VAR_CONNECT_TIME, + VAR_APPCONNECT_TIME, VAR_PRETRANSFER_TIME, VAR_STARTTRANSFER_TIME, VAR_SIZE_DOWNLOAD, @@ -79,6 +80,7 @@ static const struct variable replacements[]={ {"time_total", VAR_TOTAL_TIME}, {"time_namelookup", VAR_NAMELOOKUP_TIME}, {"time_connect", VAR_CONNECT_TIME}, + {"time_appconnect", VAR_APPCONNECT_TIME}, {"time_pretransfer", VAR_PRETRANSFER_TIME}, {"time_starttransfer", VAR_STARTTRANSFER_TIME}, {"size_header", VAR_HEADER_SIZE}, @@ -183,14 +185,22 @@ void ourWriteOut(CURL *curl, const char *writeinfo) curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &doubleinfo)) fprintf(stream, "%.3f", doubleinfo); break; + case VAR_APPCONNECT_TIME: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, + &doubleinfo)) + fprintf(stream, "%.3f", doubleinfo); + break; case VAR_PRETRANSFER_TIME: if(CURLE_OK == - curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &doubleinfo)) + curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, + &doubleinfo)) fprintf(stream, "%.3f", doubleinfo); break; case VAR_STARTTRANSFER_TIME: if(CURLE_OK == - curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &doubleinfo)) + curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, + &doubleinfo)) fprintf(stream, "%.3f", doubleinfo); break; case VAR_SIZE_UPLOAD: |