From 710f14edba4491a4ac9222a7e3103b51fd30dbe0 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 20 Apr 2014 19:37:54 +0200 Subject: handler: make 'protocol' always specified as a single bit This makes the findprotocol() function work as intended so that libcurl can properly be restricted to not support HTTP while still supporting HTTPS - since the HTTPS handler previously set both the HTTP and HTTPS bits in the protocol field. This fixes --proto and --proto-redir for most SSL protocols. This is done by adding a few new convenience defines that groups HTTP and HTTPS, FTP and FTPS etc that should then be used when the code wants to check for both protocols at once. PROTO_FAMILY_[protocol] style. Bug: https://github.com/bagder/curl/pull/97 Reported-by: drizzt --- lib/url.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/url.c') diff --git a/lib/url.c b/lib/url.c index b871bd634..409085f93 100644 --- a/lib/url.c +++ b/lib/url.c @@ -2703,7 +2703,7 @@ static bool SocketIsDead(curl_socket_t sock) static bool IsPipeliningPossible(const struct SessionHandle *handle, const struct connectdata *conn) { - if((conn->handler->protocol & CURLPROTO_HTTP) && + if((conn->handler->protocol & PROTO_FAMILY_HTTP) && Curl_multi_pipeline_enabled(handle->multi) && (handle->set.httpreq == HTTPREQ_GET || handle->set.httpreq == HTTPREQ_HEAD) && @@ -2927,7 +2927,7 @@ ConnectionExists(struct SessionHandle *data, bool canPipeline = IsPipeliningPossible(data, needle); bool wantNTLMhttp = ((data->state.authhost.want & CURLAUTH_NTLM) || (data->state.authhost.want & CURLAUTH_NTLM_WB)) && - (needle->handler->protocol & CURLPROTO_HTTP) ? TRUE : FALSE; + (needle->handler->protocol & PROTO_FAMILY_HTTP) ? TRUE : FALSE; struct connectbundle *bundle; *force_reuse = FALSE; @@ -5330,7 +5330,7 @@ static CURLcode create_conn(struct SessionHandle *data, #else /* force this connection's protocol to become HTTP if not already compatible - if it isn't tunneling through */ - if(!(conn->handler->protocol & CURLPROTO_HTTP) && + if(!(conn->handler->protocol & PROTO_FAMILY_HTTP) && !conn->bits.tunnel_proxy) conn->handler = &Curl_handler_http; -- cgit v1.2.3