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

List:       kde-commits
Subject:    =?utf-8?q?=5Bkdelibs=5D_kioslave/http=3A_Retry_the_request_if_se?=
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2011-03-04 17:23:52
Message-ID: 20110304172352.6C8C5A60C9 () git ! kde ! org
[Download RAW message or body]

Git commit 8230f1f5f3115fdf28fe646986c410504188e117 by Dawit Alemayehu.
Committed on 04/03/2011 at 18:23.
Pushed by adawit into branch 'master'.

Retry the request if server disconnected before the content body could be sent to it.

This is the same protection as the one in ::sendQuery and protects against crashes \
like the one that prints out the following:

kio_http(3980)/kio (kioslave): Got cmd  77  while waiting for an answer!
kioslave: ####### CRASH ###### protocol = https pid = 3980 signal = 6

M  +8    -0    kioslave/http/http.cpp     

http://commits.kde.org/kdelibs/8230f1f5f3115fdf28fe646986c410504188e117

diff --git a/kioslave/http/http.cpp b/kioslave/http/http.cpp
index 9baea1a..db07af6 100644
--- a/kioslave/http/http.cpp
+++ b/kioslave/http/http.cpp
@@ -3879,6 +3879,14 @@ bool HTTPProtocol::sendBody()
   // Send the content length...
   bool sendOk = (write(cLength.data(), cLength.size()) == (ssize_t) cLength.size());
   if (!sendOk) {
+    // The server might have closed the connection due to a timeout, or maybe
+    // some transport problem arose while the connection was idle.
+    if (m_request.isKeepAlive)
+    {
+      httpCloseConnection();
+      return true; // Try again
+    }
+
     kDebug(7113) << "Connection broken while sending POST content size to" << \
m_request.url.host();  error( ERR_CONNECTION_BROKEN, m_request.url.host() );
     return false;


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

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