Review Request 113366: kio_http: small optimization in response code parsing

Albert Astals Cid aacid at kde.org
Mon Oct 21 16:56:21 BST 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/113366/#review42111
-----------------------------------------------------------


+1 from me, but i'd like someone else to approve, adding a git diff -b diff that makes it much easier to read

diff --git a/kioslave/http/http.cpp b/kioslave/http/http.cpp
index 81182eb..0826fa7 100644
--- a/kioslave/http/http.cpp
+++ b/kioslave/http/http.cpp
@@ -3052,11 +3052,9 @@ try_again:
 
     if (m_request.responseCode != 200 && m_request.responseCode != 304) {
         m_request.cacheTag.ioMode = NoCache;
-    }
 
         if (m_request.responseCode >= 500 && m_request.responseCode <= 599) {
             // Server side errors
-
             if (m_request.method == HTTP_HEAD) {
                 ; // Ignore error
             } else {
@@ -3072,7 +3070,7 @@ try_again:
         } else if (m_request.responseCode == 426) {
             // Upgrade Required
             upgradeRequired = true;
-    } else if (!isAuthenticationRequired(m_request.responseCode) && m_request.responseCode >= 400 && m_request.responseCode <= 499) {
+        } else if (m_request.responseCode >= 400 && m_request.responseCode <= 499 && !isAuthenticationRequired(m_request.responseCode)) {
             // Any other client errors
             // Tell that we will only get an error page here.
             if (!sendErrorPageNotification()) {
@@ -3125,6 +3123,7 @@ try_again:
             // We got 'Continue' - ignore it
             cont = true;
         }
+    } // (m_request.responseCode != 200 && m_request.responseCode != 304)
 
 endParsing:
     bool authRequiresAnotherRoundtrip = false;


- Albert Astals Cid


On Oct. 21, 2013, 3:23 p.m., Andrea Iacovitti wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/113366/
> -----------------------------------------------------------
> 
> (Updated Oct. 21, 2013, 3:23 p.m.)
> 
> 
> Review request for kdelibs and Dawit Alemayehu.
> 
> 
> Repository: kdelibs
> 
> 
> Description
> -------
> 
> Execute the long "if...else if..." only if the previous condition "if (m_request.responseCode != 200 && m_request.responseCode != 304)" is verified.
> If it fails (that is responseCode == 200 or responseCode == 304) none of the nine conditions in the subsequent if..else if.. can be true.
> 
> 
> Diffs
> -----
> 
>   kioslave/http/http.cpp 81182eb 
> 
> Diff: http://git.reviewboard.kde.org/r/113366/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Andrea Iacovitti
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20131021/c87084be/attachment.htm>


More information about the kde-core-devel mailing list