From 99968cf75b46210bded1662d34c4c2b0ef07be04 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Jun 2016 12:45:07 +0200 Subject: [PATCH] http: don't hang on redirect with length + connection close Most servers who close the connection do not send a content-length as this is redundant information usually, but some might and while testing with our server and with 'aptwebserver::response-header::Connection' set to 'close' I noticed that http hangs after a redirect in such cases, so if we have the information, just use it instead of discarding it. --- methods/http.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/methods/http.cc b/methods/http.cc index b861e61ee..fc54ece3a 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -441,12 +441,12 @@ bool HttpServerState::RunData(FileFd * const File) { /* Closes encoding is used when the server did not specify a size, the loss of the connection means we are done */ - if (Persistent == false) - In.Limit(-1); - else if (JunkSize != 0) + if (JunkSize != 0) In.Limit(JunkSize); - else + else if (DownloadSize != 0) In.Limit(DownloadSize); + else if (Persistent == false) + In.Limit(-1); // Just transfer the whole block. do -- 2.45.2