From 259a167beb094929b3b26c8072b970f3903ef65d Mon Sep 17 00:00:00 2001 From: MÃ¥rten Nordheim Date: Mon, 22 Mar 2021 11:02:52 +0100 Subject: HTTP/2 authentication required With Qt 6 we made HTTP/2 default, which exposed missing handling of 401 Unauthorized (and 407 Proxy Authentication Required). In HTTP/1.* we would handle this after the response had finished, while handling the status code. For h2 this path isn't used since it is heavily reliant on the structure we have for HTTP/1.* (one request per channel). So we must handle the status code and header directly. Having that part fixed exposed another issue - when resetting/rewinding uploaded data we were not resetting the 'totallyUploadedData' counter in the reply (this, in turn, exposed another small issue). Because of that we did not actually send any data on the retry, only sending the content-length followed by no data. Finally, the small issue mentioned in the previous paragraph was how we check if we have uploaded all our data. It was only checking if the byte-device was atEnd(), which it was. But only because it had not yet prepared any data for us. Fixes: QTBUG-91284 Change-Id: I798d105b02688b18a02897cc476f19f57a47f98f Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne (cherry picked from commit 52a0eb4791727157a7b385f7e022faad28da4821) --- src/network/access/qhttpnetworkrequest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/network/access/qhttpnetworkrequest.cpp') diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index a410f8acb1..8dd8cbe92c 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -65,6 +65,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest withCredentials(other.withCredentials), ssl(other.ssl), preConnect(other.preConnect), + needResendWithCredentials(other.needResendWithCredentials), redirectCount(other.redirectCount), redirectPolicy(other.redirectPolicy), peerVerifyName(other.peerVerifyName) @@ -92,7 +93,8 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot && (ssl == other.ssl) && (preConnect == other.preConnect) && (redirectPolicy == other.redirectPolicy) - && (peerVerifyName == other.peerVerifyName); + && (peerVerifyName == other.peerVerifyName) + && (needResendWithCredentials == other.needResendWithCredentials); } QByteArray QHttpNetworkRequest::methodName() const -- cgit v1.2.3-59-g8ed1b