Skip to content

Commit 507e7be

Browse files
committed
url: do not reuse a non-tls starttls connection if new requires TLS
Reported-by: Arkadi Vainbrand Closes #21082
1 parent 62d77b1 commit 507e7be

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/url.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ struct url_conn_match {
723723
BIT(want_proxy_ntlm_http);
724724
BIT(want_nego_http);
725725
BIT(want_proxy_nego_http);
726-
726+
BIT(req_tls); /* require TLS use from a clear-text start */
727727
BIT(wait_pipe);
728728
BIT(force_reuse);
729729
BIT(seen_pending_conn);
@@ -875,6 +875,9 @@ static bool url_match_ssl_use(struct connectdata *conn,
875875
(get_protocol_family(conn->scheme) != m->needle->scheme->protocol))
876876
return FALSE;
877877
}
878+
else if(m->req_tls)
879+
/* a clear-text STARTTLS protocol with required TLS */
880+
return FALSE;
878881
return TRUE;
879882
}
880883

@@ -1333,6 +1336,7 @@ static bool url_attach_existing(struct Curl_easy *data,
13331336
(needle->scheme->protocol & PROTO_FAMILY_HTTP);
13341337
#endif
13351338
#endif
1339+
match.req_tls = data->set.use_ssl >= CURLUSESSL_CONTROL;
13361340

13371341
/* Find a connection in the pool that matches what "data + needle"
13381342
* requires. If a suitable candidate is found, it is attached to "data". */

0 commit comments

Comments
 (0)