diff options
author | Mate Barany <mate.barany@qt.io> | 2024-02-20 14:55:08 +0100 |
---|---|---|
committer | Mate Barany <mate.barany@qt.io> | 2024-03-01 23:57:13 +0100 |
commit | 6d08db86660139176df653b02d4168c9372c750e (patch) | |
tree | d6ee578daa5bf7abbd75d58eae4f02d4318164b8 /src/network | |
parent | c89b1bbddc73b044762cabc67c1e5063a6ffee86 (diff) |
Handle informational HTTP replies (1xx) for HTTP/2
Make QHttp2ProtocolHandler discard all informational (1xx) replies with
the exception of 101.
According to RFC 9110:
"A client MUST be able to parse one or more 1xx responses received
prior to a final response, even if the client does not expect one.
A user agent MAY ignore unexpected 1xx responses."
Fixes: QTBUG-121755
Change-Id: I8b8d578f23d4fbe28929f8c54b3607bcaf85405f
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttp2protocolhandler.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index 251d17b0b4..d25be851bf 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -1101,6 +1101,13 @@ void QHttp2ProtocolHandler::updateStream(Stream &stream, const HPack::HttpHeader } } + // Discard all informational (1xx) replies with the exception of 101. + // Also see RFC 9110 (Chapter 15.2) + if (statusCode == 100 || (102 <= statusCode && statusCode <= 199)) { + httpReplyPrivate->clearHttpLayerInformation(); + return; + } + if (QHttpNetworkReply::isHttpRedirect(statusCode) && httpRequest.isFollowRedirects()) { QHttpNetworkConnectionPrivate::ParseRedirectResult result = m_connection->d_func()->parseRedirectResponse(httpReply); |