mirror of
https://github.com/mirror/wget.git
synced 2025-03-27 20:40:27 +08:00
[svn] New option --no-http-keep-alive.
Published in <sxsd7fr1pdf.fsf@florida.arsdigita.de>.
This commit is contained in:
parent
b27144fcce
commit
f2f77d87fd
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-20 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
|
* http.c (gethttp): Don't use the return value of sprintf().
|
||||||
|
(gethttp): Inhibit keep-alive if opt.http_keep_alive is 0.
|
||||||
|
|
||||||
2000-11-20 Hrvoje Niksic <hniksic@arsdigita.com>
|
2000-11-20 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
* recur.c (recursive_retrieve): Print the "so we don't load"
|
* recur.c (recursive_retrieve): Print the "so we don't load"
|
||||||
|
23
src/http.c
23
src/http.c
@ -444,9 +444,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;
|
char *port_maybe;
|
||||||
char *request_keep_alive;
|
char *request_keep_alive;
|
||||||
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;
|
||||||
@ -474,7 +473,7 @@ gethttp (struct urlinfo *u, struct http_stat *hs, int *dt)
|
|||||||
authenticate_h = 0;
|
authenticate_h = 0;
|
||||||
auth_tried_already = 0;
|
auth_tried_already = 0;
|
||||||
|
|
||||||
inhibit_keep_alive = (u->proxy != NULL);
|
inhibit_keep_alive = (!opt.http_keep_alive || u->proxy != NULL);
|
||||||
|
|
||||||
again:
|
again:
|
||||||
/* We need to come back here when the initial attempt to retrieve
|
/* We need to come back here when the initial attempt to retrieve
|
||||||
@ -623,15 +622,12 @@ 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)
|
/* String of the form :PORT. Used only for non-standard ports. */
|
||||||
|
port_maybe = NULL;
|
||||||
|
if (remport != 80)
|
||||||
{
|
{
|
||||||
host_port = NULL;
|
port_maybe = (char *)alloca (numdigit (remport) + 2);
|
||||||
host_port_len = 0;
|
sprintf (port_maybe, ":%d", remport);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
host_port = (char *)alloca (numdigit (remport) + 2);
|
|
||||||
host_port_len = sprintf (host_port, ":%d", remport);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inhibit_keep_alive)
|
if (!inhibit_keep_alive)
|
||||||
@ -642,7 +638,8 @@ gethttp (struct urlinfo *u, struct http_stat *hs, int *dt)
|
|||||||
/* 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) + host_port_len
|
+ strlen (remhost)
|
||||||
|
+ (port_maybe ? strlen (port_maybe) : 0)
|
||||||
+ strlen (HTTP_ACCEPT)
|
+ strlen (HTTP_ACCEPT)
|
||||||
+ (request_keep_alive
|
+ (request_keep_alive
|
||||||
? strlen (request_keep_alive) : 0)
|
? strlen (request_keep_alive) : 0)
|
||||||
@ -661,7 +658,7 @@ Host: %s%s\r\n\
|
|||||||
Accept: %s\r\n\
|
Accept: %s\r\n\
|
||||||
%s%s%s%s%s%s%s\r\n",
|
%s%s%s%s%s%s%s\r\n",
|
||||||
command, path, useragent, remhost,
|
command, path, useragent, remhost,
|
||||||
host_port ? host_port : "",
|
port_maybe ? port_maybe : "",
|
||||||
HTTP_ACCEPT,
|
HTTP_ACCEPT,
|
||||||
request_keep_alive ? request_keep_alive : "",
|
request_keep_alive ? request_keep_alive : "",
|
||||||
referer ? referer : "",
|
referer ? referer : "",
|
||||||
|
@ -122,6 +122,7 @@ static struct {
|
|||||||
{ "header", NULL, cmd_spec_header },
|
{ "header", NULL, cmd_spec_header },
|
||||||
{ "htmlextension", &opt.html_extension, cmd_boolean },
|
{ "htmlextension", &opt.html_extension, cmd_boolean },
|
||||||
{ "htmlify", NULL, cmd_spec_htmlify },
|
{ "htmlify", NULL, cmd_spec_htmlify },
|
||||||
|
{ "httpkeepalive", &opt.http_keep_alive, cmd_boolean },
|
||||||
{ "httppasswd", &opt.http_passwd, cmd_string },
|
{ "httppasswd", &opt.http_passwd, cmd_string },
|
||||||
{ "httpproxy", &opt.http_proxy, cmd_string },
|
{ "httpproxy", &opt.http_proxy, cmd_string },
|
||||||
{ "httpuser", &opt.http_user, cmd_string },
|
{ "httpuser", &opt.http_user, cmd_string },
|
||||||
@ -214,6 +215,7 @@ defaults (void)
|
|||||||
opt.netrc = 1;
|
opt.netrc = 1;
|
||||||
opt.ftp_glob = 1;
|
opt.ftp_glob = 1;
|
||||||
opt.htmlify = 1;
|
opt.htmlify = 1;
|
||||||
|
opt.http_keep_alive = 1;
|
||||||
opt.use_proxy = 1;
|
opt.use_proxy = 1;
|
||||||
tmp = getenv ("no_proxy");
|
tmp = getenv ("no_proxy");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
|
@ -247,6 +247,7 @@ main (int argc, char *const *argv)
|
|||||||
{ "no-directories", no_argument, NULL, 19 },
|
{ "no-directories", no_argument, NULL, 19 },
|
||||||
{ "no-host-directories", no_argument, NULL, 20 },
|
{ "no-host-directories", no_argument, NULL, 20 },
|
||||||
{ "no-host-lookup", no_argument, NULL, 22 },
|
{ "no-host-lookup", no_argument, NULL, 22 },
|
||||||
|
{ "no-http-keep-alive", no_argument, NULL, 28 },
|
||||||
{ "no-parent", no_argument, NULL, 5 },
|
{ "no-parent", no_argument, NULL, 5 },
|
||||||
{ "non-verbose", no_argument, NULL, 18 },
|
{ "non-verbose", no_argument, NULL, 18 },
|
||||||
{ "passive-ftp", no_argument, NULL, 11 },
|
{ "passive-ftp", no_argument, NULL, 11 },
|
||||||
@ -385,6 +386,9 @@ hpVqvdkKsxmNWrHSLcFbEY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:",
|
|||||||
case 27:
|
case 27:
|
||||||
setval ("bindaddress", optarg);
|
setval ("bindaddress", optarg);
|
||||||
break;
|
break;
|
||||||
|
case 28:
|
||||||
|
setval ("httpkeepalive", "off");
|
||||||
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
setval ("background", "on");
|
setval ("background", "on");
|
||||||
break;
|
break;
|
||||||
@ -579,6 +583,9 @@ GNU General Public License for more details.\n"));
|
|||||||
case 'p':
|
case 'p':
|
||||||
setval ("noparent", "on");
|
setval ("noparent", "on");
|
||||||
break;
|
break;
|
||||||
|
case 'k':
|
||||||
|
setval ("httpkeepalive", "off");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf (_("%s: illegal option -- `-n%c'\n"), exec_name, *p);
|
printf (_("%s: illegal option -- `-n%c'\n"), exec_name, *p);
|
||||||
print_usage ();
|
print_usage ();
|
||||||
|
@ -86,6 +86,7 @@ struct options
|
|||||||
char *http_user; /* HTTP user. */
|
char *http_user; /* HTTP user. */
|
||||||
char *http_passwd; /* HTTP password. */
|
char *http_passwd; /* HTTP password. */
|
||||||
char *user_header; /* User-defined header(s). */
|
char *user_header; /* User-defined header(s). */
|
||||||
|
int http_keep_alive; /* whether we use keep-alive */
|
||||||
|
|
||||||
int use_proxy; /* Do we use proxy? */
|
int use_proxy; /* Do we use proxy? */
|
||||||
int proxy_cache; /* Do we load from proxy cache? */
|
int proxy_cache; /* Do we load from proxy cache? */
|
||||||
|
Loading…
Reference in New Issue
Block a user