src/network/access/qhttpnetworkreply.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 25 e24348a560a6
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
   217 
   217 
   218 QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate()
   218 QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate()
   219 {
   219 {
   220 }
   220 }
   221 
   221 
   222 void QHttpNetworkReplyPrivate::clear()
   222 void QHttpNetworkReplyPrivate::clearHttpLayerInformation()
   223 {
   223 {
   224     state = NothingDoneState;
   224     state = NothingDoneState;
   225     statusCode = 100;
   225     statusCode = 100;
   226     bodyLength = 0;
   226     bodyLength = 0;
   227     contentRead = 0;
   227     contentRead = 0;
   228     totalProgress = 0;
   228     totalProgress = 0;
   229     currentChunkSize = 0;
   229     currentChunkSize = 0;
   230     currentChunkRead = 0;
   230     currentChunkRead = 0;
   231     connectionCloseEnabled = true;
   231     connectionCloseEnabled = true;
   232     connection = 0;
       
   233     connectionChannel = 0;
       
   234 #ifndef QT_NO_COMPRESS
   232 #ifndef QT_NO_COMPRESS
   235     if (initInflate)
   233     if (initInflate)
   236         inflateEnd(&inflateStrm);
   234         inflateEnd(&inflateStrm);
   237 #endif
   235 #endif
   238     initInflate = false;
   236     initInflate = false;
   239     streamEnd = false;
   237     streamEnd = false;
       
   238     fields.clear();
       
   239 }
       
   240 
       
   241 // TODO: Isn't everything HTTP layer related? We don't need to set connection and connectionChannel to 0 at all
       
   242 void QHttpNetworkReplyPrivate::clear()
       
   243 {
       
   244     connection = 0;
       
   245     connectionChannel = 0;
   240     autoDecompress = false;
   246     autoDecompress = false;
   241     fields.clear();
   247     clearHttpLayerInformation();
   242 }
   248 }
   243 
   249 
   244 // QHttpNetworkReplyPrivate
   250 // QHttpNetworkReplyPrivate
   245 qint64 QHttpNetworkReplyPrivate::bytesAvailable() const
   251 qint64 QHttpNetworkReplyPrivate::bytesAvailable() const
   246 {
   252 {
   536                 // the header endings will be marked by CRLFCRLF. But
   542                 // the header endings will be marked by CRLFCRLF. But
   537                 // we will allow CRLFCRLF, CRLFLF, LFLF
   543                 // we will allow CRLFCRLF, CRLFLF, LFLF
   538                 if (fragment.endsWith("\r\n\r\n")
   544                 if (fragment.endsWith("\r\n\r\n")
   539                     || fragment.endsWith("\r\n\n")
   545                     || fragment.endsWith("\r\n\n")
   540                     || fragment.endsWith("\n\n"))
   546                     || fragment.endsWith("\n\n"))
       
   547                     allHeaders = true;
       
   548 
       
   549                 // there is another case: We have no headers. Then the fragment equals just the line ending
       
   550                 if ((fragment.length() == 2 && fragment.endsWith("\r\n"))
       
   551                     || (fragment.length() == 1 && fragment.endsWith("\n")))
   541                     allHeaders = true;
   552                     allHeaders = true;
   542             }
   553             }
   543         }
   554         }
   544     } while (!allHeaders && haveRead > 0);
   555     } while (!allHeaders && haveRead > 0);
   545 
   556