From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../resources/echo-client-hints-received.py | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py (limited to 'testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py') diff --git a/testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py b/testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py new file mode 100644 index 0000000000..190cd86289 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py @@ -0,0 +1,36 @@ +def main(request, response): + """ + Simple handler that sets a response header based on which client hint + request headers were received. + """ + + response.headers.append(b"Access-Control-Allow-Origin", b"*") + response.headers.append(b"Access-Control-Allow-Headers", b"*") + response.headers.append(b"Access-Control-Expose-Headers", b"*") + + if b"sec-ch-device-memory" in request.headers: + response.headers.set(b"device-memory-received", request.headers.get(b"sec-ch-device-memory")) + if b"device-memory" in request.headers: + response.headers.set(b"device-memory-deprecated-received", request.headers.get(b"device-memory")) + if b"sec-ch-dpr" in request.headers: + response.headers.set(b"dpr-received", request.headers.get(b"sec-ch-dpr")) + if b"dpr" in request.headers: + response.headers.set(b"dpr-deprecated-received", request.headers.get(b"dpr")) + if b"sec-ch-viewport-width" in request.headers: + response.headers.set(b"viewport-width-received", request.headers.get(b"sec-ch-viewport-width")) + if b"viewport-width" in request.headers: + response.headers.set(b"viewport-width-deprecated-received", request.headers.get(b"viewport-width")) + if b"sec-ch-viewport-height" in request.headers: + response.headers.set(b"viewport-height-received", request.headers.get(b"sec-ch-viewport-height")) + if b"rtt" in request.headers: + response.headers.set(b"rtt-received", request.headers.get(b"rtt")) + if b"downlink" in request.headers: + response.headers.set(b"downlink-received", request.headers.get(b"downlink")) + if b"ect" in request.headers: + response.headers.set(b"ect-received", request.headers.get(b"ect")) + if b"sec-ch-ua-mobile" in request.headers: + response.headers.set(b"mobile-received", request.headers.get(b"sec-ch-ua-mobile")) + if b"sec-ch-prefers-color-scheme" in request.headers: + response.headers.set(b"prefers-color-scheme-received", request.headers.get(b"sec-ch-prefers-color-scheme")) + if b"sec-ch-prefers-reduced-motion" in request.headers: + response.headers.set(b"prefers-reduced-motion-received", request.headers.get(b"sec-ch-prefers-reduced-motion")) -- cgit v1.2.3