From d2b2511f88d3cf0b3db65c1bb5836e08e50636ab Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 17 Jan 2018 15:22:56 +0300 Subject: QNAM should prepend Host header to the header list instead of appending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When original QNetworkRequest is missing "Host" header (which is the most common case), it is provided automatically from request URL. However, resulting header is appended to the list, i.e. after all headers specified by user, which may include a big bunch of cookies. To the contrary, RFC 7230 suggests: "However, it is good practice to send header fields that contain control data first, such as Host on requests and Date on responses, so that implementations can decide when not to handle a message as early as possible". Many other user agents are following this suggestion. Task-number: QTBUG-51557 Change-Id: I1448ed3ae124f5ce86a8ca8ff35f5d05476a005d Reviewed-by: Thiago Macieira Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/access/qhttpnetworkheader_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/network/access/qhttpnetworkheader_p.h') diff --git a/src/network/access/qhttpnetworkheader_p.h b/src/network/access/qhttpnetworkheader_p.h index 46aec1dd8c..506486a52b 100644 --- a/src/network/access/qhttpnetworkheader_p.h +++ b/src/network/access/qhttpnetworkheader_p.h @@ -92,6 +92,7 @@ public: QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const; QList headerFieldValues(const QByteArray &name) const; void setHeaderField(const QByteArray &name, const QByteArray &data); + void prependHeaderField(const QByteArray &name, const QByteArray &data); bool operator==(const QHttpNetworkHeaderPrivate &other) const; }; -- cgit v1.2.3