From fcc64a57cf6995046be83e93cb1c466b27f51917 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 3 May 2022 11:27:20 +0200 Subject: Fix documentation for QNetworkReply::redirected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In d12afeff4097dd78f1311511e0c8f74e1a810d47, the default redirect policy was changed to NoLessSafeRedirectPolicy (from ManualRedirectPolicy), and this was reworded from: This signal is emitted if the QNetworkRequest::FollowRedirectsAttribute was set in the request [...] (i.e.: Qt handles redirect, no manual handling) to: This signal is emitted if the QNetworkRequest::ManualRedirectPolicy was set in the request [...] (i.e.: User handles redirect, no handling by Qt), which is exactly the wrong way around. Only if Qt handles the redirect, it's able to send a signal about it. If the user handles redirects, they would get the RedirectionTargetAttribute in response to the finished() signal. Also see tst_QNetworkReply::ioHttpSingleRedirect(): It sets NoLessSafeRedirectPolicy (default since Qt 6) and then ensures the "redirected" signal has been emitted. Pick-to: 6.3 6.2 Change-Id: I7e80ff69b94a4d94eb541b1021b05601d183c733 Reviewed-by: MÃ¥rten Nordheim --- src/network/access/qnetworkrequest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/network/access/qnetworkrequest.cpp') diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 3d89453cdba..096f37c2a7c 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -174,10 +174,10 @@ QT_IMPL_METATYPE_EXTERN_TAGGED(QNetworkRequest::RedirectPolicy, QNetworkRequest_ Replies only, type: QMetaType::QUrl (no default) If present, it indicates that the server is redirecting the request to a different URL. The Network Access API does follow - redirections by default, but if - QNetworkRequest::ManualRedirectPolicy is enabled and - the redirect was not handled in redirected() then this - attribute will be present. + redirections by default, unless + QNetworkRequest::ManualRedirectPolicy is used. Additionally, if + QNetworkRequest::UserVerifiedRedirectPolicy is used, then this + attribute will be set if the redirect was not followed. The returned URL might be relative. Use QUrl::resolved() to create an absolute URL out of it. -- cgit v1.2.3