Cleanup checking for the request method.
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Nov 2007 08:20:40 +0000 (08:20 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Nov 2007 08:20:40 +0000 (08:20 +0000)
* Check the request method only in QWebNetworkManager::add.
* Currently HEAD, GET, POST are allowed and for everything else
  QWebNetworkManager::add returns false.
* Returning false is compatible with ResourceHandle::start and it
  can be used in ResourceHandle::loadResourceSynchronously to generate
  a ResourceError

Signed-off-by: Lars Knoll <lars@trolltech.com>
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27594 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/network/qt/ResourceHandleQt.cpp
WebKit/qt/Api/qwebnetworkinterface.cpp
WebKit/qt/ChangeLog

index c34d92e6442794c7960a89cc71b081a8d32292dd..d52d1f928f2394652a69d1031dddc8cfb63c3546 100644 (file)
@@ -1,3 +1,23 @@
+2007-11-08  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Lars Knoll <lars@trolltech.com>.
+
+        Cleanup checking for the request method.
+        
+        * Check the request method only in QWebNetworkManager::add.
+        * Currently HEAD, GET, POST are allowed and for everything else
+        QWebNetworkManager::add returns false.
+        * Returning false is compatible with ResourceHandle::start and it
+        can be used in ResourceHandle::loadResourceSynchronously to generate
+        a ResourceError
+        
+
+        WARNING: NO TEST CASES ADDED OR CHANGED
+
+        * platform/network/qt/ResourceHandleQt.cpp:
+        (WebCore::ResourceHandle::start):
+        (WebCore::ResourceHandle::loadResourceSynchronously):
+
 2007-11-08  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
 
         Reviewed by Lars Knoll <lars@trolltech.com>.
index 792050743ad857b0f531ccb1afa7a333e7c85f53..bb1935c18a5bba8c17395ad6b71ebd7c358c8505 100644 (file)
@@ -121,12 +121,6 @@ bool ResourceHandle::start(Frame* frame)
     if (!page)
         return false;
 
-    // check for (probably) broken requests
-    if (d->m_request.httpMethod() != "GET" && d->m_request.httpMethod() != "POST") {
-        notImplemented();
-        return false;
-    }
-
     getInternal()->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
     return QWebNetworkManager::self()->add(this, getInternal()->m_frame->page()->d->networkInterface);
 }
@@ -165,14 +159,12 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, R
     WebCoreSynchronousLoader syncLoader;
     ResourceHandle handle(request, &syncLoader, true, false, true);
 
-    // check for (probably) broken requests
-    if (handle.d->m_request.httpMethod() != "GET" && handle.d->m_request.httpMethod() != "POST" && handle.d->m_request.httpMethod() != "HEAD") {
+    if (!QWebNetworkManager::self()->add(&handle, QWebNetworkInterface::defaultInterface(), QWebNetworkManager::SynchronousJob)) {
         // FIXME Create a sane ResourceError
         error = ResourceError(String(), -1, String(), String());
         return;
     }
 
-    QWebNetworkManager::self()->add(&handle, QWebNetworkInterface::defaultInterface(), QWebNetworkManager::SynchronousJob);
     syncLoader.waitForCompletion();
     error = syncLoader.resourceError();
     data = syncLoader.data();
index cf5ebe0a2471ef32c326173883bd75a473d2404f..b7771540ad1ae1521640e8d02acbda8830be0204 100644 (file)
@@ -454,10 +454,9 @@ bool QWebNetworkManager::add(ResourceHandle *handle, QWebNetworkInterface *inter
     job->d->request.init(handle->request());
 
     const QString method = handle->getInternal()->m_request.httpMethod();
-    if (method != "POST" && method != "GET") {
-        // don't know what to do! (probably a request error!!)
-        // but treat it like a 'GET' request
+    if (method != "POST" && method != "GET" && method != "HEAD") {
         qWarning("REQUEST: [%s]\n", qPrintable(job->d->request.httpHeader.toString()));
+        return false;
     }
 
     DEBUG() << "QWebNetworkManager::add:" <<  job->d->request.httpHeader.toString();
index a93edfc5e493913b521ce7b8196337d3178c763d..a37d390a545441ff7c6d1ab1184dd5ae0537a084 100644 (file)
@@ -1,3 +1,20 @@
+2007-11-08  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Lars Knoll <lars@trolltech.com>.
+
+        Cleanup checking for the request method.
+        
+        * Check the request method only in QWebNetworkManager::add.
+        * Currently HEAD, GET, POST are allowed and for everything else
+        QWebNetworkManager::add returns false.
+        * Returning false is compatible with ResourceHandle::start and it
+        can be used in ResourceHandle::loadResourceSynchronously to generate
+        a ResourceError
+        
+
+        * Api/qwebnetworkinterface.cpp:
+        (QWebNetworkManager::add):
+
 2007-11-08  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
 
         Reviewed by Lars Knoll <lars@trolltech.com>.