Introcuding a new timestamp for curl_easy_getinfo():
CURLINFO_APPCONNECT_TIME. This is set with the "application layer" handshake/connection is completed (typically SSL, TLS or SSH). 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.
This commit is contained in:
parent
ee64d14733
commit
7c648782bc
8
CHANGES
8
CHANGES
@ -6,6 +6,14 @@
|
|||||||
|
|
||||||
Changelog
|
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)
|
Daniel Fandrich (2 Jul 2008)
|
||||||
- Support Open Watcom C on Linux (as well as Windows).
|
- Support Open Watcom C on Linux (as well as Windows).
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ This release includes the following changes:
|
|||||||
o curl's option parser for boolean options reworked
|
o curl's option parser for boolean options reworked
|
||||||
o Added --remote-name-all
|
o Added --remote-name-all
|
||||||
o Now builds for the INTEGRITY operating system
|
o Now builds for the INTEGRITY operating system
|
||||||
|
o Added CURLINFO_APPCONNECT_TIME
|
||||||
|
|
||||||
This release includes the following bugfixes:
|
This release includes the following bugfixes:
|
||||||
|
|
||||||
|
@ -1241,8 +1241,12 @@ The time, in seconds, it took from the start until the name resolving was
|
|||||||
completed.
|
completed.
|
||||||
.TP
|
.TP
|
||||||
.B time_connect
|
.B time_connect
|
||||||
The time, in seconds, it took from the start until the connect to the remote
|
The time, in seconds, it took from the start until the TCP connect to the
|
||||||
host (or proxy) was completed.
|
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
|
.TP
|
||||||
.B time_pretransfer
|
.B time_pretransfer
|
||||||
The time, in seconds, it took from the start until the file transfer is just
|
The time, in seconds, it took from the start until the file transfer is just
|
||||||
|
@ -71,6 +71,12 @@ start until the name resolving was completed.
|
|||||||
.IP CURLINFO_CONNECT_TIME
|
.IP CURLINFO_CONNECT_TIME
|
||||||
Pass a pointer to a double to receive the time, in seconds, it took from the
|
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.
|
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
|
.IP CURLINFO_PRETRANSFER_TIME
|
||||||
Pass a pointer to a double to receive the time, in seconds, it took from the
|
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
|
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()
|
curl_easy_perform()
|
||||||
|
|
|
|
||||||
|--NT
|
|--NAMELOOKUP
|
||||||
|--|--CT
|
|--|--CONNECT
|
||||||
|--|--|--PT
|
|--|--|--APPCONNECT
|
||||||
|--|--|--|--ST
|
|--|--|--|--PRETRANSFER
|
||||||
|--|--|--|--|--TT
|
|--|--|--|--|--STARTTRANSFER
|
||||||
|--|--|--|--|--RT
|
|--|--|--|--|--|--TOTAL
|
||||||
|
|--|--|--|--|--|--REDIRECT
|
||||||
.FI
|
.FI
|
||||||
.IP NT
|
.IP NAMELOOKUP
|
||||||
\fICURLINFO_NAMELOOKUP_TIME\fP. The time it took from the start until the name
|
\fICURLINFO_NAMELOOKUP_TIME\fP. The time it took from the start until the name
|
||||||
resolving was completed.
|
resolving was completed.
|
||||||
.IP CT
|
.IP CONNECT
|
||||||
\fICURLINFO_CONNECT_TIME\fP. The time it took from the start until the connect
|
\fICURLINFO_CONNECT_TIME\fP. The time it took from the start until the connect
|
||||||
to the remote host (or proxy) was completed.
|
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
|
\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
|
file transfer is just about to begin. This includes all pre-transfer commands
|
||||||
and negotiations that are specific to the particular protocol(s) involved.
|
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
|
\fICURLINFO_STARTTRANSFER_TIME\fP. The time it took from the start until the
|
||||||
first byte is just about to be transferred.
|
first byte is just about to be transferred.
|
||||||
.IP TT
|
.IP TOTAL
|
||||||
\fICURLINFO_TOTAL_TIME\fP. Total time of the previous request.
|
\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
|
\fICURLINFO_REDIRECT_TIME\fP. The time it took for all redirection steps
|
||||||
include name lookup, connect, pretransfer and transfer before final
|
include name lookup, connect, pretransfer and transfer before final
|
||||||
transaction was started. So, this is zero if no redirection took place.
|
transaction was started. So, this is zero if no redirection took place.
|
||||||
|
@ -1608,9 +1608,10 @@ typedef enum {
|
|||||||
CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
|
CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
|
||||||
CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
|
CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
|
||||||
CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
|
CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
|
||||||
|
CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33,
|
||||||
/* Fill in new entries below here! */
|
/* Fill in new entries below here! */
|
||||||
|
|
||||||
CURLINFO_LASTONE = 32
|
CURLINFO_LASTONE = 33
|
||||||
} CURLINFO;
|
} CURLINFO;
|
||||||
|
|
||||||
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
|
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
|
||||||
|
@ -137,6 +137,9 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
|
|||||||
case CURLINFO_CONNECT_TIME:
|
case CURLINFO_CONNECT_TIME:
|
||||||
*param_doublep = data->progress.t_connect;
|
*param_doublep = data->progress.t_connect;
|
||||||
break;
|
break;
|
||||||
|
case CURLINFO_APPCONNECT_TIME:
|
||||||
|
*param_doublep = data->progress.t_appconnect;
|
||||||
|
break;
|
||||||
case CURLINFO_PRETRANSFER_TIME:
|
case CURLINFO_PRETRANSFER_TIME:
|
||||||
*param_doublep = data->progress.t_pretransfer;
|
*param_doublep = data->progress.t_pretransfer;
|
||||||
break;
|
break;
|
||||||
|
@ -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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* 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 =
|
data->progress.t_connect =
|
||||||
Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle);
|
Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle);
|
||||||
break;
|
break;
|
||||||
|
case TIMER_APPCONNECT:
|
||||||
|
data->progress.t_appconnect =
|
||||||
|
Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle);
|
||||||
|
break;
|
||||||
case TIMER_PRETRANSFER:
|
case TIMER_PRETRANSFER:
|
||||||
data->progress.t_pretransfer =
|
data->progress.t_pretransfer =
|
||||||
Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle);
|
Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle);
|
||||||
|
@ -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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -30,6 +30,7 @@ typedef enum {
|
|||||||
TIMER_NONE,
|
TIMER_NONE,
|
||||||
TIMER_NAMELOOKUP,
|
TIMER_NAMELOOKUP,
|
||||||
TIMER_CONNECT,
|
TIMER_CONNECT,
|
||||||
|
TIMER_APPCONNECT,
|
||||||
TIMER_PRETRANSFER,
|
TIMER_PRETRANSFER,
|
||||||
TIMER_STARTTRANSFER,
|
TIMER_STARTTRANSFER,
|
||||||
TIMER_POSTRANSFER,
|
TIMER_POSTRANSFER,
|
||||||
|
@ -715,6 +715,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
|
|||||||
*/
|
*/
|
||||||
infof(data, "Authentication complete\n");
|
infof(data, "Authentication complete\n");
|
||||||
|
|
||||||
|
Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSH is connected */
|
||||||
|
|
||||||
conn->sockfd = sock;
|
conn->sockfd = sock;
|
||||||
conn->writesockfd = CURL_SOCKET_BAD;
|
conn->writesockfd = CURL_SOCKET_BAD;
|
||||||
|
|
||||||
|
11
lib/sslgen.c
11
lib/sslgen.c
@ -60,6 +60,7 @@
|
|||||||
#include "strequal.h"
|
#include "strequal.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "progress.h"
|
||||||
/* The last #include file should be: */
|
/* The last #include file should be: */
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
|
|
||||||
@ -178,11 +179,17 @@ void Curl_ssl_cleanup(void)
|
|||||||
CURLcode
|
CURLcode
|
||||||
Curl_ssl_connect(struct connectdata *conn, int sockindex)
|
Curl_ssl_connect(struct connectdata *conn, int sockindex)
|
||||||
{
|
{
|
||||||
|
CURLcode res;
|
||||||
/* mark this is being ssl-enabled from here on. */
|
/* mark this is being ssl-enabled from here on. */
|
||||||
conn->ssl[sockindex].use = TRUE;
|
conn->ssl[sockindex].use = TRUE;
|
||||||
conn->ssl[sockindex].state = ssl_connection_negotiating;
|
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
|
CURLcode
|
||||||
@ -192,7 +199,7 @@ Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex,
|
|||||||
#ifdef curlssl_connect_nonblocking
|
#ifdef curlssl_connect_nonblocking
|
||||||
/* mark this is being ssl requested from here on. */
|
/* mark this is being ssl requested from here on. */
|
||||||
conn->ssl[sockindex].use = TRUE;
|
conn->ssl[sockindex].use = TRUE;
|
||||||
return Curl_ossl_connect_nonblocking(conn, sockindex, done);
|
return curlssl_connect_nonblocking(conn, sockindex, done);
|
||||||
#else
|
#else
|
||||||
*done = TRUE; /* fallback to BLOCKING */
|
*done = TRUE; /* fallback to BLOCKING */
|
||||||
conn->ssl[sockindex].use = TRUE;
|
conn->ssl[sockindex].use = TRUE;
|
||||||
|
@ -4328,6 +4328,7 @@ static CURLcode setup_conn(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */
|
Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */
|
||||||
|
Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
|
||||||
conn->bits.tcpconnect = TRUE;
|
conn->bits.tcpconnect = TRUE;
|
||||||
*protocol_done = TRUE;
|
*protocol_done = TRUE;
|
||||||
if(data->set.verbose)
|
if(data->set.verbose)
|
||||||
|
@ -1067,6 +1067,7 @@ struct Progress {
|
|||||||
|
|
||||||
double t_nslookup;
|
double t_nslookup;
|
||||||
double t_connect;
|
double t_connect;
|
||||||
|
double t_appconnect;
|
||||||
double t_pretransfer;
|
double t_pretransfer;
|
||||||
double t_starttransfer;
|
double t_starttransfer;
|
||||||
double t_redirect;
|
double t_redirect;
|
||||||
|
@ -45,6 +45,7 @@ typedef enum {
|
|||||||
VAR_TOTAL_TIME,
|
VAR_TOTAL_TIME,
|
||||||
VAR_NAMELOOKUP_TIME,
|
VAR_NAMELOOKUP_TIME,
|
||||||
VAR_CONNECT_TIME,
|
VAR_CONNECT_TIME,
|
||||||
|
VAR_APPCONNECT_TIME,
|
||||||
VAR_PRETRANSFER_TIME,
|
VAR_PRETRANSFER_TIME,
|
||||||
VAR_STARTTRANSFER_TIME,
|
VAR_STARTTRANSFER_TIME,
|
||||||
VAR_SIZE_DOWNLOAD,
|
VAR_SIZE_DOWNLOAD,
|
||||||
@ -79,6 +80,7 @@ static const struct variable replacements[]={
|
|||||||
{"time_total", VAR_TOTAL_TIME},
|
{"time_total", VAR_TOTAL_TIME},
|
||||||
{"time_namelookup", VAR_NAMELOOKUP_TIME},
|
{"time_namelookup", VAR_NAMELOOKUP_TIME},
|
||||||
{"time_connect", VAR_CONNECT_TIME},
|
{"time_connect", VAR_CONNECT_TIME},
|
||||||
|
{"time_appconnect", VAR_APPCONNECT_TIME},
|
||||||
{"time_pretransfer", VAR_PRETRANSFER_TIME},
|
{"time_pretransfer", VAR_PRETRANSFER_TIME},
|
||||||
{"time_starttransfer", VAR_STARTTRANSFER_TIME},
|
{"time_starttransfer", VAR_STARTTRANSFER_TIME},
|
||||||
{"size_header", VAR_HEADER_SIZE},
|
{"size_header", VAR_HEADER_SIZE},
|
||||||
@ -183,14 +185,22 @@ void ourWriteOut(CURL *curl, const char *writeinfo)
|
|||||||
curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &doubleinfo))
|
curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &doubleinfo))
|
||||||
fprintf(stream, "%.3f", doubleinfo);
|
fprintf(stream, "%.3f", doubleinfo);
|
||||||
break;
|
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:
|
case VAR_PRETRANSFER_TIME:
|
||||||
if(CURLE_OK ==
|
if(CURLE_OK ==
|
||||||
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &doubleinfo))
|
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME,
|
||||||
|
&doubleinfo))
|
||||||
fprintf(stream, "%.3f", doubleinfo);
|
fprintf(stream, "%.3f", doubleinfo);
|
||||||
break;
|
break;
|
||||||
case VAR_STARTTRANSFER_TIME:
|
case VAR_STARTTRANSFER_TIME:
|
||||||
if(CURLE_OK ==
|
if(CURLE_OK ==
|
||||||
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &doubleinfo))
|
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
|
||||||
|
&doubleinfo))
|
||||||
fprintf(stream, "%.3f", doubleinfo);
|
fprintf(stream, "%.3f", doubleinfo);
|
||||||
break;
|
break;
|
||||||
case VAR_SIZE_UPLOAD:
|
case VAR_SIZE_UPLOAD:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user