Update web-platform-tests to revision be5419e845d39089ba6dc338c1bd0fa279108317

This commit is contained in:
Josh Matthews 2018-01-04 13:44:24 -05:00
parent aa199307c8
commit 2b6f573eb5
3440 changed files with 109438 additions and 41750 deletions

View file

@ -11,6 +11,10 @@ functions are applied to the response from left to right. For example::
This would serve bytes 1 to 199, inclusive, of foo.txt with the HTTP status
code 404.
.. note::
Pipes are only applied to static files, and will not work if applied to
other types of handlers, such as Python File Handlers.
There are several built-in pipe functions, and it is possible to add
more using the `@pipe` decorator on a function, if required.

View file

@ -76,5 +76,11 @@ class TestTrickle(TestUsingServer):
self.assertEqual(resp.read(), expected)
self.assertGreater(6, t1-t0)
def test_headers(self):
resp = self.request("/document.txt", query="pipe=trickle(d0.01)")
self.assertEqual(resp.info()["Cache-Control"], "no-cache, no-store, must-revalidate")
self.assertEqual(resp.info()["Pragma"], "no-cache")
self.assertEqual(resp.info()["Expires"], "0")
if __name__ == '__main__':
unittest.main()

View file

@ -231,6 +231,13 @@ def trickle(request, response, delays):
content = resolve_content(response)
offset = [0]
if not ("Cache-Control" in response.headers or
"Pragma" in response.headers or
"Expires" in response.headers):
response.headers.set("Cache-Control", "no-cache, no-store, must-revalidate")
response.headers.set("Pragma", "no-cache")
response.headers.set("Expires", "0")
def add_content(delays, repeat=False):
for i, (item_type, value) in enumerate(delays):
if item_type == "bytes":

View file

@ -418,7 +418,8 @@ class WebTestHttpd(object):
_host, self.port = self.httpd.socket.getsockname()
except Exception:
self.logger.error('Init failed! You may need to modify your hosts file. Refer to README.md.')
self.logger.error("Failed to start HTTP server. "
"You may need to edit /etc/hosts or similar, see README.md.")
raise
def start(self, block=False):