Browse Source

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.
David Kalnischkies 10 years ago
parent
commit
99968cf75b
1 changed files with 4 additions and 4 deletions
  1. 4 4
      methods/http.cc

+ 4 - 4
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