diff options
| author | Kelly Yancey <kbyanc@FreeBSD.org> | 2005-03-02 19:09:28 +0000 | 
|---|---|---|
| committer | Kelly Yancey <kbyanc@FreeBSD.org> | 2005-03-02 19:09:28 +0000 | 
| commit | 448980e7042f277523d2f5d7a11e7c5e94e2fcbf (patch) | |
| tree | 507f0b109569c9125a6c0197319a591ed7f1e8f6 /lib/libfetch | |
| parent | bed34fbfb64cdf4ae56a8f7c618c52ddf0c1b2ed (diff) | |
Notes
Diffstat (limited to 'lib/libfetch')
| -rw-r--r-- | lib/libfetch/http.c | 17 | 
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index d0008aa9ca1e..bac7b0f75302 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -792,7 +792,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,  	conn_t *conn;  	struct url *url, *new;  	int chunked, direct, need_auth, noredirect, verbose; -	int e, i, n; +	int e, i, n, val;  	off_t offset, clength, length, size;  	time_t mtime;  	const char *p; @@ -913,7 +913,20 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,  			_http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset);  		_http_cmd(conn, "Connection: close");  		_http_cmd(conn, ""); -		shutdown(conn->sd, SHUT_WR); + +		/* +		 * Force the queued request to be dispatched.  Normally, one +		 * would do this with shutdown(2) but squid proxies can be +		 * configured to disallow such half-closed connections.  To +		 * be compatible with such configurations, fiddle with socket +		 * options to force the pending data to be written. +		 */ +		val = 0; +		setsockopt(conn->sd, IPPROTO_TCP, TCP_NOPUSH, &val, +			   sizeof(val)); +		val = 1; +		setsockopt(conn->sd, IPPROTO_TCP, TCP_NODELAY, &val, +			   sizeof(val));  		/* get reply */  		switch (_http_get_reply(conn)) {  | 
