diff --git a/mod_http2/h2_c1.c b/mod_http2/h2_c1.c index 739b1d14..c11eea61 100644 --- a/mod_http2/h2_c1.c +++ b/mod_http2/h2_c1.c @@ -113,9 +113,9 @@ apr_status_t h2_c1_setup(conn_rec *c, request_rec *r, server_rec *s) return rv; } -apr_status_t h2_c1_run(conn_rec *c) +int h2_c1_run(conn_rec *c) { - apr_status_t status; + apr_status_t status, rc = OK; int mpm_state = 0, keepalive = 0; h2_conn_ctx_t *conn_ctx = h2_conn_ctx_get(c); @@ -152,14 +152,24 @@ apr_status_t h2_c1_run(conn_rec *c) case H2_SESSION_ST_IDLE: case H2_SESSION_ST_BUSY: case H2_SESSION_ST_WAIT: +#ifdef AGAIN + if (!keepalive) { + c->cs->state = CONN_STATE_PROCESS; + rc = AGAIN; + } + else { + c->cs->state = CONN_STATE_KEEPALIVE; + } +#else c->cs->state = CONN_STATE_WRITE_COMPLETION; if (!keepalive) { /* let the MPM know that we are not done and want * the Timeout behaviour instead of a KeepAliveTimeout - * See PR 63534. + * See PR 63534. */ c->cs->sense = CONN_SENSE_WANT_READ; } +#endif break; case H2_SESSION_ST_CLEANUP: case H2_SESSION_ST_DONE: @@ -169,7 +179,7 @@ apr_status_t h2_c1_run(conn_rec *c) } } - return APR_SUCCESS; + return rc; } apr_status_t h2_c1_pre_close(struct h2_conn_ctx_t *ctx, conn_rec *c) @@ -275,8 +285,7 @@ static int h2_c1_hook_process_connection(conn_rec* c) return !OK; } } - h2_c1_run(c); - return OK; + return h2_c1_run(c); declined: ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c, "h2_h2, declined"); diff --git a/test/modules/http2/test_700_load_get.py b/test/modules/http2/test_700_load_get.py index a4d67fdf..2f78a56f 100644 --- a/test/modules/http2/test_700_load_get.py +++ b/test/modules/http2/test_700_load_get.py @@ -16,6 +16,7 @@ def _class_scope(self, env): conf = H2Conf(env).add_vhost_cgi().add_vhost_test1() conf.add('LogLevel mpm_event:debug') conf.add(f"StartServers 1") + conf.add(f"MaxRequestWorkers 25") conf.install() assert env.apache_restart() == 0 @@ -91,3 +92,24 @@ def test_h2_700_20(self, env, connbits, streambits): ] r = env.run(args) self.check_h2load_ok(env, r, n) + + # test window sizes and many connections + def test_h2_700_21(self, env): + assert env.is_live() + n = 2000 + conns = 300 + parallel = 5 + connbits = 10 + streambits = 30 + args = [ + env.h2load, + '-n', f'{n}', '-t', '1', + '-c', f'{conns}', '-m', f'{parallel}', + '-W', f'{connbits}', # connection window bits + '-w', f'{streambits}', # stream window bits + f'--connect-to=localhost:{env.https_port}', + f'--base-uri={env.mkurl("https", "test1", "/")}', + "/data-100k" + ] + r = env.run(args) + self.check_h2load_ok(env, r, n)