Use persistent connections with proxies supporting them.

This commit is contained in:
Giuseppe Scrivano 2010-08-09 12:56:49 +02:00
parent 87ad80cacc
commit 2107eb06ab
2 changed files with 15 additions and 9 deletions

View File

@ -1,8 +1,12 @@
2010-08-09 Giuseppe Scrivano <gscrivano@gnu.org>
Fix a problem with HTTP/1.0 proxies.
* http.c (gethttp): Specify the connection header when keep alive
connections are not used.
Use persistent connections with proxies supporting them.
* http.c (gethttp): Specify Proxy-Connection to the HTTP proxy.
2010-08-06 Giuseppe Scrivano <gscrivano@gnu.org>
* css-url.c (get_uri_string): Skip empty urls.

View File

@ -1573,15 +1573,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
/* Is the server using the chunked transfer encoding? */
bool chunked_transfer_encoding = false;
/* Whether keep-alive should be inhibited.
RFC 2068 requests that 1.0 clients not send keep-alive requests
to proxies. This is because many 1.0 proxies do not interpret
the Connection header and transfer it to the remote server,
causing it to not close the connection and leave both the proxy
and the client hanging. */
/* Whether keep-alive should be inhibited. */
bool inhibit_keep_alive =
!opt.http_keep_alive || opt.ignore_length || proxy != NULL;
!opt.http_keep_alive || opt.ignore_length;
/* Headers sent when using POST. */
wgint post_data_size = 0;
@ -1694,7 +1688,15 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
if (inhibit_keep_alive)
request_set_header (req, "Connection", "Close", rel_none);
else
request_set_header (req, "Connection", "Keep-Alive", rel_none);
{
if (proxy == NULL)
request_set_header (req, "Connection", "Keep-Alive", rel_none);
else
{
request_set_header (req, "Connection", "Close", rel_none);
request_set_header (req, "Proxy-Connection", "Keep-Alive", rel_none);
}
}
if (opt.post_data || opt.post_file_name)
{