@@ -39,8 +39,8 @@ static ngx_int_t
39
39
ngx_http_modsecurity_header_filter (ngx_http_request_t * r )
40
40
{
41
41
int rc ;
42
- char * http_response_ver ;
43
- ngx_uint_t i , status ;
42
+ char * http_protocol ;
43
+ ngx_uint_t i ;
44
44
ngx_pool_t * old_pool ;
45
45
ngx_list_part_t * part ;
46
46
ngx_table_elt_t * header ;
@@ -82,26 +82,17 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)
82
82
header [i ].value .data , header [i ].value .len );
83
83
}
84
84
85
- /* prepare extra paramters for msc_process_response_headers() */
86
- if (r -> err_status ) {
87
- status = r -> err_status ;
85
+ if (r -> http_version < NGX_HTTP_VERSION_10 ) {
86
+ http_protocol = "HTTP/0.9" ;
87
+ } else if (r -> http_version < NGX_HTTP_VERSION_20 ) {
88
+ http_protocol = "HTTP/1.1" ;
88
89
} else {
89
- status = r -> headers_out . status ;
90
+ http_protocol = ( char * ) r -> http_protocol . data ;
90
91
}
91
92
92
- /*
93
- * NGINX always sends HTTP response with HTTP/1.1, except cases when
94
- * HTTP V2 module is enabled, and request has been posted with HTTP/2.0.
95
- */
96
- http_response_ver = "HTTP 1.1" ;
97
- #if (NGX_HTTP_V2 )
98
- if (r -> stream ) {
99
- http_response_ver = "HTTP 2.0" ;
100
- }
101
- #endif
102
-
103
93
old_pool = ngx_http_modsecurity_pcre_malloc_init (r -> pool );
104
- msc_process_response_headers (ctx -> modsec_transaction , status , http_response_ver );
94
+ msc_process_response_headers (ctx -> modsec_transaction , r -> headers_out .status ,
95
+ http_protocol );
105
96
ngx_http_modsecurity_pcre_malloc_done (old_pool );
106
97
rc = ngx_http_modsecurity_process_intervention (ctx -> modsec_transaction , r , 0 );
107
98
if (r -> error_page ) {
0 commit comments