Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/clients/h2ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static int h2_session_on_frame_recv(nghttp2_session *ngh2,
const nghttp2_frame *frame,
void *user_data)
{
(void)user_data;
struct h2_session *session = user_data;

switch (frame->hd.type) {
case NGHTTP2_HEADERS:
Expand All @@ -511,6 +511,8 @@ static int h2_session_on_frame_recv(nghttp2_session *ngh2,
break;
case NGHTTP2_GOAWAY:
log_infof("frame recv", "FRAME[GOAWAY]");
fprintf(stdout, "[%d] GOAWAY\n", frame->hd.stream_id);
session->aborted = 1;
break;
}
return 0;
Expand Down Expand Up @@ -744,6 +746,9 @@ static nfds_t h2_session_set_poll(struct h2_session *session,
int want_read, want_write;
struct h2_stream *stream;

if(session->aborted)
return 0;

want_read = (nghttp2_session_want_read(session->ngh2) ||
session->want_io == IO_WANT_READ);
want_write = (nghttp2_session_want_write(session->ngh2) ||
Expand Down
2 changes: 1 addition & 1 deletion test/modules/http2/test_003_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def test_h2_003_61(self, env):
url = env.mkurl("https", "test1", "/index.html")
r = env.curl_get(url, options=['-H', 'TE: gzip'])
# such a request headers is not allowed in HTTP/2
assert r.exit_code == 92, r
assert r.exit_code != 0, r

# lets do some error tests
def test_h2_003_70(self, env):
Expand Down
11 changes: 6 additions & 5 deletions test/modules/http2/test_800_websockets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import inspect
import logging
import os
import re
import shutil
import subprocess
import time
Expand Down Expand Up @@ -73,8 +74,8 @@ def ws_run(env: H2TestEnv, path, authority=None, do_input=None, inbytes=None,
proc.communicate(timeout=timeout)
end = datetime.now()
lines = open(f'{env.gen_dir}/h2ws.stdout').read().splitlines()
infos = [line for line in lines if line.startswith('[1] ')]
hex_content = ' '.join([line for line in lines if not line.startswith('[1] ')])
infos = [line for line in lines if re.match(r'^\[\d+] ', line)]
hex_content = ' '.join([line for line in lines if not re.match(r'^\[\d+] ', line)])
if len(infos) > 0 and infos[0] == '[1] :status: 200':
frames = WsFrameReader.parse(bytearray.fromhex(hex_content))
else:
Expand Down Expand Up @@ -195,19 +196,19 @@ def test_h2_800_06_miss_version(self, env: H2TestEnv, ws_server):
def test_h2_800_07_miss_path(self, env: H2TestEnv, ws_server):
r, infos, frames = ws_run(env, path='/ws/echo/', scenario='miss-path')
assert r.exit_code == 0, f'{r}'
assert infos == ['[1] RST'], f'{r}'
assert infos == ['[1] RST'] or infos == ['[0] GOAWAY'], f'{r}'

# CONNECT missing the :scheme header
def test_h2_800_08_miss_scheme(self, env: H2TestEnv, ws_server):
r, infos, frames = ws_run(env, path='/ws/echo/', scenario='miss-scheme')
assert r.exit_code == 0, f'{r}'
assert infos == ['[1] RST'], f'{r}'
assert infos == ['[1] RST'] or infos == ['[0] GOAWAY'], f'{r}'

# CONNECT missing the :authority header
def test_h2_800_09a_miss_authority(self, env: H2TestEnv, ws_server):
r, infos, frames = ws_run(env, path='/ws/echo/', scenario='miss-authority')
assert r.exit_code == 0, f'{r}'
assert infos == ['[1] RST'], f'{r}'
assert infos == ['[1] RST'] or infos == ['[0] GOAWAY'], f'{r}'

# CONNECT to authority with disabled websockets
def test_h2_800_09b_unsupported(self, env: H2TestEnv, ws_server):
Expand Down