Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 4 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jul 11, 2012
@bagder HEAD: don't force-close after response-headers
A HEAD response has no body length and gets the headers like the
corresponding GET would so it should not get closed after the response
based on the same rules. This mistake caused connections that did HEAD
to get closed too often without a valid reason.

Reported by: Eelco Dolstra
@bagder connection-monitor: always log disconnect when enabled
This makes verifying easier and makes us more sure curl closes the
connection only at the correct point in time. Adjusted test 206 and 1008
accordingly and updated the docs for it.
@bagder test48: verify that HEAD doesn't close extra
Two commits ago, we fixed a bug where the connction would be closed
prematurely after a HEAD. Now I added connection-monitor to test 48 and
added a second HEAD and make sure that both are sent over the same

This triggered a failure before the bug fix and now works. Will help us
avoid a future regression of this kind.
@bagder SWS: use of uninitialized memory fix
I made "connmon" not get initialized properly before use, and I use the
big hammer and make sure we always clear the entire struct to avoid any
problem like this in the future.
3  lib/http.c
@@ -2851,7 +2851,8 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
if((k->size == -1) && !k->chunk && !conn->bits.close &&
(conn->httpversion >= 11) &&
- !(conn->handler->protocol & CURLPROTO_RTSP)) {
+ !(conn->handler->protocol & CURLPROTO_RTSP) &&
+ data->set.httpreq != HTTPREQ_HEAD) {
/* On HTTP 1.1, when connection is not to get closed, but no
Content-Length nor Content-Encoding chunked have been
received, according to RFC2616 section 4.4 point 5, we
@@ -135,12 +135,7 @@ rtp: part [num] channel [num] size [num]
with the given payload size
connection-monitor When used, this will log [DISCONNECT] to the server.input
- log if the connection is disconnected while the given request
- is handled. Note that if the connection isn't disconnected and
- the server loops and waits for the next request on the
- persistent connection then the internal boolean for connection
- monitoring will be reset to default and if then the connection
- gets discconected nothing will be output.
+ log when the connection is disconnected.
1  tests/data/test1008
@@ -124,6 +124,7 @@ User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6
Accept: */*
1  tests/data/test206
@@ -98,6 +98,7 @@ User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6
Accept: */*
11 tests/data/test48
@@ -9,10 +9,12 @@ HTTP HEAD
# Server-side
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
-Connection: close
@@ -27,7 +29,7 @@ http
HTTP with -d and -G and -I
--d "foo=moo&moo=poo" http://%HOSTIP:%HTTPPORT/48 -G -I
+-d "foo=moo&moo=poo" http://%HOSTIP:%HTTPPORT/48 -G -I http://%HOSTIP:%HTTPPORT/48
@@ -42,6 +44,11 @@ HEAD /48?foo=moo&moo=poo HTTP/1.1
Accept: */*
+HEAD /48?foo=moo&moo=poo HTTP/1.1
+Accept: */*
6 tests/server/sws.c
@@ -347,6 +347,8 @@ static int parse_servercmd(struct httprequest *req)
return 1; /* done */
+ req->connmon = FALSE;
cmd = orgcmd;
while(cmd && cmdsize) {
char *check;
@@ -837,7 +839,6 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
req->pipelining = FALSE;
req->callcount = 0;
req->connect_port = 0;
- req->connmon = FALSE;
/*** end of httprequest init ***/
@@ -1439,6 +1440,7 @@ static void http_connect(curl_socket_t *infdp,
if(datafd != CURL_SOCKET_BAD) {
struct httprequest req2;
int err;
+ memset(&req2, 0, sizeof(req2));
logmsg("====> Client connect DATA");
/* Disable the Nagle algorithm */
@@ -1698,6 +1700,8 @@ int main(int argc, char *argv[])
bool use_fork = FALSE;
+ memset(&req, 0, sizeof(req));
while(argc>arg) {
if(!strcmp("--version", argv[arg])) {
printf("sws IPv4%s"

No commit comments for this range

Something went wrong with that request. Please try again.