summaryrefslogtreecommitdiffstats
path: root/test/wpt/tests/fetch/nosniff/resources/css.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/wpt/tests/fetch/nosniff/resources/css.py')
-rw-r--r--test/wpt/tests/fetch/nosniff/resources/css.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/wpt/tests/fetch/nosniff/resources/css.py b/test/wpt/tests/fetch/nosniff/resources/css.py
new file mode 100644
index 0000000..8afb569
--- /dev/null
+++ b/test/wpt/tests/fetch/nosniff/resources/css.py
@@ -0,0 +1,23 @@
+def main(request, response):
+ type = request.GET.first(b"type", None)
+ is_revalidation = request.headers.get(b"If-Modified-Since", None)
+
+ content = b"/* nothing to see here */"
+
+ response.add_required_headers = False
+ if is_revalidation is not None:
+ response.writer.write_status(304)
+ response.writer.write_header(b"x-content-type-options", b"nosniff")
+ response.writer.write_header(b"content-length", 0)
+ if(type != None):
+ response.writer.write_header(b"content-type", type)
+ response.writer.end_headers()
+ response.writer.write(b"")
+ else:
+ response.writer.write_status(200)
+ response.writer.write_header(b"x-content-type-options", b"nosniff")
+ response.writer.write_header(b"content-length", len(content))
+ if(type != None):
+ response.writer.write_header(b"content-type", type)
+ response.writer.end_headers()
+ response.writer.write(content)