]> granicus.if.org Git - curl/commitdiff
url: don't set appconnect time for non-ssl/non-ssh connections
authorJay Satiro <raysatiro@yahoo.com>
Fri, 12 Apr 2019 22:57:53 +0000 (18:57 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Thu, 26 Sep 2019 07:04:26 +0000 (03:04 -0400)
Prior to this change non-ssl/non-ssh connections that were reused set
TIMER_APPCONNECT [1]. Arguably that was incorrect since no SSL/SSH
handshake took place.

[1]: TIMER_APPCONNECT is publicly known as CURLINFO_APPCONNECT_TIME in
libcurl and %{time_appconnect} in the curl tool. It is documented as
"the time until the SSL/SSH handshake is completed".

Reported-by: Marcel Hernandez
Ref: https://github.com/curl/curl/issues/3760

Closes https://github.com/curl/curl/pull/3773

lib/url.c
lib/urldata.h

index 14e6e262590f3d749c9148993655ac57116bf41a..031f8f0c4297c90fe40b3b5066de770b2086921c 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -3815,7 +3815,9 @@ CURLcode Curl_setup_conn(struct connectdata *conn,
   }
   else {
     Curl_pgrsTime(data, TIMER_CONNECT);    /* we're connected already */
-    Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
+    if(conn->ssl[FIRSTSOCKET].use ||
+       (conn->handler->protocol & PROTO_FAMILY_SSH))
+      Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
     conn->bits.tcpconnect[FIRSTSOCKET] = TRUE;
     *protocol_done = TRUE;
     Curl_updateconninfo(conn, conn->sock[FIRSTSOCKET]);
index 310d93d1854ac44d26b8d1a1bd36bab68e1f81a2..2700bc2a6dadf483574798b46c52c3bef2a041bb 100644 (file)
@@ -68,6 +68,7 @@
 #define PROTO_FAMILY_POP3 (CURLPROTO_POP3|CURLPROTO_POP3S)
 #define PROTO_FAMILY_SMB  (CURLPROTO_SMB|CURLPROTO_SMBS)
 #define PROTO_FAMILY_SMTP (CURLPROTO_SMTP|CURLPROTO_SMTPS)
+#define PROTO_FAMILY_SSH  (CURLPROTO_SCP|CURLPROTO_SFTP)
 
 #define DEFAULT_CONNCACHE_SIZE 5