Commit 8bb5e943 authored by Andrew Comminos's avatar Andrew Comminos Committed by Commit Bot

Add WPT to verify that 1XX responses are used to provide responseStart timing

Verifies that the UA sets responseStart to the time that an
initial 1XX response was received by returning {100, delay, 200} and
testing that the delay is not included in responseStart.

Bug: 568024
Change-Id: I7295e6478a95abe1b6154ddf1feab764f596a5ec
Reviewed-on: https://chromium-review.googlesource.com/c/1372359Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615853}
parent 2eef9150
......@@ -33,7 +33,11 @@ def main(request, response):
elif arg.startswith("status:"):
code = int(urllib.unquote(arg[7:]))
response.writer.write_status(code)
statusSent = True
if code // 100 == 1:
# Terminate informational 1XX responses with an empty line.
response.writer.end_headers()
else:
statusSent = True
elif arg == "flush":
response.writer.flush()
......
......@@ -262,6 +262,47 @@ window.onload =
});
});
// Test that responseStart uses the timing of 1XX responses by
// synthesizing a delay between a 100 and 200 status, and verifying that
// responseStart does not include this delay. If the delay is included,
// this implies that the 200 status line was (incorrectly) used for
// responseStart timing, despite the 100 response arriving earlier.
//
// Source: "In the case where more than one response is available for a
// request, due to an Informational 1xx response, the reported
// responseStart value is that of the first response to the last
// request."
[
{ initiator: "iframe", response: "(done)", mime: mimeHtml },
{ initiator: "xmlhttprequest", response: "(done)", mime: mimeText },
{ initiator: "script", response: '"";', mime: mimeScript },
{ initiator: "link", response: ".unused{}", mime: mimeCss },
]
.forEach(function (template) {
testCases.push({
description: "'" + template.initiator + " responseStart uses 1XX (first) response timings'",
test: function (test) {
initiateFetch(
test,
template.initiator,
getSyntheticUrl("status:100"
+ "&flush"
+ "&" + serverStepDelay + "ms"
+ "&status:200"
+ "&mime:" + template.mime
+ "&send:" + encodeURIComponent(template.response)),
function (initiator, entry) {
assert_less_than(
entry.responseStart - entry.requestStart,
serverStepDelay,
"HTTP/1.1 1XX (first) response should determine 'responseStart' timing.");
test.done();
});
}
});
});
// Function to run the next case in the queue.
var currentTestIndex = -1;
function runNextCase() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment