File wget-http-specify-Host-when-CONNECT-is-used.patch of Package wget.31872

From aed7d4163a9e2083d294a9471e1347ab13d6f2ab Mon Sep 17 00:00:00 2001
From: Pavel Mateja <pavel@netsafe.cz>
Date: Sat, 2 Nov 2013 11:27:58 +0100
Subject: [PATCH] http: specify Host when CONNECT is used.

---
 src/ChangeLog | 4 ++++
 src/http.c    | 7 +++----
 2 files changed, 7 insertions(+), 4 deletions(-)

Index: wget-1.14/src/ChangeLog
===================================================================
--- wget-1.14.orig/src/ChangeLog
+++ wget-1.14/src/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-30  Pavel Mateja  <pavel@netsafe.cz> (tiny change)
+
+	* http.c (gethttp): Specify "Host" for CONNECT method.
+
 2014-09-08  Darshit Shah  <darnir@gmail.com>
 
 	* init.c (defaults): Set retr-symlinks to true by default. This changes a
Index: wget-1.14/src/http.c
===================================================================
--- wget-1.14.orig/src/http.c
+++ wget-1.14/src/http.c
@@ -2037,10 +2037,9 @@ gethttp (struct url *u, struct http_stat
                  the regular request below.  */
               proxyauth = NULL;
             }
-          /* Examples in rfc2817 use the Host header in CONNECT
-             requests.  I don't see how that gains anything, given
-             that the contents of Host would be exactly the same as
-             the contents of CONNECT.  */
+          request_set_header (connreq, "Host",
+                              aprintf ("%s:%d", u->host, u->port),
+                              rel_value);
 
           write_error = request_send (connreq, sock, 0);
           request_free (connreq);
openSUSE Build Service is sponsored by