diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2008-07-03 06:56:03 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2008-07-03 06:56:03 +0000 | 
| commit | 7c648782bc7c97be81c619acd8598c38b59c5832 (patch) | |
| tree | 19083e2f56b425701f0e44abcfe69e60e608aa40 /lib | |
| parent | ee64d14733266ce533eeb3cbc86bd80212527b81 (diff) | |
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.
Diffstat (limited to 'lib')
| -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 | 
7 files changed, 23 insertions, 4 deletions
| 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; | 
