Skip to content

This is a fix for #992 to allow drop to work with mod_http2 #1308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 12 additions & 2 deletions apache2/mod_security2.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,18 @@ int perform_interception(modsec_rec *msr) {
#if !defined(WIN32) && !defined(VERSION_NGINX)
{
extern module core_module;
apr_socket_t *csd = ap_get_module_config(msr->r->connection->conn_config,
&core_module);
apr_socket_t *csd;

/* For mod_http2 used by HTTP/2 there is a virtual connection so must go through
* master to get the main connection or the drop request doesn't seem to do anything.
* For HTTP/1.1 master will not be defined so just go through normal connection.
* More details here: https://github.com/icing/mod_h2/issues/127
*/
if (msr->r->connection->master) {
csd = ap_get_module_config(msr->r->connection->master->conn_config, &core_module);
} else {
csd = ap_get_module_config(msr->r->connection->conn_config, &core_module);
}

if (csd) {
if (apr_socket_close(csd) == APR_SUCCESS) {
Expand Down