Skip to content

Commit 019edfa

Browse files
tunethewebFelipe Zimmerle
authored andcommitted
This is a fix for #992 to allow drop to work with mod_http2
1 parent b629398 commit 019edfa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

apache2/mod_security2.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,18 @@ int perform_interception(modsec_rec *msr) {
265265
#if !defined(WIN32) && !defined(VERSION_NGINX)
266266
{
267267
extern module core_module;
268-
apr_socket_t *csd = ap_get_module_config(msr->r->connection->conn_config,
269-
&core_module);
268+
apr_socket_t *csd;
269+
270+
/* For mod_http2 used by HTTP/2 there is a virtual connection so must go through
271+
* master to get the main connection or the drop request doesn't seem to do anything.
272+
* For HTTP/1.1 master will not be defined so just go through normal connection.
273+
* More details here: https://github.com/icing/mod_h2/issues/127
274+
*/
275+
if (msr->r->connection->master) {
276+
csd = ap_get_module_config(msr->r->connection->master->conn_config, &core_module);
277+
} else {
278+
csd = ap_get_module_config(msr->r->connection->conn_config, &core_module);
279+
}
270280

271281
if (csd) {
272282
if (apr_socket_close(csd) == APR_SUCCESS) {

0 commit comments

Comments
 (0)