diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-04-04 12:19:56 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-04-04 12:19:56 +0000 |
commit | 1cfcbc50a69c4de7a46cc740db005a83ec445ee6 (patch) | |
tree | 3bef8b18ab844786e9c00ed6015c3512633971f9 | |
parent | ea1f138c081416869e26c00712adfa7db9df6030 (diff) |
Fixes the problem Jacky Jam pointed out, where libcurl will "hang" for an
extra second after having downloaded headers-only
-rw-r--r-- | lib/transfer.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index f34ec1f8d..5d6f13309 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -215,6 +215,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, headers at the moment or not. */ if (k->header) { /* we are in parse-the-header-mode */ + bool stop_reading = FALSE; /* header line within buffer loop */ do { @@ -356,8 +357,6 @@ CURLcode Curl_readwrite(struct connectdata *conn, * If we requested a "no body", this is a good time to get * out and return home. */ - bool stop_reading = FALSE; - if(data->set.no_body) stop_reading = TRUE; else if(!conn->bits.close) { @@ -380,9 +379,6 @@ CURLcode Curl_readwrite(struct connectdata *conn, /* we make sure that this socket isn't read more now */ k->keepon &= ~KEEP_READ; FD_ZERO(&k->rkeepfd); - /* for a progress meter/info update before going away */ - Curl_pgrsUpdate(conn); - return CURLE_OK; } break; /* exit header line loop */ @@ -609,7 +605,11 @@ CURLcode Curl_readwrite(struct connectdata *conn, k->hbufp = data->state.headerbuff; k->hbuflen = 0; } - while (*k->str); /* header line within buffer */ + while (!stop_reading && *k->str); /* header line within buffer */ + + if(stop_reading) + /* We've stopped dealing with input, get out of the do-while loop */ + break; /* We might have reached the end of the header part here, but there might be a non-header part left in the end of the read |