Moved the postData setup into QWebNetworkRequest::init.
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jun 2007 13:49:24 +0000 (13:49 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jun 2007 13:49:24 +0000 (13:49 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@22093 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitQt/Api/qwebnetworkinterface.cpp
WebKitQt/ChangeLog

index a30ebcc4baa8515b3a4dc913cbed25fbc1dbe918..41450882d833fc56ab405153a983bdec4fd3623a 100644 (file)
@@ -72,10 +72,18 @@ void QWebNetworkRequest::init(const QString &method, const QUrl &url, const WebC
                 request.setValue(QLatin1String("Cookie"), cookies);
         }
 
+
         const HTTPHeaderMap& loaderHeaders = resourceRequest->httpHeaderFields();
         HTTPHeaderMap::const_iterator end = loaderHeaders.end();
         for (HTTPHeaderMap::const_iterator it = loaderHeaders.begin(); it != end; ++it)
             request.setValue(it->first, it->second);
+
+        // handle and perform a 'POST' request
+        if (method == "POST") {
+            DeprecatedString pd = resourceRequest->httpBody()->flattenToString().deprecatedString();
+            postData = QByteArray(pd.ascii(), pd.length());
+            request.setValue(QLatin1String("content-length"), QString::number(postData.size()));
+        }
     }
 }
 
@@ -241,14 +249,8 @@ bool QWebNetworkManager::add(ResourceHandle *handle, QWebNetworkInterface *inter
     QUrl qurl = QString(url.url());
     job->d->init(handle->method(), qurl, &handle->request());
 
-    int id;
-    // handle and perform a 'POST' request
-    if (handle->method() == "POST") {
-        DeprecatedString pd = handle->postData()->flattenToString().deprecatedString();
-        job->d->postData = QByteArray(pd.ascii(), pd.length());
-        job->d->request.setValue(QLatin1String("content-length"), QString::number(job->d->postData.size()));
-    } else if (handle->method() != "GET") {
-        // or.. don't know what to do! (probably a request error!!)
+    if (handle->method() != "POST" && handle->method() != "GET") {
+        // don't know what to do! (probably a request error!!)
         // but treat it like a 'GET' request
         qWarning("REQUEST: [%s]\n", qPrintable(job->d->request.toString()));
     }
index b56fe16eeef83ae802a30a4e4134872396e1c8ab..bd497449e4d26224474b624e59a473888cacf121 100644 (file)
@@ -1,3 +1,13 @@
+2007-06-11  Simon Hausmann  <hausmann@kde.org>
+
+        Reviewed by Lars.
+
+        Moved the postData setup into QWebNetworkRequest::init.
+
+        * Api/qwebnetworkinterface.cpp:
+        (QWebNetworkRequest::init):
+        (QWebNetworkManager::add):
+
 2007-06-11  Simon Hausmann  <hausmann@kde.org>
 
         Reviewed by Lars.