Call start() even when bearer is not compiled.
authorXizhi Zhu <xizhi.zhu@gmail.com>
Wed, 1 Feb 2012 21:26:36 +0000 (22:26 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 2 Feb 2012 13:18:36 +0000 (14:18 +0100)
Otherwise, the HTTP request won't be sent if bearer is not compiled.

Change-Id: I9a8171fde6fe5b2db0405b4af6e1d52ac4528502
Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
src/network/access/qnetworkreplyhttpimpl.cpp

index c7e2995..71bc03e 100644 (file)
@@ -1499,10 +1499,11 @@ bool QNetworkReplyHttpImplPrivate::start()
 {
 #ifndef QT_NO_BEARERMANAGEMENT
     if (!managerPrivate->networkSession) {
+#endif
         postRequest();
         return true;
+#ifndef QT_NO_BEARERMANAGEMENT
     }
-#endif
 
     // This is not ideal.
     const QString host = url.host();
@@ -1513,15 +1514,14 @@ bool QNetworkReplyHttpImplPrivate::start()
         return true;
     }
 
-#ifndef QT_NO_BEARERMANAGEMENT
     if (managerPrivate->networkSession->isOpen() &&
         managerPrivate->networkSession->state() == QNetworkSession::Connected) {
         postRequest();
         return true;
     }
-#endif
 
     return false;
+#endif
 }
 
 void QNetworkReplyHttpImplPrivate::_q_startOperation()
@@ -1533,13 +1533,12 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
     }
     state = Working;
 
+    if (!start()) {
 #ifndef QT_NO_BEARERMANAGEMENT
-    if (!start()) { // ### we should call that method even if bearer is not used
         // backend failed to start because the session state is not Connected.
         // QNetworkAccessManager will call reply->backend->start() again for us when the session
         // state changes.
         state = WaitingForSession;
-
         QNetworkSession *session = managerPrivate->networkSession.data();
 
         if (session) {
@@ -1553,10 +1552,9 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
         } else {
             qWarning("Backend is waiting for QNetworkSession to connect, but there is none!");
         }
-
+#endif
         return;
     }
-#endif
 
     if (synchronous) {
         state = Finished;