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

List:       kde-commits
Subject:    KDE/kdelibs/kioslave/http
From:       Andreas Hartmetz <ahartmetz () gmail ! com>
Date:       2010-11-20 19:10:39
Message-ID: 20101120191039.F0BAEAC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1199136 by ahartmetz:

parseHeaderFromCache(): return whether the method succeeded and use
the result.


 M  +9 -7      http.cpp  
 M  +1 -1      http.h  


--- trunk/KDE/kdelibs/kioslave/http/http.cpp #1199135:1199136
@@ -2557,11 +2557,12 @@
   }
 }
 
-void HTTPProtocol::parseHeaderFromCache()
+bool HTTPProtocol::parseHeaderFromCache()
 {
     kDebug(7113);
-    // ### we're not checking the return value, but we actually should
-    cacheFileReadTextHeader2();
+    if (!cacheFileReadTextHeader2()) {
+        return false;
+    }
 
     Q_FOREACH (const QString &str, m_responseHeaders) {
         QString header = str.trimmed().toLower();
@@ -2589,6 +2590,7 @@
     kDebug(7113) << "Emitting mimeType" << m_mimeType;
     mimeType(m_mimeType);
     forwardHttpResponseHeader();
+    return true;
 }
 
 void HTTPProtocol::fixupResponseMimetype()
@@ -2696,8 +2698,8 @@
     resetResponseParsing();
     if (m_request.cacheTag.ioMode == ReadFromCache &&
         m_request.cacheTag.plan(m_maxCacheAge) == CacheTag::UseCached) {
-        parseHeaderFromCache();
-        return true;
+        // parseHeaderFromCache replaces this method in case of cached content
+        return parseHeaderFromCache();
     }
 
 try_again:
@@ -3482,8 +3484,8 @@
             kDebug(7113) << "Reading resource from cache even though the cache plan is not "
                             "UseCached; the server is probably sending wrong expiry information.";
         }
-        parseHeaderFromCache();
-        return true;
+        // parseHeaderFromCache replaces this method in case of cached content
+        return parseHeaderFromCache();
     }
 
     // Let the app know about the mime-type iff this is not
--- trunk/KDE/kdelibs/kioslave/http/http.h #1199135:1199136
@@ -338,7 +338,7 @@
   void fixupResponseContentEncoding();
 
   bool readResponseHeader();
-  void parseHeaderFromCache();
+  bool parseHeaderFromCache();
   void parseContentDisposition(const QString &disposition);
 
   bool sendBody();
[prev in list] [next in list] [prev in thread] [next in thread] 

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