From: Stefan Eissing Date: Wed, 13 Oct 2021 11:15:03 +0000 (+0000) Subject: * mod_http2: checking for nghttp2 function 'set_no_closed_streams' on configure. X-Git-Tag: 2.5.0-alpha2-ci-test-only~742 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=672e736a10709497bda78dde733d346733900921;p=thirdparty%2Fapache%2Fhttpd.git * mod_http2: checking for nghttp2 function 'set_no_closed_streams' on configure. adapting test result expectations for new nghttp2 1.45 change in checking pseudo header fields for invalid characters. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894189 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/config2.m4 b/modules/http2/config2.m4 index a82051d0a26..67065e01acc 100644 --- a/modules/http2/config2.m4 +++ b/modules/http2/config2.m4 @@ -161,6 +161,9 @@ dnl # nghttp2 >= 1.14.0: invalid header callback dnl # nghttp2 >= 1.15.0: get/set stream window sizes AC_CHECK_FUNCS([nghttp2_session_get_stream_local_window_size], [APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_LOCAL_WIN_SIZE"])], []) +dnl # nghttp2 >= 1.15.0: don't keep info on closed streams + AC_CHECK_FUNCS([nghttp2_option_set_no_closed_streams], + [APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_NO_CLOSED_STREAMS"])], []) else AC_MSG_WARN([nghttp2 version is too old]) fi diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c index 20102ba2189..60a5e3707dc 100644 --- a/modules/http2/h2_session.c +++ b/modules/http2/h2_session.c @@ -890,11 +890,12 @@ apr_status_t h2_session_create(h2_session **psession, conn_rec *c, request_rec * /* We need to handle window updates ourself, otherwise we * get flooded by nghttp2. */ nghttp2_option_set_no_auto_window_update(options, 1); +#ifdef H2_NG2_NO_CLOSED_STREAMS /* We do not want nghttp2 to keep information about closed streams as * that accumulates memory on long connections. This makes PRIORITY * setting in relation to older streams non-working. */ nghttp2_option_set_no_closed_streams(options, 1); - +#endif rv = nghttp2_session_server_new2(&session->ngh2, callbacks, session, options); nghttp2_session_callbacks_del(callbacks); diff --git a/test/modules/http2/test_200_header_invalid.py b/test/modules/http2/test_200_header_invalid.py index fbaa1117392..b412d7c37cf 100644 --- a/test/modules/http2/test_200_header_invalid.py +++ b/test/modules/http2/test_200_header_invalid.py @@ -168,10 +168,12 @@ class TestStore: opt = ["-H:method: GET /hello.py"] r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r - assert r.response - assert r.response["status"] == 400 + # nghttp version >= 1.45.0 check pseudo headers and RST streams, + # which means we see no response. + if r.response is not None: + assert r.response["status"] == 400 url = env.mkurl("https", "cgi", "/proxy/hello.py") r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r - assert r.response - assert r.response["status"] == 400 + if r.response is not None: + assert r.response["status"] == 400