diff options
| author | Roman Arutyunyan <arut@nginx.com> | 2025-09-23 15:03:52 +0400 |
|---|---|---|
| committer | Roman Arutyunyan <arutyunyan.roman@gmail.com> | 2025-10-23 18:40:05 +0400 |
| commit | 42ca3a4576a32d0a912b0bba4088b8169f55ab2d (patch) | |
| tree | 9277aa698778e2b82eaed13d6196ac21e1c0c990 /src/http/ngx_http_request.c | |
| parent | c8c7beb96f61e2251abbc345357116131cf91c22 (diff) | |
| download | nginx-42ca3a4576a32d0a912b0bba4088b8169f55ab2d.tar.gz nginx-42ca3a4576a32d0a912b0bba4088b8169f55ab2d.tar.bz2 | |
CONNECT method support for HTTP/1.1.
The change allows modules to use the CONNECT method with HTTP/1.1 requests.
To do so, they need to set the "allow_connect" flag in the core server
configuration.
Diffstat (limited to 'src/http/ngx_http_request.c')
| -rw-r--r-- | src/http/ngx_http_request.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 7f2d04783..533af452f 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -1997,6 +1997,8 @@ ngx_http_process_user_agent(ngx_http_request_t *r, ngx_table_elt_t *h, static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r) { + ngx_http_core_srv_conf_t *cscf; + if (r->headers_in.server.len == 0 && ngx_http_set_virtual_server(r, &r->headers_in.server) == NGX_ERROR) @@ -2065,7 +2067,11 @@ ngx_http_process_request_header(ngx_http_request_t *r) } } - if (r->method == NGX_HTTP_CONNECT) { + cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); + + if (r->method == NGX_HTTP_CONNECT + && (r->http_version != NGX_HTTP_VERSION_11 || !cscf->allow_connect)) + { ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "client sent CONNECT method"); ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); |
