wget: fix fetching of https URLs without http proxy
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 2 Jul 2018 16:31:02 +0000 (18:31 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 2 Jul 2018 16:31:02 +0000 (18:31 +0200)
The "fix fetching of https URLs with http proxy" commit
broke the usual http-to-https redirect:

$ wget http://busybox.net/downloads/busybox-1.29.0.tar.bz2
Connecting to busybox.net (140.211.167.122:80)
Connecting to busybox.net (140.211.167.122:443)
wget: server returned error: HTTP/1.1 400 Bad Request

Fixing...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/wget.c

index 8103aacee74c7135c7c1d3a6745bf89d6e9f016e..33c93bad3136f61894ae3ae271b20a9b62935e92 100644 (file)
@@ -1335,6 +1335,7 @@ However, in real world it was observed that some web servers
                                                /* server.user remains untouched */
                                                free(server.allocated);
                                                server.allocated = NULL;
+                                               server.protocol = target.protocol;
                                                server.host = target.host;
                                                /* strip_ipv6_scope_id(target.host); - no! */
                                                /* we assume remote never gives us IPv6 addr with scope id */