From: Daniel Stenberg Date: Fri, 20 Oct 2000 13:48:38 +0000 (+0000) Subject: remote_port used in Host: headers only when non-default X-Git-Tag: curl-7_5~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c44b10de41ffca204acf11f36093c24521119239;p=thirdparty%2Fcurl.git remote_port used in Host: headers only when non-default --- diff --git a/lib/http.c b/lib/http.c index 551fac3397..1e6bd24b2d 100644 --- a/lib/http.c +++ b/lib/http.c @@ -336,7 +336,13 @@ CURLcode http(struct connectdata *conn) } if(!checkheaders(data, "Host:")) { - data->ptr_host = maprintf("Host: %s:%d\r\n", host, data->remote_port); + if(((conn->protocol&PROT_HTTPS) && (data->remote_port == PORT_HTTPS)) || + (!(conn->protocol&PROT_HTTPS) && (data->remote_port == PORT_HTTP)) ) + /* If (HTTPS on port 443) OR (non-HTTPS on port 80) then don't include + the port number in the host string */ + data->ptr_host = maprintf("Host: %s\r\n", host); + else + data->ptr_host = maprintf("Host: %s:%d\r\n", host, data->remote_port); } if(!checkheaders(data, "Pragma:")) diff --git a/lib/url.c b/lib/url.c index c6f2606f75..7532221242 100644 --- a/lib/url.c +++ b/lib/url.c @@ -961,7 +961,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect) conn->curl_close = http_close; #else /* USE_SSLEAY */ - failf(data, "SSL is disabled, https: not supported!"); + failf(data, "libcurl was built with SSL disabled, https: not supported!"); return CURLE_UNSUPPORTED_PROTOCOL; #endif /* !USE_SSLEAY */ } @@ -1137,7 +1137,8 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect) *tmp++ = '\0'; data->port = atoi(tmp); } - + data->remote_port = data->port; /* it is the same port */ + /* Connect to target host right on */ conn->hp = GetHost(data, conn->name, &conn->hostent_buf); if(!conn->hp) {