Changeset 51411 in webkit


Ignore:
Timestamp:
Nov 26, 2009 3:16:23 AM (14 years ago)
Author:
zecke@webkit.org
Message:

[Qt] Use QNetworkReply::rawHeaderPairs

https://bugs.webkit.org/show_bug.cgi?id=31826

The QNetworkReply is internally storing the HTTP headers
as a list of pairs. Currently we have to ask the QNetworkReply
to put all header names into a QStringList. Afterwards we will
iterate over this QStringList and ask the QNetworkReply to
give us the value for this header name. The current Qt implementation
is doing a linear to find the header value.

Use a new API to directly access the list of pairs and push
this into WebCore. This avoids doing some allocations and doing
linear searches from within a loop.

  • platform/network/qt/QNetworkReplyHandler.cpp:

(WebCore::QNetworkReplyHandler::sendResponseIfNeeded):

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51410 r51411  
     12009-11-24  Holger Hans Peter Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        [Qt] Use QNetworkReply::rawHeaderPairs
     6        https://bugs.webkit.org/show_bug.cgi?id=31826
     7
     8        The QNetworkReply is internally storing the HTTP headers
     9        as a list of pairs. Currently we have to ask the QNetworkReply
     10        to put all header names into a QStringList. Afterwards we will
     11        iterate over this QStringList and ask the QNetworkReply to
     12        give us the value for this header name. The current Qt implementation
     13        is doing a linear to find the header value.
     14
     15        Use a new API to directly access the list of pairs and push
     16        this into WebCore. This avoids doing some allocations and doing
     17        linear searches from within a loop.
     18
     19        * platform/network/qt/QNetworkReplyHandler.cpp:
     20        (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
     21
    1222009-11-21  Holger Hans Peter Freyther  <zecke@selfish.org>
    223
  • trunk/WebCore/platform/network/qt/QNetworkReplyHandler.cpp

    r51387 r51411  
    308308
    309309        // Add remaining headers.
     310#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
     311        foreach (const QNetworkReply::RawHeaderPair& pair, m_reply->rawHeaderPairs()) {
     312            response.setHTTPHeaderField(QString::fromAscii(pair.first), QString::fromAscii(pair.second));
     313        }
     314#else
    310315        foreach (const QByteArray& headerName, m_reply->rawHeaderList()) {
    311316            response.setHTTPHeaderField(QString::fromAscii(headerName), QString::fromAscii(m_reply->rawHeader(headerName)));
    312317        }
     318#endif
    313319    }
    314320
Note: See TracChangeset for help on using the changeset viewer.