From 439626ffafae7d0480e66a6795df647fd32bbc64 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 11 Feb 2010 13:47:19 +0100 Subject: QNAM HTTP: Optimize detectPipeliningSupport() Do cheap checks first. Reviewed-by: TrustMe --- src/network/access/qhttpnetworkconnectionchannel.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 64969b0..b0e632a 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -610,19 +610,19 @@ void QHttpNetworkConnectionChannel::allDone() void QHttpNetworkConnectionChannel::detectPipeliningSupport() { // detect HTTP Pipelining support - QByteArray serverHeaderField = reply->headerField("Server"); + QByteArray serverHeaderField; if ( - // check for broken servers in server reply header - // this is adapted from http://mxr.mozilla.org/firefox/ident?i=SupportsPipelining - (!serverHeaderField.contains("Microsoft-IIS/4.")) - && (!serverHeaderField.contains("Microsoft-IIS/5.")) - && (!serverHeaderField.contains("Netscape-Enterprise/3.")) // check for HTTP/1.1 - && (reply->d_func()->majorVersion == 1 && reply->d_func()->minorVersion == 1) + (reply->d_func()->majorVersion == 1 && reply->d_func()->minorVersion == 1) // check for not having connection close && (!reply->d_func()->isConnectionCloseEnabled()) // check if it is still connected && (socket->state() == QAbstractSocket::ConnectedState) + // check for broken servers in server reply header + // this is adapted from http://mxr.mozilla.org/firefox/ident?i=SupportsPipelining + && (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4.")) + && (!serverHeaderField.contains("Microsoft-IIS/5.")) + && (!serverHeaderField.contains("Netscape-Enterprise/3.")) ) { pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningProbablySupported; } else { -- cgit v0.12