|
1 | 1 | import inspect |
2 | 2 | import logging |
3 | 3 | import os |
| 4 | +import re |
4 | 5 | import shutil |
5 | 6 | import subprocess |
6 | 7 | import time |
@@ -73,8 +74,8 @@ def ws_run(env: H2TestEnv, path, authority=None, do_input=None, inbytes=None, |
73 | 74 | proc.communicate(timeout=timeout) |
74 | 75 | end = datetime.now() |
75 | 76 | lines = open(f'{env.gen_dir}/h2ws.stdout').read().splitlines() |
76 | | - infos = [line for line in lines if line.startswith('[1] ')] |
77 | | - hex_content = ' '.join([line for line in lines if not line.startswith('[1] ')]) |
| 77 | + infos = [line for line in lines if re.match(r'^\[\d+] ', line)] |
| 78 | + hex_content = ' '.join([line for line in lines if not re.match(r'^\[\d+] ', line)]) |
78 | 79 | if len(infos) > 0 and infos[0] == '[1] :status: 200': |
79 | 80 | frames = WsFrameReader.parse(bytearray.fromhex(hex_content)) |
80 | 81 | else: |
@@ -195,19 +196,19 @@ def test_h2_800_06_miss_version(self, env: H2TestEnv, ws_server): |
195 | 196 | def test_h2_800_07_miss_path(self, env: H2TestEnv, ws_server): |
196 | 197 | r, infos, frames = ws_run(env, path='/ws/echo/', scenario='miss-path') |
197 | 198 | assert r.exit_code == 0, f'{r}' |
198 | | - assert infos == ['[1] RST'], f'{r}' |
| 199 | + assert infos == ['[1] RST'] or infos == ['[0] GOAWAY'], f'{r}' |
199 | 200 |
|
200 | 201 | # CONNECT missing the :scheme header |
201 | 202 | def test_h2_800_08_miss_scheme(self, env: H2TestEnv, ws_server): |
202 | 203 | r, infos, frames = ws_run(env, path='/ws/echo/', scenario='miss-scheme') |
203 | 204 | assert r.exit_code == 0, f'{r}' |
204 | | - assert infos == ['[1] RST'], f'{r}' |
| 205 | + assert infos == ['[1] RST'] or infos == ['[0] GOAWAY'], f'{r}' |
205 | 206 |
|
206 | 207 | # CONNECT missing the :authority header |
207 | 208 | def test_h2_800_09a_miss_authority(self, env: H2TestEnv, ws_server): |
208 | 209 | r, infos, frames = ws_run(env, path='/ws/echo/', scenario='miss-authority') |
209 | 210 | assert r.exit_code == 0, f'{r}' |
210 | | - assert infos == ['[1] RST'], f'{r}' |
| 211 | + assert infos == ['[1] RST'] or infos == ['[0] GOAWAY'], f'{r}' |
211 | 212 |
|
212 | 213 | # CONNECT to authority with disabled websockets |
213 | 214 | def test_h2_800_09b_unsupported(self, env: H2TestEnv, ws_server): |
|
0 commit comments