Skip to content

Commit

Permalink
Merge pull request #225 from martinhsv/master
Browse files Browse the repository at this point in the history
Support http protocol versions besides 0.9, 1.0, 1.1, 2.0
  • Loading branch information
martinhsv authored Apr 26, 2022
2 parents 1c32794 + 755011c commit 1c45440
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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]

Expand Down
10 changes: 9 additions & 1 deletion src/ngx_http_modsecurity_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1c45440

Please sign in to comment.