diff --git a/CHANGES b/CHANGES index 9a58e9b..8c4233d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ v1.0.x - YYYY-MMM-DD (To be released) -------------------- + - Support http protocol versions besides 0.9, 1.0, 1.1, 2.0 + [Issue #224 - @HQuest, @martinhsv] - Support for building with nginx configured with PCRE2 [Issue #260 - @defanator] diff --git a/src/ngx_http_modsecurity_rewrite.c b/src/ngx_http_modsecurity_rewrite.c index f6f8d41..ebf115e 100644 --- a/src/ngx_http_modsecurity_rewrite.c +++ b/src/ngx_http_modsecurity_rewrite.c @@ -138,7 +138,15 @@ ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r) break; #endif default : - http_version = "1.0"; + http_version = ngx_str_to_char(r->http_protocol, r->pool); + if (http_version == (char*)-1) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + if ((http_version != NULL) && (strlen(http_version) > 5) && (!strncmp("HTTP/", http_version, 5))) { + http_version += 5; + } else { + http_version = "1.0"; + } break; }