css.py (971B)
1 def main(request, response): 2 type = request.GET.first(b"type", None) 3 is_revalidation = request.headers.get(b"If-Modified-Since", None) 4 5 content = b"/* nothing to see here */" 6 7 response.add_required_headers = False 8 if is_revalidation is not None: 9 response.writer.write_status(304) 10 response.writer.write_header(b"x-content-type-options", b"nosniff") 11 response.writer.write_header(b"content-length", 0) 12 if(type != None): 13 response.writer.write_header(b"content-type", type) 14 response.writer.end_headers() 15 response.writer.write(b"") 16 else: 17 response.writer.write_status(200) 18 response.writer.write_header(b"x-content-type-options", b"nosniff") 19 response.writer.write_header(b"content-length", len(content)) 20 if(type != None): 21 response.writer.write_header(b"content-type", type) 22 response.writer.end_headers() 23 response.writer.write(content)