From da58d03ff7be9fc5e0219d95ce2f9932e2272473 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 25 Nov 2006 13:32:04 +0000 Subject: Venkat Akella found out that libcurl did not like HTTP responses that simply responded with a single status line and no headers nor body. Starting now, a HTTP response on a persistent connection (i.e not set to be closed after the response has been taken care of) must have Content-Length or chunked encoding set, or libcurl will simply assume that there is no body. To my horror I learned that we had no less than 57(!) test cases that did bad HTTP responses like this, and even the test http server (sws) responded badly when queried by the test system if it is the test system. So although the actual fix for the problem was tiny, going through all the newly failing test cases got really painful and boring. --- lib/transfer.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/transfer.c b/lib/transfer.c index 2d5d0dfe8..6b7b81978 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -501,9 +501,19 @@ CURLcode Curl_readwrite(struct connectdata *conn, k->keepon |= KEEP_WRITE; } } - else + else { k->header = FALSE; /* no more header to parse! */ + if((k->size == -1) && !conn->bits.chunk && !conn->bits.close) + /* When connection is not to get closed, but no + Content-Length nor Content-Encoding chunked have been + received, there is no body in this response. We don't set + stop_reading TRUE since that would also prevent necessary + authentication actions to take place. */ + conn->bits.no_body = TRUE; + + } + if (417 == k->httpcode) { /* * we got: "417 Expectation Failed" this means: -- cgit v1.2.3