From 2db894807b546087b4e03af5afa0cb07aae6127c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 23 Jan 2002 07:15:32 +0000 Subject: =?UTF-8?q?Andr=E9s=20Garc=EDa=20found=20out=20that=20we=20didn't?= =?UTF-8?q?=20properly=20stop=20reading=20from=20a=20connection=20after=20?= =?UTF-8?q?the=20headers=20on=20a=20HEAD=20request.=20This=20bug=20has=20b?= =?UTF-8?q?een=20added=20in=207.9.3=20and=20was=20mnot=20present=20earlier?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/transfer.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'lib/transfer.c') diff --git a/lib/transfer.c b/lib/transfer.c index b57560b56..f08e88c8a 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -356,10 +356,11 @@ CURLcode Curl_readwrite(struct connectdata *conn, * If we requested a "no body", this is a good time to get * out and return home. */ - if(data->set.no_body) - return CURLE_OK; + bool stop_reading = FALSE; - if(!conn->bits.close) { + if(data->set.no_body) + stop_reading = TRUE; + else if(!conn->bits.close) { /* If this is not the last request before a close, we must set the maximum download size to the size of the expected document or else, we won't know when to stop @@ -370,10 +371,18 @@ CURLcode Curl_readwrite(struct connectdata *conn, /* If max download size is *zero* (nothing) we already have nothing and can safely return ok now! */ if(0 == conn->maxdownload) - return CURLE_OK; + stop_reading = TRUE; /* What to do if the size is *not* known? */ } + + if(stop_reading) { + /* we make sure that this socket isn't read more now */ + k->keepon &= ~KEEP_READ; + FD_ZERO(&k->rkeepfd); + return CURLE_OK; + } + break; /* exit header line loop */ } -- cgit v1.2.3