2
0

test_http3_global_enabled.py 1.0 KB

123456789101112131415161718192021
  1. import pytest
  2. import re
  3. #Python Requests is not able to do native http3 requests.
  4. #We only check for directives which should enable http3.
  5. def test_http3_global_enabled_ALTSVC_header(docker_compose, nginxproxy):
  6. r = nginxproxy.get("http://http3-global-enabled.nginx-proxy.tld/headers")
  7. assert r.status_code == 200
  8. assert "Host: http3-global-enabled.nginx-proxy.tld" in r.text
  9. assert "alt-svc" in r.headers
  10. assert r.headers["alt-svc"] == 'h3=":443"; ma=86400;'
  11. def test_http3_global_enabled_config(docker_compose, nginxproxy):
  12. conf = nginxproxy.get_conf().decode('ASCII')
  13. r = nginxproxy.get("http://http3-global-enabled.nginx-proxy.tld")
  14. assert r.status_code == 200
  15. assert re.search(r"listen 443 quic reuseport\;", conf)
  16. assert re.search(r"(?s)http3-global-enabled\.nginx-proxy\.tld;.*listen 443 quic", conf)
  17. assert re.search(r"(?s)http3-global-enabled\.nginx-proxy\.tld;.*http3 on\;", conf)
  18. assert re.search(r"(?s)http3-global-enabled\.nginx-proxy\.tld;.*add_header alt-svc \'h3=\":443\"; ma=86400;\'", conf)