Changeset 69946 in webkit


Ignore:
Timestamp:
Oct 18, 2010 1:15:25 AM (14 years ago)
Author:
andreas.kling@nokia.com
Message:

2010-10-17 Andreas Kling <kling@webkit.org>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Support custom open() verbs/methods in XMLHttpRequest
https://bugs.webkit.org/show_bug.cgi?id=40476

Fall back to QNetworkAccessManager::CustomOperation for any HTTP verb
that's not specifically supported by QNetworkAccessManager.

This prevents the infinite loop that otherwise occurs after sending
an UnknownOperation request.

This change is covered by existing (skipped) tests that will be
unskipped once the Qt bots are running Qt 4.7.

  • platform/network/qt/QNetworkReplyHandler.cpp: (WebCore::QNetworkReplyHandler::httpMethod): (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
  • platform/network/qt/QNetworkReplyHandler.h:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r69938 r69946  
     12010-10-17  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Support custom open() verbs/methods in XMLHttpRequest
     6        https://bugs.webkit.org/show_bug.cgi?id=40476
     7
     8        Fall back to QNetworkAccessManager::CustomOperation for any HTTP verb
     9        that's not specifically supported by QNetworkAccessManager.
     10
     11        This prevents the infinite loop that otherwise occurs after sending
     12        an UnknownOperation request.
     13
     14        This change is covered by existing (skipped) tests that will be
     15        unskipped once the Qt bots are running Qt 4.7.
     16
     17        * platform/network/qt/QNetworkReplyHandler.cpp:
     18        (WebCore::QNetworkReplyHandler::httpMethod):
     19        (WebCore::QNetworkReplyHandler::QNetworkReplyHandler):
     20        (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
     21        * platform/network/qt/QNetworkReplyHandler.h:
     22
    1232010-10-17  Adam Barth  <abarth@webkit.org>
    224
  • trunk/WebCore/platform/network/qt/QNetworkReplyHandler.cpp

    r69064 r69946  
    156156}
    157157
    158 static QString httpMethodString(QNetworkAccessManager::Operation method)
    159 {
    160     switch (method) {
     158String QNetworkReplyHandler::httpMethod() const
     159{
     160    switch (m_method) {
    161161    case QNetworkAccessManager::GetOperation:
    162162        return "GET";
     
    167167    case QNetworkAccessManager::PutOperation:
    168168        return "PUT";
    169 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
    170169    case QNetworkAccessManager::DeleteOperation:
    171170        return "DELETE";
    172 #endif
    173171#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
    174172    case QNetworkAccessManager::CustomOperation:
    175         return "OPTIONS";
     173        return m_resourceHandle->firstRequest().httpMethod();
    176174#endif
    177175    default:
     176        ASSERT_NOT_REACHED();
    178177        return "GET";
    179178    }
     
    207206        m_method = QNetworkAccessManager::DeleteOperation;
    208207#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
    209     else if (r.httpMethod() == "OPTIONS")
     208    else
    210209        m_method = QNetworkAccessManager::CustomOperation;
    211 #endif
     210#else
    212211    else
    213212        m_method = QNetworkAccessManager::UnknownOperation;
     213#endif
    214214
    215215    QObject* originatingObject = 0;
     
    411411
    412412        ResourceRequest newRequest = m_resourceHandle->firstRequest();
    413         newRequest.setHTTPMethod(httpMethodString(m_method));
     413        newRequest.setHTTPMethod(httpMethod());
    414414        newRequest.setURL(newUrl);
    415415
  • trunk/WebCore/platform/network/qt/QNetworkReplyHandler.h

    r69064 r69946  
    6868    void start();
    6969    void resetState();
     70    String httpMethod() const;
    7071
    7172    QNetworkReply* m_reply;
Note: See TracChangeset for help on using the changeset viewer.