mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Wrap numeric IPv6 addresses in square brackets when sending out HTTP
`Host' header. Published in <sxs7kq4vgzf.fsf@florida.arsdigita.de>.
This commit is contained in:
parent
1bea726393
commit
f2bb99d102
@ -1,3 +1,8 @@
|
|||||||
|
2002-01-26 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
|
* http.c (gethttp): Wrap host name in square brackets if it
|
||||||
|
contains a colon.
|
||||||
|
|
||||||
2002-01-26 Hrvoje Niksic <hniksic@arsdigita.com>
|
2002-01-26 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
* url.c (url_parse): Allow all hex digits, not only decimal ones,
|
* url.c (url_parse): Allow all hex digits, not only decimal ones,
|
||||||
|
13
src/http.c
13
src/http.c
@ -559,6 +559,11 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
|
|||||||
/* Whether keep-alive should be inhibited. */
|
/* Whether keep-alive should be inhibited. */
|
||||||
int inhibit_keep_alive;
|
int inhibit_keep_alive;
|
||||||
|
|
||||||
|
/* Whether we need to print the host header with braces around host,
|
||||||
|
e.g. "Host: [3ffe:8100:200:2::2]:1234" instead of the usual
|
||||||
|
"Host: symbolic-name:1234". */
|
||||||
|
int squares_around_host = 0;
|
||||||
|
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
/* initialize ssl_ctx on first run */
|
/* initialize ssl_ctx on first run */
|
||||||
if (!ssl_ctx)
|
if (!ssl_ctx)
|
||||||
@ -811,6 +816,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
|
|||||||
"param=value", full_path will be "/foo/bar?param=value". */
|
"param=value", full_path will be "/foo/bar?param=value". */
|
||||||
full_path = url_full_path (u);
|
full_path = url_full_path (u);
|
||||||
|
|
||||||
|
if (strchr (u->host, ':'))
|
||||||
|
squares_around_host = 1;
|
||||||
|
|
||||||
/* Allocate the memory for the request. */
|
/* Allocate the memory for the request. */
|
||||||
request = (char *)alloca (strlen (command)
|
request = (char *)alloca (strlen (command)
|
||||||
+ strlen (full_path)
|
+ strlen (full_path)
|
||||||
@ -832,11 +840,12 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
|
|||||||
sprintf (request, "\
|
sprintf (request, "\
|
||||||
%s %s HTTP/1.0\r\n\
|
%s %s HTTP/1.0\r\n\
|
||||||
User-Agent: %s\r\n\
|
User-Agent: %s\r\n\
|
||||||
Host: %s%s\r\n\
|
Host: %s%s%s%s\r\n\
|
||||||
Accept: %s\r\n\
|
Accept: %s\r\n\
|
||||||
%s%s%s%s%s%s%s%s\r\n",
|
%s%s%s%s%s%s%s%s\r\n",
|
||||||
command, full_path,
|
command, full_path,
|
||||||
useragent, u->host,
|
useragent,
|
||||||
|
squares_around_host ? "[" : "", u->host, squares_around_host ? "]" : "",
|
||||||
port_maybe ? port_maybe : "",
|
port_maybe ? port_maybe : "",
|
||||||
HTTP_ACCEPT,
|
HTTP_ACCEPT,
|
||||||
request_keep_alive ? request_keep_alive : "",
|
request_keep_alive ? request_keep_alive : "",
|
||||||
|
Loading…
Reference in New Issue
Block a user