src/network/access/qhttpnetworkreply.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 25 e24348a560a6
--- a/src/network/access/qhttpnetworkreply.cpp	Fri Apr 16 15:50:13 2010 +0300
+++ b/src/network/access/qhttpnetworkreply.cpp	Mon May 03 13:17:34 2010 +0300
@@ -219,7 +219,7 @@
 {
 }
 
-void QHttpNetworkReplyPrivate::clear()
+void QHttpNetworkReplyPrivate::clearHttpLayerInformation()
 {
     state = NothingDoneState;
     statusCode = 100;
@@ -229,16 +229,22 @@
     currentChunkSize = 0;
     currentChunkRead = 0;
     connectionCloseEnabled = true;
-    connection = 0;
-    connectionChannel = 0;
 #ifndef QT_NO_COMPRESS
     if (initInflate)
         inflateEnd(&inflateStrm);
 #endif
     initInflate = false;
     streamEnd = false;
+    fields.clear();
+}
+
+// TODO: Isn't everything HTTP layer related? We don't need to set connection and connectionChannel to 0 at all
+void QHttpNetworkReplyPrivate::clear()
+{
+    connection = 0;
+    connectionChannel = 0;
     autoDecompress = false;
-    fields.clear();
+    clearHttpLayerInformation();
 }
 
 // QHttpNetworkReplyPrivate
@@ -539,6 +545,11 @@
                     || fragment.endsWith("\r\n\n")
                     || fragment.endsWith("\n\n"))
                     allHeaders = true;
+
+                // there is another case: We have no headers. Then the fragment equals just the line ending
+                if ((fragment.length() == 2 && fragment.endsWith("\r\n"))
+                    || (fragment.length() == 1 && fragment.endsWith("\n")))
+                    allHeaders = true;
             }
         }
     } while (!allHeaders && haveRead > 0);