bug 423506 - 0 byte responses causing save-as dialogues r=bz
authorPatrick McManus <mcmanus@ducksong.com>
Sat, 03 Sep 2011 08:42:06 -0400
changeset 77826 1915c4f1eed6a44fbbb641214d6f365445e036b4
parent 77825 fff3dc9478ce0743eb8135d11b135bf6a8b4d37f
child 77827 b3fa7b442186068a6df6fc232ab90b6cd325de1f
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs423506
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 423506 - 0 byte responses causing save-as dialogues r=bz
netwerk/protocol/http/nsHttpTransaction.cpp
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -644,23 +644,27 @@ nsHttpTransaction::Close(nsresult reason
         }
     }
 
     PRBool relConn = PR_TRUE;
     if (NS_SUCCEEDED(reason)) {
         // the server has not sent the final \r\n terminating the header
         // section, and there may still be a header line unparsed.  let's make
         // sure we parse the remaining header line, and then hopefully, the
-        // response will be usable (see bug 88792).  related to that, we may
-        // also have an empty response containing no headers.  we should treat
-        // that as an empty HTTP/0.9 response (see bug 300613).
+        // response will be usable (see bug 88792).
         if (!mHaveAllHeaders) {
             char data = '\n';
             PRUint32 unused;
             ParseHead(&data, 1, &unused);
+
+            if (mResponseHead->Version() == NS_HTTP_VERSION_0_9) {
+                // Reject 0 byte HTTP/0.9 Responses - bug 423506
+                LOG(("nsHttpTransaction::Close %p 0 Byte 0.9 Response", this));
+                reason = NS_ERROR_NET_RESET;
+            }
         }
 
         // honor the sticky connection flag...
         if (mCaps & NS_HTTP_STICKY_CONNECTION)
             relConn = PR_FALSE;
     }
     if (relConn && mConnection)
         NS_RELEASE(mConnection);