[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kioslave/http
From:       Maks Orlovich <maksim () kde ! org>
Date:       2009-02-16 14:51:40
Message-ID: 1234795900.177982.20566.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 927004 by orlovich:

Merged revision 926999:
Make sure we don't do any extra blocking reads if we still have buffered data to process; 
fixes freezes on websites with extremely small reply headers, like abclinuxu.cz

BUG:180631

 M  +6 -0      http.cpp  


--- trunk/KDE/kdelibs/kioslave/http/http.cpp #927003:927004
@@ -1861,6 +1861,8 @@
     m_unreadBuf.clear();
 }
 
+// Note: the implementation of unread/readBuffered assumes that unread will only
+// be used when there is extra data we don't want to handle, and not to wait for more data.
 void HTTPProtocol::unread(char *buf, size_t size)
 {
     // implement LIFO (stack) semantics
@@ -1886,6 +1888,10 @@
             buf[i] = m_unreadBuf.constData()[bufSize - i - 1];
         }
         m_unreadBuf.truncate(bufSize - bytesRead);
+
+        // if we have an unread buffer, return here, since we may already have enough data to
+        // complete the response, so we don't want to wait for more.
+        return bytesRead;
     }
     if (bytesRead < size) {
         int rawRead = TCPSlaveBase::read(buf + bytesRead, size - bytesRead);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic