]> granicus.if.org Git - curl/commitdiff
http: do not treat FTPS over CONNECT as HTTPS
authorKamil Dudka <kdudka@redhat.com>
Tue, 28 Mar 2017 13:50:59 +0000 (15:50 +0200)
committerKamil Dudka <kdudka@redhat.com>
Tue, 28 Mar 2017 15:04:16 +0000 (17:04 +0200)
If we use FTPS over CONNECT, the TLS handshake for the FTPS control
connection needs to be initiated in the SENDPROTOCONNECT state, not
the WAITPROXYCONNECT state.  Otherwise, if the TLS handshake completed
without blocking, the information about the completed TLS handshake
would be saved to a wrong flag.  Consequently, the TLS handshake would
be initiated in the SENDPROTOCONNECT state once again on the same
connection, resulting in a failure of the TLS handshake.  I was able to
observe the failure with the NSS backend if curl ran through valgrind.

Note that this commit partially reverts curl-7_21_6-52-ge34131d.

lib/http.c

index 0b680b2d60b64fc0a28243077e0bdcdae954c6f1..22d45470974a5c253847d211b5e3416fdcfdb0fe 100644 (file)
@@ -1369,7 +1369,7 @@ CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
     /* nothing else to do except wait right now - we're not done here. */
     return CURLE_OK;
 
-  if(conn->given->flags & PROTOPT_SSL) {
+  if(conn->given->protocol & CURLPROTO_HTTPS) {
     /* perform SSL initialization */
     result = https_connecting(conn, done);
     if(result)