The Host: header now includes the port number if not default HTTP
authorDaniel Stenberg <daniel@haxx.se>
Tue, 25 Jul 2000 07:28:28 +0000 (07:28 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 25 Jul 2000 07:28:28 +0000 (07:28 +0000)
lib/http.c

index d83942d..c3fb857 100644 (file)
@@ -269,9 +269,12 @@ CURLcode http(struct connectdata *conn)
     http->sendit = getFormData(data->httppost, &http->postsize);
   }
 
-  if(!checkheaders(data, "Host:"))
-    data->ptr_host = maprintf("Host: %s\r\n", host);
-
+  if(!checkheaders(data, "Host:")) {
+    if(data->port != PORT_HTTP)
+      data->ptr_host = maprintf("Host: %s:%d\r\n", host, data->port);
+    else
+      data->ptr_host = maprintf("Host: %s\r\n", host);
+  }
 
   if(!checkheaders(data, "Pragma:"))
     http->p_pragma = "Pragma: no-cache\r\n";