[libcalamares] Avoid deprecation warning in network attributes

This commit is contained in:
Adriaan de Groot 2021-06-15 11:45:29 +02:00
parent f0a25bd397
commit 6ee0da41c8

View File

@ -27,10 +27,16 @@ namespace Network
void
RequestOptions::applyToRequest( QNetworkRequest* request ) const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
constexpr const auto RedirectPolicyAttribute = QNetworkRequest::FollowRedirectsAttribute;
#else
constexpr const auto RedirectPolicyAttribute = QNetworkRequest::RedirectPolicyAttribute;
#endif
if ( m_flags & Flag::FollowRedirect )
{
// Follows all redirects except unsafe ones (https to http).
request->setAttribute( QNetworkRequest::FollowRedirectsAttribute, true );
request->setAttribute( RedirectPolicyAttribute, true );
}
if ( m_flags & Flag::FakeUserAgent )