Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
In case of POST navigation redirected by a 302, the 'Origin' header i…
…s kept in the redirected request https://bugs.webkit.org/show_bug.cgi?id=222653 <rdar://problem/74983521> Reviewed by Alex Christensen. Source/WebCore: Remove Origin header if the navigation request goes from POST to GET. This aligns with other browsers and removes some known interop issues. This is consistent with WebKit not sending Origin headers for GET navigations. Test: http/wpt/fetch/navigation-post-to-get-origin.html * loader/DocumentLoader.cpp: (WebCore::isRedirectToGetAfterPost): (WebCore::DocumentLoader::willSendRequest): LayoutTests: * http/wpt/fetch/echo-origin.py: Added. * http/wpt/fetch/navigation-post-to-get-origin-expected.txt: Added. * http/wpt/fetch/navigation-post-to-get-origin.html: Added. Canonical link: https://commits.webkit.org/234866@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
6 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
|
||
|
||
|
||
|
||
PASS No origin header after POST submission and 302 redirection | ||
PASS No origin header after POST submission and 303 redirection | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Navigation and POST to GET redirect</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<form id="myform" method="POST" action="/common/redirect.py?status=302&location=/WebKit/fetch/resources/echo-origin.py" target="targetFrame"> | ||
<input name="the-input" value="input value goes here"> | ||
</form> | ||
<iframe name="targetFrame" src="about:blank"></iframe> | ||
<form id="myform2" method="POST" action="/common/redirect.py?status=303&location=/WebKit/fetch/resources/echo-origin.py" target="targetFrame2"> | ||
<input name="the-input" value="input value goes here"> | ||
</form> | ||
<iframe name="targetFrame2" src="about:blank"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
myform.submit(); | ||
const data = await new Promise(resolve => onmessage = (e) => resolve(e.data)); | ||
assert_equals(data, "no header"); | ||
}, "No origin header after POST submission and 302 redirection"); | ||
|
||
promise_test(async t => { | ||
myform2.submit(); | ||
const data = await new Promise(resolve => onmessage = (e) => resolve(e.data)); | ||
assert_equals(data, "no header"); | ||
}, "No origin header after POST submission and 303 redirection"); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def main(request, response): | ||
response.headers.set("Content-Type", "text/html") | ||
response.content = "<script>parent.postMessage('" + request.headers.get("Origin", "no header") + "')</script>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters