Skip to content
Permalink
Browse files
Set top origin of CORS preflight requests
https://bugs.webkit.org/show_bug.cgi?id=239869
<rdar://92458995>

Patch by Alex Christensen <achristensen@webkit.org> on 2022-04-28
Reviewed by Geoffrey Garen.

Since r293481 we establish two TCP connections to each domain that needs a CORS preflight request.
This is because we were calling _setPrivacyProxyFailClosedForUnreachableNonMainHosts for the CORS
preflight request but not the actual request after a successful CORS preflight check.  They were
different because we weren't setting parameters.topOrigin for the CORS preflight request.  Now we
are and the two requests can share a TCP connection once more.

* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::startPreflight):

Canonical link: https://commits.webkit.org/250100@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Alex Christensen authored and webkit-commit-queue committed Apr 28, 2022
1 parent 8fdf471 commit 0c8088f566ab32d519c83d27cfaccc822adb3aa0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
@@ -1,3 +1,20 @@
2022-04-28 Alex Christensen <achristensen@webkit.org>

Set top origin of CORS preflight requests
https://bugs.webkit.org/show_bug.cgi?id=239869
<rdar://92458995>

Reviewed by Geoffrey Garen.

Since r293481 we establish two TCP connections to each domain that needs a CORS preflight request.
This is because we were calling _setPrivacyProxyFailClosedForUnreachableNonMainHosts for the CORS
preflight request but not the actual request after a successful CORS preflight check. They were
different because we weren't setting parameters.topOrigin for the CORS preflight request. Now we
are and the two requests can share a TCP connection once more.

* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::startPreflight):

2022-04-28 Per Arne Vollan <pvollan@apple.com>

Fix build error after r293509
@@ -75,6 +75,7 @@ void NetworkCORSPreflightChecker::startPreflight()
m_loadInformation = NetworkTransactionInformation { NetworkTransactionInformation::Type::Preflight, loadParameters.request, { }, { } };

loadParameters.webPageProxyID = m_parameters.webPageProxyID;
loadParameters.topOrigin = m_parameters.topOrigin;

if (auto* networkSession = m_networkProcess->networkSession(m_parameters.sessionID)) {
m_task = NetworkDataTask::create(*networkSession, *this, WTFMove(loadParameters));

0 comments on commit 0c8088f

Please sign in to comment.