mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Applied contributed patch.
This commit is contained in:
parent
f4f8e83327
commit
cf35e2009d
@ -1,3 +1,8 @@
|
|||||||
|
1999-05-02 andrew deryabin <djsf@softhome.net>
|
||||||
|
|
||||||
|
* http.c (gethttp): Specify port in `Host' header only if it's
|
||||||
|
different from 80.
|
||||||
|
|
||||||
1998-11-03 Edward J. Sabol <sabol@alderaan.gsfc.nasa.gov>
|
1998-11-03 Edward J. Sabol <sabol@alderaan.gsfc.nasa.gov>
|
||||||
|
|
||||||
* recur.c (recursive_retrieve): If a finite maximum depth is
|
* recur.c (recursive_retrieve): If a finite maximum depth is
|
||||||
|
19
src/http.c
19
src/http.c
@ -309,6 +309,8 @@ gethttp (struct urlinfo *u, struct http_stat *hs, int *dt)
|
|||||||
char *authenticate_h;
|
char *authenticate_h;
|
||||||
char *proxyauth;
|
char *proxyauth;
|
||||||
char *all_headers;
|
char *all_headers;
|
||||||
|
char *host_port;
|
||||||
|
int host_port_len;
|
||||||
int sock, hcount, num_written, all_length, remport, statcode;
|
int sock, hcount, num_written, all_length, remport, statcode;
|
||||||
long contlen, contrange;
|
long contlen, contrange;
|
||||||
struct urlinfo *ou;
|
struct urlinfo *ou;
|
||||||
@ -454,10 +456,19 @@ gethttp (struct urlinfo *u, struct http_stat *hs, int *dt)
|
|||||||
}
|
}
|
||||||
remhost = ou->host;
|
remhost = ou->host;
|
||||||
remport = ou->port;
|
remport = ou->port;
|
||||||
|
|
||||||
|
if (remport == 80) {
|
||||||
|
host_port = NULL; host_port_len = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
host_port = (char *)alloca (numdigit (remport) + 2);
|
||||||
|
host_port_len = sprintf (host_port, ":%d", remport);
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate the memory for the request. */
|
/* Allocate the memory for the request. */
|
||||||
request = (char *)alloca (strlen (command) + strlen (path)
|
request = (char *)alloca (strlen (command) + strlen (path)
|
||||||
+ strlen (useragent)
|
+ strlen (useragent)
|
||||||
+ strlen (remhost) + numdigit (remport)
|
+ strlen (remhost) + host_port_len
|
||||||
+ strlen (HTTP_ACCEPT)
|
+ strlen (HTTP_ACCEPT)
|
||||||
+ (referer ? strlen (referer) : 0)
|
+ (referer ? strlen (referer) : 0)
|
||||||
+ (wwwauth ? strlen (wwwauth) : 0)
|
+ (wwwauth ? strlen (wwwauth) : 0)
|
||||||
@ -470,11 +481,11 @@ gethttp (struct urlinfo *u, struct http_stat *hs, int *dt)
|
|||||||
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:%d\r\n\
|
Host: %s%s\r\n\
|
||||||
Accept: %s\r\n\
|
Accept: %s\r\n\
|
||||||
%s%s%s%s%s%s\r\n",
|
%s%s%s%s%s%s\r\n",
|
||||||
command, path, useragent, remhost, remport, HTTP_ACCEPT,
|
command, path, useragent, remhost, host_port ? host_port : "",
|
||||||
referer ? referer : "",
|
HTTP_ACCEPT, referer ? referer : "",
|
||||||
wwwauth ? wwwauth : "",
|
wwwauth ? wwwauth : "",
|
||||||
proxyauth ? proxyauth : "",
|
proxyauth ? proxyauth : "",
|
||||||
range ? range : "",
|
range ? range : "",
|
||||||
|
Loading…
Reference in New Issue
Block a user