diff --git a/client-hints/resources/2x3-svg-scaled-by-sec-ch-width.py b/client-hints/resources/2x3-svg-scaled-by-sec-ch-width.py new file mode 100644 index 00000000000000..d53574c361213d --- /dev/null +++ b/client-hints/resources/2x3-svg-scaled-by-sec-ch-width.py @@ -0,0 +1,22 @@ +def main(request, response): + """ + Simple handler that responds with an SVG image with width `2 * sec-ch-width` + and height `3 * sec-ch-width`, or 1x1 if sec-ch-width is not present. + """ + + width = 1 + height = 1 + + if b"sec-ch-width" in request.headers: + sec_ch_width = request.headers.get(b"sec-ch-width").decode() + width = 2 * int(sec_ch_width) + height = 3 * int(sec_ch_width) + + response.headers.set(b"Content-Type", b"image/svg+xml") + response.content = str.encode(f""" + + """) diff --git a/client-hints/sec-ch-width.https.html b/client-hints/sec-ch-width.https.html new file mode 100644 index 00000000000000..f44fa3bb5e1c6f --- /dev/null +++ b/client-hints/sec-ch-width.https.html @@ -0,0 +1,18 @@ + + + +Tests Sec-CH-Width + + + + + + +