mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-12 06:08:24 +02:00
MozReview-Commit-ID: FIohq85kl1G --HG-- rename : testing/web-platform/tests/XMLHttpRequest/event-upload-progress-crossorigin.sub.htm => testing/web-platform/tests/XMLHttpRequest/event-upload-progress-crossorigin.htm rename : testing/web-platform/tests/XMLHttpRequest/send-non-same-origin.sub.htm => testing/web-platform/tests/XMLHttpRequest/send-non-same-origin.htm rename : testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.sub.htm => testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.htm rename : testing/web-platform/tests/html/browsers/the-window-object/security-window/window-security.sub.html => testing/web-platform/tests/html/browsers/the-window-object/security-window/window-security.html rename : testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html => testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.html rename : testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html => testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.html rename : testing/web-platform/tests/html/dom/documents/dom-tree-accessors/Document.currentScript.sub.html => testing/web-platform/tests/html/dom/documents/dom-tree-accessors/Document.currentScript.html rename : testing/web-platform/tests/html/semantics/document-metadata/the-base-element/base_href_specified.sub.html => testing/web-platform/tests/html/semantics/document-metadata/the-base-element/base_href_specified.html
18 lines
565 B
Python
18 lines
565 B
Python
ETAG = '"123abc"'
|
|
CONTENT_TYPE = "text/plain"
|
|
CONTENT = "lorem ipsum dolor sit amet"
|
|
|
|
|
|
def main(request, response):
|
|
# let caching kick in if possible (conditional GET)
|
|
etag = request.headers.get("If-None-Match", None)
|
|
if etag == ETAG:
|
|
response.headers.set("X-HTTP-STATUS", 304)
|
|
response.status = (304, "Not Modified")
|
|
return ""
|
|
|
|
# cache miss, so respond with the actual content
|
|
response.status = (200, "OK")
|
|
response.headers.set("ETag", ETAG)
|
|
response.headers.set("Content-Type", CONTENT_TYPE)
|
|
return CONTENT
|