From 59466abc080419465606240a02d333aac9b712ce Mon Sep 17 00:00:00 2001 From: Cajus Pollmeier Date: Fri, 31 Mar 2023 14:26:09 +0200 Subject: [PATCH] Fix default "credential" flag for WASM HTTP connections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some cases, you might want to set the "credentials" flag for HTTP requests. But you can't use it everywhere, because it may break the use of public APIs. As a result, you're running into Reason: Credential is not supported if the CORS header 'Access-Control-Allow-Origin' is '*' on the client side. See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSNotSupportingCredentials for details. This commit restores the former default "false", in order to make WASM connections that worked prior 6.5 work again. Fixes: QTBUG-112478 Pick-to: 6.5 Change-Id: I46f6a374c07038608c3484ac831a1dc5999fb120 Reviewed-by: MikoĊ‚aj Boc Reviewed-by: Lorn Potter --- src/network/access/qnetworkreplywasmimpl.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp index b7fec9345a..d567423499 100644 --- a/src/network/access/qnetworkreplywasmimpl.cpp +++ b/src/network/access/qnetworkreplywasmimpl.cpp @@ -282,10 +282,8 @@ void QNetworkReplyWasmImplPrivate::doSendRequest() request.attribute(QNetworkRequest::CacheSaveControlAttribute, false).toBool()) { attr.attributes -= EMSCRIPTEN_FETCH_PERSIST_FILE; } - if (request.attribute(QNetworkRequest::UseCredentialsAttribute, true).toBool()) { - attr.withCredentials = true; - } + attr.withCredentials = request.attribute(QNetworkRequest::UseCredentialsAttribute, false).toBool(); attr.onsuccess = QNetworkReplyWasmImplPrivate::downloadSucceeded; attr.onerror = QNetworkReplyWasmImplPrivate::downloadFailed; attr.onprogress = QNetworkReplyWasmImplPrivate::downloadProgress;