|
43 | 43 | server = |
44 | 44 | { pkgs, ... }: |
45 | 45 | { |
| 46 | + environment.systemPackages = [ |
| 47 | + pkgs.curlHTTP3 |
| 48 | + ]; |
| 49 | + |
46 | 50 | services.h2o = { |
47 | 51 | enable = true; |
48 | 52 | defaultHTTPListenPort = port.HTTP; |
|
60 | 64 | "${domain.TLS}" = { |
61 | 65 | tls = { |
62 | 66 | policy = "force"; |
| 67 | + quic = { |
| 68 | + retry = "ON"; |
| 69 | + }; |
63 | 70 | identity = [ |
64 | 71 | { |
65 | 72 | key-file = ../../common/acme/server/acme.test.key.pem; |
|
99 | 106 | ]; |
100 | 107 |
|
101 | 108 | networking = { |
102 | | - firewall.allowedTCPPorts = with port; [ |
103 | | - HTTP |
104 | | - TLS |
105 | | - ]; |
| 109 | + firewall = { |
| 110 | + allowedTCPPorts = with port; [ |
| 111 | + HTTP |
| 112 | + TLS |
| 113 | + ]; |
| 114 | + allowedUDPPorts = with port; [ |
| 115 | + TLS |
| 116 | + ]; |
| 117 | + }; |
106 | 118 | extraHosts = '' |
107 | 119 | 127.0.0.1 ${domain.HTTP} |
108 | 120 | 127.0.0.1 ${domain.TLS} |
109 | 121 | ''; |
110 | 122 | }; |
111 | 123 | }; |
112 | 124 | }; |
113 | | - |
114 | 125 | testScript = |
115 | 126 | let |
116 | 127 | portStrHTTP = builtins.toString port.HTTP; |
|
122 | 133 | server.wait_for_open_port(${portStrHTTP}) |
123 | 134 | server.wait_for_open_port(${portStrTLS}) |
124 | 135 |
|
125 | | - http_hello_world_body = server.succeed("curl --fail-with-body 'http://${domain.HTTP}:${portStrHTTP}/hello_world.txt'") |
126 | | - assert "${sawatdi_chao_lok}" in http_hello_world_body |
| 136 | + assert "${sawatdi_chao_lok}" in server.succeed("curl --fail-with-body 'http://${domain.HTTP}:${portStrHTTP}/hello_world.txt'") |
127 | 137 |
|
128 | 138 | tls_hello_world_head = server.succeed("curl -v --head --compressed --http2 --tlsv1.3 --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'").lower() |
129 | 139 | assert "http/2 200" in tls_hello_world_head |
130 | 140 | assert "server: h2o" in tls_hello_world_head |
131 | 141 | assert "content-type: text/x-rst" in tls_hello_world_head |
132 | 142 |
|
133 | | - tls_hello_world_body = server.succeed("curl -v --http2 --tlsv1.3 --compressed --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'") |
134 | | - assert "${sawatdi_chao_lok}" in tls_hello_world_body |
| 143 | + assert "${sawatdi_chao_lok}" in server.succeed("curl -v --http2 --tlsv1.3 --compressed --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'") |
| 144 | +
|
| 145 | + quic_hello_world_head = server.succeed("curl -v --head --compressed --http3-only --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'").lower() |
| 146 | + assert "http/3 200" in quic_hello_world_head |
| 147 | + assert "server: h2o" in quic_hello_world_head |
| 148 | + assert "content-type: text/x-rst" in quic_hello_world_head |
| 149 | +
|
| 150 | + assert "${sawatdi_chao_lok}" in server.succeed("curl -v --http3-only --compressed --fail-with-body 'https://${domain.TLS}:${portStrTLS}/hello_world.rst'") |
135 | 151 |
|
136 | | - tls_hello_world_head_redirected = server.succeed("curl -v --head --fail-with-body 'http://${domain.TLS}:${builtins.toString port.HTTP}/hello_world.rst'").lower() |
137 | | - assert "redirected" in tls_hello_world_head_redirected |
| 152 | + assert "redirected" in server.succeed("curl -v --head --fail-with-body 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'").lower() |
138 | 153 |
|
139 | 154 | server.fail("curl --location --max-redirs 0 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'") |
140 | 155 |
|
141 | | - tls_hello_world_body_redirected = server.succeed("curl -v --location --fail-with-body 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'") |
142 | | - assert "${sawatdi_chao_lok}" in tls_hello_world_body_redirected |
| 156 | + assert "${sawatdi_chao_lok}" in server.succeed("curl -v --location --fail-with-body 'http://${domain.TLS}:${portStrHTTP}/hello_world.rst'") |
143 | 157 | ''; |
144 | 158 | } |
0 commit comments