Update web-platform-tests to revision 21461a83c51b72bcff82476c1b79a26a194e7bab

This commit is contained in:
WPT Sync Bot 2019-02-15 20:34:22 -05:00
parent ea206034ad
commit f96f9a1b78
61 changed files with 1372 additions and 376 deletions

View file

@ -2,10 +2,11 @@ import os.path
def main(request, response):
cookie = request.cookies.first("Count", None)
token = request.GET.first("token", None)
value = request.server.stash.take(token)
count = 0
if cookie != None:
count = int(cookie.value)
if value != None:
count = int(value)
if request.GET.first("query", None) != None:
headers = [("Count", count)]
content = ""
@ -13,18 +14,18 @@ def main(request, response):
else:
count = count + 1
filename = "green-16x16.png"
if cookie > 1:
if count > 1:
filename = "green-256x256.png"
path = os.path.join(os.path.dirname(__file__), "../../images", filename)
body = open(path, "rb").read()
request.server.stash.put(token, count)
response.add_required_headers = False
response.writer.write_status(200)
response.writer.write_header("content-length", len(body))
response.writer.write_header("Cache-Control", "private, max-age=0, stale-while-revalidate=10")
response.writer.write_header("Cache-Control", "private, max-age=0, stale-while-revalidate=60")
response.writer.write_header("content-type", "image/png")
response.writer.write_header("Set-Cookie", "Count={}".format(count))
response.writer.end_headers()
response.writer.write(body)