Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch's Response.statusText is unexpectedly the full http status line…
… for HTTP/2 responses https://bugs.webkit.org/show_bug.cgi?id=176479 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-09-08 Reviewed by Alex Christensen. Source/WebCore: Test: http/wpt/fetch/response-status-text.html HTTP/2 doesn't include a status reason phrase. So the "status line" ends up just being the version and status code. Fallback to the empty string instead of the full line. * platform/network/HTTPParsers.cpp: (WebCore::extractReasonPhraseFromHTTPStatusLine): Source/WebKit: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): Initialize AtomicString statics like emptyAtom(). LayoutTests: * http/wpt/fetch/resources/status-garbage.asis: Added. * http/wpt/fetch/resources/status-normal.txt: Added. * http/wpt/fetch/resources/status-with-message.asis: Added. * http/wpt/fetch/resources/status-without-message.asis: Added. Various text HTTP responses with different status lines. * http/wpt/fetch/response-status-text-expected.txt: Added. * http/wpt/fetch/response-status-text.html: Added. Test the Fetch Response's status / statusText for different HTTP status lines. The status without a message is similiar to HTTP/2 because HTTP/2 only has a :status pseudo-header and lacks a reason phrase. Canonical link: https://commits.webkit.org/193157@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221804 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
3cc77ed
commit 93719e1
Showing
11 changed files
with
102 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 @@ | ||
ALPHA BETA |
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 @@ | ||
Intentionally empty. |
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 @@ | ||
HTTP/1.1 200 Alpha |
1 change: 1 addition & 0 deletions
1
LayoutTests/http/wpt/fetch/resources/status-without-message.asis
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 @@ | ||
HTTP/1.1 200 |
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,6 @@ | ||
|
||
PASS Normal status text. | ||
PASS Abnormal status text. | ||
PASS Empty status text. | ||
PASS Garbage status line. | ||
|
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,38 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Response status and statusText given various HTTP response status lines.</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
promise_test(test => { | ||
return fetch("resources/status-normal.txt").then((response) => { | ||
assert_equals(response.status, 200); | ||
assert_equals(response.statusText, "OK"); | ||
}); | ||
}, "Normal status text."); | ||
|
||
promise_test(test => { | ||
return fetch("resources/status-with-message.asis").then((response) => { | ||
assert_equals(response.status, 200); | ||
assert_equals(response.statusText, "Alpha"); | ||
}); | ||
}, "Abnormal status text."); | ||
|
||
promise_test(test => { | ||
return fetch("resources/status-without-message.asis").then((response) => { | ||
assert_equals(response.status, 200); | ||
assert_equals(response.statusText, ""); | ||
}); | ||
}, "Empty status text."); | ||
|
||
promise_test(test => { | ||
let promise = fetch("resources/status-garbage.asis"); | ||
return promise_rejects(test, new TypeError(), promise); | ||
}, "Garbage status line."); | ||
</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
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
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