Remove unnecessary case-insensitive header name comparisons
HTTP header name fields are case-insensitive and the QHttpHeaders class stores them as lower-case. Therefore the case-insensitive comparisons, when comparing against a lower-case value, are not needed. Pick-to: 6.7 Change-Id: I7f38ef16aa7c61103abc4c81c13aebdd6e535dc8 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
60f471f4b6
commit
7288db6083
@ -73,12 +73,10 @@ HPack::HttpHeader build_headers(const QHttpNetworkRequest &request, quint32 maxH
|
|||||||
if (size.second > maxHeaderListSize)
|
if (size.second > maxHeaderListSize)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (name.compare("connection", Qt::CaseInsensitive) == 0 ||
|
if (name == "connection"_L1 || name == "host"_L1 || name == "keep-alive"_L1
|
||||||
name.compare("host", Qt::CaseInsensitive) == 0 ||
|
|| name == "proxy-connection"_L1 || name == "transfer-encoding"_L1) {
|
||||||
name.compare("keep-alive", Qt::CaseInsensitive) == 0 ||
|
|
||||||
name.compare("proxy-connection", Qt::CaseInsensitive) == 0 ||
|
|
||||||
name.compare("transfer-encoding", Qt::CaseInsensitive) == 0)
|
|
||||||
continue; // Those headers are not valid (section 3.2.1) - from QSpdyProtocolHandler
|
continue; // Those headers are not valid (section 3.2.1) - from QSpdyProtocolHandler
|
||||||
|
}
|
||||||
// TODO: verify with specs, which fields are valid to send ....
|
// TODO: verify with specs, which fields are valid to send ....
|
||||||
//
|
//
|
||||||
// Note: RFC 7450 8.1.2 (HTTP/2) states that header field names must be lower-cased
|
// Note: RFC 7450 8.1.2 (HTTP/2) states that header field names must be lower-cased
|
||||||
|
@ -1373,12 +1373,10 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QHttpHeaders &hm,
|
|||||||
// Reset any previous "location" header set in the reply. In case of
|
// Reset any previous "location" header set in the reply. In case of
|
||||||
// redirects, we don't want to 'append' multiple location header values,
|
// redirects, we don't want to 'append' multiple location header values,
|
||||||
// rather we keep only the latest one
|
// rather we keep only the latest one
|
||||||
if (key.compare(locationHeader(), Qt::CaseInsensitive) == 0)
|
if (key == locationHeader())
|
||||||
value.clear();
|
value.clear();
|
||||||
|
|
||||||
if (shouldDecompress && !decompressHelper.isValid()
|
if (shouldDecompress && !decompressHelper.isValid() && key == "content-encoding"_L1) {
|
||||||
&& key.compare("content-encoding", Qt::CaseInsensitive) == 0) {
|
|
||||||
|
|
||||||
if (!synchronous) // with synchronous all the data is expected to be handled at once
|
if (!synchronous) // with synchronous all the data is expected to be handled at once
|
||||||
decompressHelper.setCountingBytesEnabled(true);
|
decompressHelper.setCountingBytesEnabled(true);
|
||||||
|
|
||||||
@ -1395,7 +1393,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QHttpHeaders &hm,
|
|||||||
if (!value.isEmpty()) {
|
if (!value.isEmpty()) {
|
||||||
// Why are we appending values for headers which are already
|
// Why are we appending values for headers which are already
|
||||||
// present?
|
// present?
|
||||||
if (key.compare("set-cookie", Qt::CaseInsensitive) == 0)
|
if (key == "set-cookie"_L1)
|
||||||
value += '\n';
|
value += '\n';
|
||||||
else
|
else
|
||||||
value += ", ";
|
value += ", ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user