Welcome! Log In Create A New Profile

Advanced

[PATCH] Always use default server configs for large buffers allocation

Daniil Bondarev
February 16, 2017 08:02PM
# HG changeset patch
# User Daniil Bondarev <bondarev@amazon.com>
# Date 1485286710 28800
# Tue Jan 24 11:38:30 2017 -0800
# Node ID 8cd694e06443aaa1ed0601108681fa1c6f7297e0
# Parent d84f48e571e449ee6c072a8d52cdea8e06b88ef7
Always use default server configs for large buffers allocation

Single http connection can flip between default server and virtual
servers: depending on parsed Host header for a current request nginx
changes current request configs. Currently this behavior might cause
buffer overrun while adding new buffer to hc->busy, if hc->busy was
allocated with config containing fewer large_client_header_buffers than
the current one.

This change makes nginx to always use large_client_header_buffers from
http_connection config, which is default server config.

diff -r d84f48e571e4 -r 8cd694e06443 src/http/ngx_http_request.c
--- a/src/http/ngx_http_request.c Tue Jan 24 17:02:19 2017 +0300
+++ b/src/http/ngx_http_request.c Tue Jan 24 11:38:30 2017 -0800
@@ -1447,7 +1447,9 @@ ngx_http_alloc_large_header_buffer(ngx_h

old = request_line ? r->request_start : r->header_name_start;

- cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
+ hc = r->http_connection;
+
+ cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module);

if (r->state != 0
&& (size_t) (r->header_in->pos - old)
@@ -1456,8 +1458,6 @@ ngx_http_alloc_large_header_buffer(ngx_h
return NGX_DECLINED;
}

- hc = r->http_connection;
-
if (hc->nfree) {
b = hc->free[--hc->nfree];
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Always use default server configs for large buffers allocation

Daniil Bondarev 835 February 16, 2017 08:02PM

Re: [PATCH] Always use default server configs for large buffers allocation

Maxim Dounin 385 February 18, 2017 09:12PM

Re: [PATCH] Always use default server configs for large buffers allocation

Daniil Bondarev 358 February 20, 2017 02:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 288
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready