2002-08-06 12:39:45 -04:00
|
|
|
|
2004-09-28 04:34:51 -04:00
|
|
|
/*
|
2004-09-29 12:00:49 -04:00
|
|
|
* Copyright (C) Igor Sysoev
|
2012-01-18 12:07:43 -03:00
|
|
|
* Copyright (C) Nginx, Inc.
|
2004-09-28 04:34:51 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-08-06 12:39:45 -04:00
|
|
|
#include <ngx_config.h>
|
2002-08-26 11:18:19 -04:00
|
|
|
#include <ngx_core.h>
|
2002-08-06 12:39:45 -04:00
|
|
|
#include <ngx_http.h>
|
|
|
|
|
2002-09-02 10:48:24 -04:00
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
static void ngx_http_wait_request_handler(ngx_event_t *ev);
|
2019-02-25 10:42:05 -03:00
|
|
|
static ngx_http_request_t *ngx_http_alloc_request(ngx_connection_t *c);
|
2003-05-12 11:52:24 -04:00
|
|
|
static void ngx_http_process_request_line(ngx_event_t *rev);
|
|
|
|
static void ngx_http_process_request_headers(ngx_event_t *rev);
|
|
|
|
static ssize_t ngx_http_read_request_header(ngx_http_request_t *r);
|
2004-09-23 02:32:00 -04:00
|
|
|
static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
|
2005-03-19 08:38:37 -04:00
|
|
|
ngx_uint_t request_line);
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
|
|
|
static ngx_int_t ngx_http_process_header_line(ngx_http_request_t *r,
|
|
|
|
ngx_table_elt_t *h, ngx_uint_t offset);
|
2005-06-15 14:33:41 -04:00
|
|
|
static ngx_int_t ngx_http_process_unique_header_line(ngx_http_request_t *r,
|
|
|
|
ngx_table_elt_t *h, ngx_uint_t offset);
|
2008-05-15 10:44:47 -04:00
|
|
|
static ngx_int_t ngx_http_process_host(ngx_http_request_t *r,
|
|
|
|
ngx_table_elt_t *h, ngx_uint_t offset);
|
2007-09-09 14:28:49 -04:00
|
|
|
static ngx_int_t ngx_http_process_connection(ngx_http_request_t *r,
|
|
|
|
ngx_table_elt_t *h, ngx_uint_t offset);
|
2008-05-13 05:18:58 -04:00
|
|
|
static ngx_int_t ngx_http_process_user_agent(ngx_http_request_t *r,
|
|
|
|
ngx_table_elt_t *h, ngx_uint_t offset);
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
static ngx_int_t ngx_http_find_virtual_server(ngx_connection_t *c,
|
|
|
|
ngx_http_virtual_names_t *virtual_names, ngx_str_t *host,
|
|
|
|
ngx_http_request_t *r, ngx_http_core_srv_conf_t **cscfp);
|
2003-05-12 11:52:24 -04:00
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
static void ngx_http_request_handler(ngx_event_t *ev);
|
2009-08-26 12:04:05 -04:00
|
|
|
static void ngx_http_terminate_request(ngx_http_request_t *r, ngx_int_t rc);
|
|
|
|
static void ngx_http_terminate_handler(ngx_http_request_t *r);
|
|
|
|
static void ngx_http_finalize_connection(ngx_http_request_t *r);
|
2005-06-23 09:41:06 -04:00
|
|
|
static ngx_int_t ngx_http_set_write_handler(ngx_http_request_t *r);
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
static void ngx_http_writer(ngx_http_request_t *r);
|
2008-12-08 11:23:20 -03:00
|
|
|
static void ngx_http_request_finalizer(ngx_http_request_t *r);
|
2003-05-12 11:52:24 -04:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
static void ngx_http_set_keepalive(ngx_http_request_t *r);
|
|
|
|
static void ngx_http_keepalive_handler(ngx_event_t *ev);
|
2020-11-06 17:44:54 -03:00
|
|
|
static void ngx_http_set_lingering_close(ngx_connection_t *c);
|
2003-05-13 12:02:32 -04:00
|
|
|
static void ngx_http_lingering_close_handler(ngx_event_t *ev);
|
2006-02-16 12:26:46 -03:00
|
|
|
static ngx_int_t ngx_http_post_action(ngx_http_request_t *r);
|
2008-09-27 11:08:02 -04:00
|
|
|
static void ngx_http_log_request(ngx_http_request_t *r);
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2021-09-17 10:32:23 -03:00
|
|
|
static u_char *ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len);
|
2006-07-11 09:20:19 -04:00
|
|
|
static u_char *ngx_http_log_error_handler(ngx_http_request_t *r,
|
|
|
|
ngx_http_request_t *sr, u_char *buf, size_t len);
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2005-09-06 12:09:32 -04:00
|
|
|
#if (NGX_HTTP_SSL)
|
|
|
|
static void ngx_http_ssl_handshake(ngx_event_t *rev);
|
2005-09-30 10:41:25 -04:00
|
|
|
static void ngx_http_ssl_handshake_handler(ngx_connection_t *c);
|
2005-09-06 12:09:32 -04:00
|
|
|
#endif
|
|
|
|
|
2002-08-06 12:39:45 -04:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
static char *ngx_http_client_errors[] = {
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
/* NGX_HTTP_PARSE_INVALID_METHOD */
|
|
|
|
"client sent invalid method",
|
2004-11-11 11:07:14 -03:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
/* NGX_HTTP_PARSE_INVALID_REQUEST */
|
|
|
|
"client sent invalid request",
|
|
|
|
|
2017-04-25 17:39:13 -03:00
|
|
|
/* NGX_HTTP_PARSE_INVALID_VERSION */
|
|
|
|
"client sent invalid version",
|
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
/* NGX_HTTP_PARSE_INVALID_09_METHOD */
|
|
|
|
"client sent invalid method in HTTP/0.9 request"
|
2002-08-29 12:59:54 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-09-06 14:45:00 -04:00
|
|
|
ngx_http_header_t ngx_http_headers_in[] = {
|
2008-08-19 15:40:45 -04:00
|
|
|
{ ngx_string("Host"), offsetof(ngx_http_headers_in_t, host),
|
|
|
|
ngx_http_process_host },
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2008-08-19 15:40:45 -04:00
|
|
|
{ ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection),
|
|
|
|
ngx_http_process_connection },
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2004-09-06 14:45:00 -04:00
|
|
|
{ ngx_string("If-Modified-Since"),
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
offsetof(ngx_http_headers_in_t, if_modified_since),
|
2007-08-29 11:32:49 -04:00
|
|
|
ngx_http_process_unique_header_line },
|
2010-12-06 08:11:05 -03:00
|
|
|
|
|
|
|
{ ngx_string("If-Unmodified-Since"),
|
|
|
|
offsetof(ngx_http_headers_in_t, if_unmodified_since),
|
|
|
|
ngx_http_process_unique_header_line },
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2012-07-07 17:20:27 -04:00
|
|
|
{ ngx_string("If-Match"),
|
|
|
|
offsetof(ngx_http_headers_in_t, if_match),
|
|
|
|
ngx_http_process_unique_header_line },
|
|
|
|
|
|
|
|
{ ngx_string("If-None-Match"),
|
|
|
|
offsetof(ngx_http_headers_in_t, if_none_match),
|
|
|
|
ngx_http_process_unique_header_line },
|
|
|
|
|
2008-08-19 15:40:45 -04:00
|
|
|
{ ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent),
|
|
|
|
ngx_http_process_user_agent },
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
|
|
|
{ ngx_string("Referer"), offsetof(ngx_http_headers_in_t, referer),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
|
2004-09-06 14:45:00 -04:00
|
|
|
{ ngx_string("Content-Length"),
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
offsetof(ngx_http_headers_in_t, content_length),
|
2005-06-15 14:33:41 -04:00
|
|
|
ngx_http_process_unique_header_line },
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2016-05-16 13:37:23 -04:00
|
|
|
{ ngx_string("Content-Range"),
|
|
|
|
offsetof(ngx_http_headers_in_t, content_range),
|
|
|
|
ngx_http_process_unique_header_line },
|
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 10:03:58 -03:00
|
|
|
{ ngx_string("Content-Type"),
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
offsetof(ngx_http_headers_in_t, content_type),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
|
|
|
|
{ ngx_string("Range"), offsetof(ngx_http_headers_in_t, range),
|
|
|
|
ngx_http_process_header_line },
|
2004-09-06 14:45:00 -04:00
|
|
|
|
2007-11-09 12:41:35 -03:00
|
|
|
{ ngx_string("If-Range"),
|
|
|
|
offsetof(ngx_http_headers_in_t, if_range),
|
|
|
|
ngx_http_process_unique_header_line },
|
|
|
|
|
2005-11-26 07:11:11 -03:00
|
|
|
{ ngx_string("Transfer-Encoding"),
|
|
|
|
offsetof(ngx_http_headers_in_t, transfer_encoding),
|
2020-02-20 10:19:29 -03:00
|
|
|
ngx_http_process_unique_header_line },
|
2005-11-26 07:11:11 -03:00
|
|
|
|
2018-03-17 17:04:25 -03:00
|
|
|
{ ngx_string("TE"),
|
|
|
|
offsetof(ngx_http_headers_in_t, te),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
|
2008-06-26 09:00:39 -04:00
|
|
|
{ ngx_string("Expect"),
|
|
|
|
offsetof(ngx_http_headers_in_t, expect),
|
|
|
|
ngx_http_process_unique_header_line },
|
|
|
|
|
2013-02-18 10:50:52 -03:00
|
|
|
{ ngx_string("Upgrade"),
|
|
|
|
offsetof(ngx_http_headers_in_t, upgrade),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
|
2018-02-15 11:51:26 -03:00
|
|
|
#if (NGX_HTTP_GZIP || NGX_HTTP_HEADERS)
|
2004-09-06 14:45:00 -04:00
|
|
|
{ ngx_string("Accept-Encoding"),
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
offsetof(ngx_http_headers_in_t, accept_encoding),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
|
|
|
|
{ ngx_string("Via"), offsetof(ngx_http_headers_in_t, via),
|
|
|
|
ngx_http_process_header_line },
|
2004-09-06 14:45:00 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
{ ngx_string("Authorization"),
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
offsetof(ngx_http_headers_in_t, authorization),
|
2005-06-15 14:33:41 -04:00
|
|
|
ngx_http_process_unique_header_line },
|
2004-09-06 14:45:00 -04:00
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
{ ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive),
|
|
|
|
ngx_http_process_header_line },
|
2004-09-06 14:45:00 -04:00
|
|
|
|
2012-06-21 07:02:22 -04:00
|
|
|
#if (NGX_HTTP_X_FORWARDED_FOR)
|
2004-09-06 14:45:00 -04:00
|
|
|
{ ngx_string("X-Forwarded-For"),
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
offsetof(ngx_http_headers_in_t, x_forwarded_for),
|
2022-05-30 14:25:35 -04:00
|
|
|
ngx_http_process_header_line },
|
2004-09-06 14:45:00 -04:00
|
|
|
#endif
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 10:03:58 -03:00
|
|
|
|
nginx-0.3.8-RELEASE import
*) Security: nginx now checks URI got from a backend in
"X-Accel-Redirect" header line or in SSI file for the "/../" paths
and zeroes.
*) Change: nginx now does not treat the empty user name in the
"Authorization" header line as valid one.
*) Feature: the "ssl_session_timeout" directives of the
ngx_http_ssl_module and ngx_imap_ssl_module.
*) Feature: the "auth_http_header" directive of the
ngx_imap_auth_http_module.
*) Feature: the "add_header" directive.
*) Feature: the ngx_http_realip_module.
*) Feature: the new variables to use in the "log_format" directive:
$bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri,
$request_time, $request_length, $upstream_status,
$upstream_response_time, $gzip_ratio, $uid_got, $uid_set,
$connection, $pipe, and $msec. The parameters in the "%name" form
will be canceled soon.
*) Change: now the false variable values in the "if" directive are the
empty string "" and string starting with "0".
*) Bugfix: while using proxied or FastCGI-server nginx may leave
connections and temporary files with client requests in open state.
*) Bugfix: the worker processes did not flush the buffered logs on
graceful exit.
*) Bugfix: if the request URI was changes by the "rewrite" directive
and the request was proxied in location given by regular expression,
then the incorrect request was transferred to backend; the bug had
appeared in 0.2.6.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" header.
*) Bugfix: nginx may stop to accept requests if the "rtsig" method and
several worker processes were used.
*) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in
SSI commands.
*) Bugfix: if the response was ended just after the SSI command and
gzipping was used, then the response did not transferred complete or
did not transferred at all.
2005-11-09 14:25:55 -03:00
|
|
|
#if (NGX_HTTP_REALIP)
|
|
|
|
{ ngx_string("X-Real-IP"),
|
|
|
|
offsetof(ngx_http_headers_in_t, x_real_ip),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
#endif
|
|
|
|
|
2005-02-16 10:40:36 -03:00
|
|
|
#if (NGX_HTTP_HEADERS)
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
{ ngx_string("Accept"), offsetof(ngx_http_headers_in_t, accept),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
|
2005-02-16 10:40:36 -03:00
|
|
|
{ ngx_string("Accept-Language"),
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
offsetof(ngx_http_headers_in_t, accept_language),
|
|
|
|
ngx_http_process_header_line },
|
2005-02-16 10:40:36 -03:00
|
|
|
#endif
|
|
|
|
|
2006-04-19 11:30:56 -04:00
|
|
|
#if (NGX_HTTP_DAV)
|
|
|
|
{ ngx_string("Depth"), offsetof(ngx_http_headers_in_t, depth),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
|
|
|
|
{ ngx_string("Destination"), offsetof(ngx_http_headers_in_t, destination),
|
|
|
|
ngx_http_process_header_line },
|
2006-08-30 06:39:17 -04:00
|
|
|
|
2007-01-18 18:11:23 -03:00
|
|
|
{ ngx_string("Overwrite"), offsetof(ngx_http_headers_in_t, overwrite),
|
|
|
|
ngx_http_process_header_line },
|
|
|
|
|
2006-08-30 06:39:17 -04:00
|
|
|
{ ngx_string("Date"), offsetof(ngx_http_headers_in_t, date),
|
|
|
|
ngx_http_process_header_line },
|
2006-04-19 11:30:56 -04:00
|
|
|
#endif
|
|
|
|
|
2022-05-30 14:25:33 -04:00
|
|
|
{ ngx_string("Cookie"), offsetof(ngx_http_headers_in_t, cookie),
|
2022-05-30 14:25:35 -04:00
|
|
|
ngx_http_process_header_line },
|
2004-09-06 14:45:00 -04:00
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
{ ngx_null_string, 0, NULL }
|
|
|
|
};
|
2003-10-27 05:53:49 -03:00
|
|
|
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
void
|
|
|
|
ngx_http_init_connection(ngx_connection_t *c)
|
2002-08-06 12:39:45 -04:00
|
|
|
{
|
2021-01-19 14:32:00 -03:00
|
|
|
ngx_uint_t i;
|
|
|
|
ngx_event_t *rev;
|
|
|
|
struct sockaddr_in *sin;
|
|
|
|
ngx_http_port_t *port;
|
|
|
|
ngx_http_in_addr_t *addr;
|
|
|
|
ngx_http_log_ctx_t *ctx;
|
|
|
|
ngx_http_connection_t *hc;
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
2013-02-27 13:53:01 -03:00
|
|
|
#if (NGX_HAVE_INET6)
|
2021-01-19 14:32:00 -03:00
|
|
|
struct sockaddr_in6 *sin6;
|
|
|
|
ngx_http_in6_addr_t *addr6;
|
2013-02-27 13:53:01 -03:00
|
|
|
#endif
|
|
|
|
|
2020-07-21 16:09:22 -04:00
|
|
|
hc = ngx_pcalloc(c->pool, sizeof(ngx_http_connection_t));
|
2013-02-27 13:53:01 -03:00
|
|
|
if (hc == NULL) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
c->data = hc;
|
|
|
|
|
|
|
|
/* find the server configuration for the address:port */
|
|
|
|
|
|
|
|
port = c->listening->servers;
|
|
|
|
|
|
|
|
if (port->naddrs > 1) {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* there are several addresses on this port and one of them
|
|
|
|
* is an "*:port" wildcard so getsockname() in ngx_http_server_addr()
|
|
|
|
* is required to determine a server address
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (c->local_sockaddr->sa_family) {
|
|
|
|
|
|
|
|
#if (NGX_HAVE_INET6)
|
|
|
|
case AF_INET6:
|
|
|
|
sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
|
|
|
|
|
|
|
|
addr6 = port->addrs;
|
|
|
|
|
|
|
|
/* the last address is "*" */
|
|
|
|
|
|
|
|
for (i = 0; i < port->naddrs - 1; i++) {
|
|
|
|
if (ngx_memcmp(&addr6[i].addr6, &sin6->sin6_addr, 16) == 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hc->addr_conf = &addr6[i].conf;
|
|
|
|
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default: /* AF_INET */
|
|
|
|
sin = (struct sockaddr_in *) c->local_sockaddr;
|
|
|
|
|
|
|
|
addr = port->addrs;
|
|
|
|
|
|
|
|
/* the last address is "*" */
|
|
|
|
|
|
|
|
for (i = 0; i < port->naddrs - 1; i++) {
|
|
|
|
if (addr[i].addr == sin->sin_addr.s_addr) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hc->addr_conf = &addr[i].conf;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
switch (c->local_sockaddr->sa_family) {
|
|
|
|
|
|
|
|
#if (NGX_HAVE_INET6)
|
|
|
|
case AF_INET6:
|
|
|
|
addr6 = port->addrs;
|
|
|
|
hc->addr_conf = &addr6[0].conf;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default: /* AF_INET */
|
|
|
|
addr = port->addrs;
|
|
|
|
hc->addr_conf = &addr[0].conf;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-10-04 13:58:04 -04:00
|
|
|
|
2013-02-27 14:12:48 -03:00
|
|
|
/* the default server configuration for the address:port */
|
|
|
|
hc->conf_ctx = hc->addr_conf->default_server->ctx;
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
ctx = ngx_palloc(c->pool, sizeof(ngx_http_log_ctx_t));
|
|
|
|
if (ctx == NULL) {
|
2003-05-12 11:52:24 -04:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
2003-01-30 04:28:09 -03:00
|
|
|
}
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2007-12-30 05:01:50 -03:00
|
|
|
ctx->connection = c;
|
2004-11-11 11:07:14 -03:00
|
|
|
ctx->request = NULL;
|
2006-07-11 09:20:19 -04:00
|
|
|
ctx->current_request = NULL;
|
2005-01-25 09:27:35 -03:00
|
|
|
|
|
|
|
c->log->connection = c->number;
|
2002-08-26 11:18:19 -04:00
|
|
|
c->log->handler = ngx_http_log_error;
|
2005-01-25 09:27:35 -03:00
|
|
|
c->log->data = ctx;
|
2013-03-07 14:21:50 -03:00
|
|
|
c->log->action = "waiting for request";
|
2005-01-25 09:27:35 -03:00
|
|
|
|
2004-02-10 13:23:38 -03:00
|
|
|
c->log_error = NGX_ERROR_INFO;
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2003-05-12 11:52:24 -04:00
|
|
|
rev = c->read;
|
2013-03-07 14:21:50 -03:00
|
|
|
rev->handler = ngx_http_wait_request_handler;
|
2005-10-24 12:09:41 -03:00
|
|
|
c->write->handler = ngx_http_empty_handler;
|
2004-02-09 04:46:43 -03:00
|
|
|
|
2015-09-11 14:13:06 -03:00
|
|
|
#if (NGX_HTTP_V2)
|
|
|
|
if (hc->addr_conf->http2) {
|
|
|
|
rev->handler = ngx_http_v2_init;
|
2013-03-20 07:36:57 -03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
#if (NGX_HTTP_V3)
|
2023-02-27 07:00:56 -03:00
|
|
|
if (hc->addr_conf->quic) {
|
2022-08-22 06:09:03 -04:00
|
|
|
ngx_http_v3_init_stream(c);
|
2021-01-22 10:34:06 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
#if (NGX_HTTP_SSL)
|
|
|
|
{
|
|
|
|
ngx_http_ssl_srv_conf_t *sscf;
|
|
|
|
|
|
|
|
sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
|
|
|
|
|
|
|
|
if (sscf->enable || hc->addr_conf->ssl) {
|
|
|
|
hc->ssl = 1;
|
2018-04-24 09:29:01 -03:00
|
|
|
c->log->action = "SSL handshaking";
|
2013-02-27 14:21:21 -03:00
|
|
|
rev->handler = ngx_http_ssl_handshake;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-03-17 10:41:24 -03:00
|
|
|
if (hc->addr_conf->proxy_protocol) {
|
|
|
|
hc->proxy_protocol = 1;
|
|
|
|
c->log->action = "reading PROXY protocol";
|
|
|
|
}
|
|
|
|
|
2003-03-20 12:09:44 -04:00
|
|
|
if (rev->ready) {
|
2015-04-23 08:17:40 -03:00
|
|
|
/* the deferred accept(), iocp */
|
2004-03-31 11:26:46 -04:00
|
|
|
|
2006-02-08 12:33:12 -03:00
|
|
|
if (ngx_use_accept_mutex) {
|
2005-10-19 09:33:58 -03:00
|
|
|
ngx_post_event(rev, &ngx_posted_events);
|
2004-03-31 11:26:46 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
rev->handler(rev);
|
2003-05-12 11:52:24 -04:00
|
|
|
return;
|
2003-01-26 18:08:14 -03:00
|
|
|
}
|
2003-02-06 14:21:13 -03:00
|
|
|
|
2021-01-19 14:32:00 -03:00
|
|
|
cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module);
|
|
|
|
|
|
|
|
ngx_add_timer(rev, cscf->client_header_timeout);
|
2013-03-15 16:49:54 -03:00
|
|
|
ngx_reusable_connection(c, 1);
|
2003-01-26 18:08:14 -03:00
|
|
|
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
2003-10-10 11:10:50 -04:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
2002-08-06 12:39:45 -04:00
|
|
|
}
|
|
|
|
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
static void
|
|
|
|
ngx_http_wait_request_handler(ngx_event_t *rev)
|
|
|
|
{
|
2014-03-17 10:41:24 -03:00
|
|
|
u_char *p;
|
2013-03-07 14:21:50 -03:00
|
|
|
size_t size;
|
|
|
|
ssize_t n;
|
|
|
|
ngx_buf_t *b;
|
|
|
|
ngx_connection_t *c;
|
|
|
|
ngx_http_connection_t *hc;
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
|
|
|
|
|
|
|
c = rev->data;
|
|
|
|
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http wait request handler");
|
|
|
|
|
|
|
|
if (rev->timedout) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-15 16:49:54 -03:00
|
|
|
if (c->close) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
hc = c->data;
|
|
|
|
cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module);
|
|
|
|
|
|
|
|
size = cscf->client_header_buffer_size;
|
|
|
|
|
|
|
|
b = c->buffer;
|
|
|
|
|
|
|
|
if (b == NULL) {
|
|
|
|
b = ngx_create_temp_buf(c->pool, size);
|
|
|
|
if (b == NULL) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
c->buffer = b;
|
|
|
|
|
|
|
|
} else if (b->start == NULL) {
|
|
|
|
|
|
|
|
b->start = ngx_palloc(c->pool, size);
|
|
|
|
if (b->start == NULL) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
b->pos = b->start;
|
|
|
|
b->last = b->start;
|
|
|
|
b->end = b->last + size;
|
|
|
|
}
|
|
|
|
|
|
|
|
n = c->recv(c, b->last, size);
|
|
|
|
|
|
|
|
if (n == NGX_AGAIN) {
|
|
|
|
|
|
|
|
if (!rev->timer_set) {
|
2021-01-19 14:32:00 -03:00
|
|
|
ngx_add_timer(rev, cscf->client_header_timeout);
|
2013-03-15 16:49:54 -03:00
|
|
|
ngx_reusable_connection(c, 1);
|
2013-03-07 14:21:50 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We are trying to not hold c->buffer's memory for an idle connection.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (ngx_pfree(c->pool, b->start) == NGX_OK) {
|
|
|
|
b->start = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n == NGX_ERROR) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n == 0) {
|
2013-03-12 10:38:04 -03:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
2013-03-07 14:21:50 -03:00
|
|
|
"client closed connection");
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
b->last += n;
|
|
|
|
|
2014-03-17 10:41:24 -03:00
|
|
|
if (hc->proxy_protocol) {
|
|
|
|
hc->proxy_protocol = 0;
|
|
|
|
|
2015-06-16 07:45:19 -03:00
|
|
|
p = ngx_proxy_protocol_read(c, b->pos, b->last);
|
2014-03-17 10:41:24 -03:00
|
|
|
|
|
|
|
if (p == NULL) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
b->pos = p;
|
|
|
|
|
|
|
|
if (b->pos == b->last) {
|
|
|
|
c->log->action = "waiting for request";
|
|
|
|
b->pos = b->start;
|
|
|
|
b->last = b->start;
|
|
|
|
ngx_post_event(rev, &ngx_posted_events);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
c->log->action = "reading client request line";
|
|
|
|
|
2013-03-15 16:49:54 -03:00
|
|
|
ngx_reusable_connection(c, 0);
|
|
|
|
|
2013-03-07 15:14:27 -03:00
|
|
|
c->data = ngx_http_create_request(c);
|
|
|
|
if (c->data == NULL) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rev->handler = ngx_http_process_request_line;
|
|
|
|
ngx_http_process_request_line(rev);
|
2013-03-07 14:21:50 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-20 07:36:57 -03:00
|
|
|
ngx_http_request_t *
|
2013-03-07 15:14:27 -03:00
|
|
|
ngx_http_create_request(ngx_connection_t *c)
|
2019-02-25 10:42:05 -03:00
|
|
|
{
|
|
|
|
ngx_http_request_t *r;
|
|
|
|
ngx_http_log_ctx_t *ctx;
|
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
|
|
|
|
|
|
|
r = ngx_http_alloc_request(c);
|
|
|
|
if (r == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
c->requests++;
|
|
|
|
|
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
|
|
|
|
|
|
|
ngx_set_connection_log(c, clcf->error_log);
|
|
|
|
|
|
|
|
ctx = c->log->data;
|
|
|
|
ctx->request = r;
|
|
|
|
ctx->current_request = r;
|
|
|
|
|
|
|
|
#if (NGX_STAT_STUB)
|
|
|
|
(void) ngx_atomic_fetch_add(ngx_stat_reading, 1);
|
|
|
|
r->stat_reading = 1;
|
|
|
|
(void) ngx_atomic_fetch_add(ngx_stat_requests, 1);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static ngx_http_request_t *
|
|
|
|
ngx_http_alloc_request(ngx_connection_t *c)
|
2002-08-06 12:39:45 -04:00
|
|
|
{
|
2013-03-01 11:55:42 -03:00
|
|
|
ngx_pool_t *pool;
|
2007-04-21 03:50:19 -04:00
|
|
|
ngx_time_t *tp;
|
nginx-0.3.8-RELEASE import
*) Security: nginx now checks URI got from a backend in
"X-Accel-Redirect" header line or in SSI file for the "/../" paths
and zeroes.
*) Change: nginx now does not treat the empty user name in the
"Authorization" header line as valid one.
*) Feature: the "ssl_session_timeout" directives of the
ngx_http_ssl_module and ngx_imap_ssl_module.
*) Feature: the "auth_http_header" directive of the
ngx_imap_auth_http_module.
*) Feature: the "add_header" directive.
*) Feature: the ngx_http_realip_module.
*) Feature: the new variables to use in the "log_format" directive:
$bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri,
$request_time, $request_length, $upstream_status,
$upstream_response_time, $gzip_ratio, $uid_got, $uid_set,
$connection, $pipe, and $msec. The parameters in the "%name" form
will be canceled soon.
*) Change: now the false variable values in the "if" directive are the
empty string "" and string starting with "0".
*) Bugfix: while using proxied or FastCGI-server nginx may leave
connections and temporary files with client requests in open state.
*) Bugfix: the worker processes did not flush the buffered logs on
graceful exit.
*) Bugfix: if the request URI was changes by the "rewrite" directive
and the request was proxied in location given by regular expression,
then the incorrect request was transferred to backend; the bug had
appeared in 0.2.6.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" header.
*) Bugfix: nginx may stop to accept requests if the "rtsig" method and
several worker processes were used.
*) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in
SSI commands.
*) Bugfix: if the response was ended just after the SSI command and
gzipping was used, then the response did not transferred complete or
did not transferred at all.
2005-11-09 14:25:55 -03:00
|
|
|
ngx_http_request_t *r;
|
|
|
|
ngx_http_connection_t *hc;
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
|
|
|
ngx_http_core_main_conf_t *cmcf;
|
2002-08-06 12:39:45 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
hc = c->data;
|
2004-09-21 01:38:28 -04:00
|
|
|
|
2013-03-01 11:55:42 -03:00
|
|
|
cscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_core_module);
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2013-03-01 11:55:42 -03:00
|
|
|
pool = ngx_create_pool(cscf->request_pool_size, c->log);
|
|
|
|
if (pool == NULL) {
|
2013-03-07 15:14:27 -03:00
|
|
|
return NULL;
|
2013-03-01 11:55:42 -03:00
|
|
|
}
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2013-03-01 11:55:42 -03:00
|
|
|
r = ngx_pcalloc(pool, sizeof(ngx_http_request_t));
|
|
|
|
if (r == NULL) {
|
|
|
|
ngx_destroy_pool(pool);
|
2013-03-07 15:14:27 -03:00
|
|
|
return NULL;
|
2013-03-01 11:55:42 -03:00
|
|
|
}
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2013-03-01 11:55:42 -03:00
|
|
|
r->pool = pool;
|
2004-09-21 01:38:28 -04:00
|
|
|
|
|
|
|
r->http_connection = hc;
|
2004-06-24 03:53:37 -04:00
|
|
|
r->signature = NGX_HTTP_MODULE;
|
2007-12-29 13:00:34 -03:00
|
|
|
r->connection = c;
|
|
|
|
|
2013-02-27 14:12:48 -03:00
|
|
|
r->main_conf = hc->conf_ctx->main_conf;
|
|
|
|
r->srv_conf = hc->conf_ctx->srv_conf;
|
|
|
|
r->loc_conf = hc->conf_ctx->loc_conf;
|
2003-05-27 08:18:54 -04:00
|
|
|
|
2009-07-24 15:20:29 -04:00
|
|
|
r->read_event_handler = ngx_http_block_reading;
|
2004-07-16 13:11:43 -04:00
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
r->header_in = hc->busy ? hc->busy->buf : c->buffer;
|
2004-03-23 02:01:52 -04:00
|
|
|
|
2004-09-06 14:45:00 -04:00
|
|
|
if (ngx_list_init(&r->headers_out.headers, r->pool, 20,
|
2005-11-26 07:11:11 -03:00
|
|
|
sizeof(ngx_table_elt_t))
|
2009-02-24 07:42:23 -03:00
|
|
|
!= NGX_OK)
|
2004-09-05 15:54:02 -04:00
|
|
|
{
|
2009-05-29 07:42:55 -04:00
|
|
|
ngx_destroy_pool(r->pool);
|
2013-03-07 15:14:27 -03:00
|
|
|
return NULL;
|
2004-09-05 15:54:02 -04:00
|
|
|
}
|
|
|
|
|
2017-03-24 07:37:34 -03:00
|
|
|
if (ngx_list_init(&r->headers_out.trailers, r->pool, 4,
|
|
|
|
sizeof(ngx_table_elt_t))
|
|
|
|
!= NGX_OK)
|
|
|
|
{
|
|
|
|
ngx_destroy_pool(r->pool);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-05-12 11:52:24 -04:00
|
|
|
r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
|
|
|
|
if (r->ctx == NULL) {
|
2009-05-29 07:42:55 -04:00
|
|
|
ngx_destroy_pool(r->pool);
|
2013-03-07 15:14:27 -03:00
|
|
|
return NULL;
|
2003-05-12 11:52:24 -04:00
|
|
|
}
|
2002-09-11 11:18:33 -04:00
|
|
|
|
nginx-0.3.8-RELEASE import
*) Security: nginx now checks URI got from a backend in
"X-Accel-Redirect" header line or in SSI file for the "/../" paths
and zeroes.
*) Change: nginx now does not treat the empty user name in the
"Authorization" header line as valid one.
*) Feature: the "ssl_session_timeout" directives of the
ngx_http_ssl_module and ngx_imap_ssl_module.
*) Feature: the "auth_http_header" directive of the
ngx_imap_auth_http_module.
*) Feature: the "add_header" directive.
*) Feature: the ngx_http_realip_module.
*) Feature: the new variables to use in the "log_format" directive:
$bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri,
$request_time, $request_length, $upstream_status,
$upstream_response_time, $gzip_ratio, $uid_got, $uid_set,
$connection, $pipe, and $msec. The parameters in the "%name" form
will be canceled soon.
*) Change: now the false variable values in the "if" directive are the
empty string "" and string starting with "0".
*) Bugfix: while using proxied or FastCGI-server nginx may leave
connections and temporary files with client requests in open state.
*) Bugfix: the worker processes did not flush the buffered logs on
graceful exit.
*) Bugfix: if the request URI was changes by the "rewrite" directive
and the request was proxied in location given by regular expression,
then the incorrect request was transferred to backend; the bug had
appeared in 0.2.6.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" header.
*) Bugfix: nginx may stop to accept requests if the "rtsig" method and
several worker processes were used.
*) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in
SSI commands.
*) Bugfix: if the response was ended just after the SSI command and
gzipping was used, then the response did not transferred complete or
did not transferred at all.
2005-11-09 14:25:55 -03:00
|
|
|
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
|
|
|
|
|
|
|
r->variables = ngx_pcalloc(r->pool, cmcf->variables.nelts
|
|
|
|
* sizeof(ngx_http_variable_value_t));
|
|
|
|
if (r->variables == NULL) {
|
2009-05-29 07:42:55 -04:00
|
|
|
ngx_destroy_pool(r->pool);
|
2013-03-07 15:14:27 -03:00
|
|
|
return NULL;
|
nginx-0.3.8-RELEASE import
*) Security: nginx now checks URI got from a backend in
"X-Accel-Redirect" header line or in SSI file for the "/../" paths
and zeroes.
*) Change: nginx now does not treat the empty user name in the
"Authorization" header line as valid one.
*) Feature: the "ssl_session_timeout" directives of the
ngx_http_ssl_module and ngx_imap_ssl_module.
*) Feature: the "auth_http_header" directive of the
ngx_imap_auth_http_module.
*) Feature: the "add_header" directive.
*) Feature: the ngx_http_realip_module.
*) Feature: the new variables to use in the "log_format" directive:
$bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri,
$request_time, $request_length, $upstream_status,
$upstream_response_time, $gzip_ratio, $uid_got, $uid_set,
$connection, $pipe, and $msec. The parameters in the "%name" form
will be canceled soon.
*) Change: now the false variable values in the "if" directive are the
empty string "" and string starting with "0".
*) Bugfix: while using proxied or FastCGI-server nginx may leave
connections and temporary files with client requests in open state.
*) Bugfix: the worker processes did not flush the buffered logs on
graceful exit.
*) Bugfix: if the request URI was changes by the "rewrite" directive
and the request was proxied in location given by regular expression,
then the incorrect request was transferred to backend; the bug had
appeared in 0.2.6.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" header.
*) Bugfix: nginx may stop to accept requests if the "rtsig" method and
several worker processes were used.
*) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in
SSI commands.
*) Bugfix: if the response was ended just after the SSI command and
gzipping was used, then the response did not transferred complete or
did not transferred at all.
2005-11-09 14:25:55 -03:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
#if (NGX_HTTP_SSL)
|
SSL: SSL_sendfile() support with kernel TLS.
Requires OpenSSL 3.0 compiled with "enable-ktls" option. Further, KTLS
needs to be enabled in kernel, and in OpenSSL, either via OpenSSL
configuration file or with "ssl_conf_command Options KTLS;" in nginx
configuration.
On FreeBSD, kernel TLS is available starting with FreeBSD 13.0, and
can be enabled with "sysctl kern.ipc.tls.enable=1" and "kldload ktls_ocf"
to load a software backend, see man ktls(4) for details.
On Linux, kernel TLS is available starting with kernel 4.13 (at least 5.2
is recommended), and needs kernel compiled with CONFIG_TLS=y (with
CONFIG_TLS=m, which is used at least on Ubuntu 21.04 by default,
the tls module needs to be loaded with "modprobe tls").
2021-10-21 12:44:07 -03:00
|
|
|
if (c->ssl && !c->ssl->sendfile) {
|
2013-02-27 14:21:21 -03:00
|
|
|
r->main_filter_need_in_memory = 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-10-04 06:38:53 -04:00
|
|
|
r->main = r;
|
2009-08-26 12:04:05 -04:00
|
|
|
r->count = 1;
|
2005-10-04 06:38:53 -04:00
|
|
|
|
2007-04-21 03:50:19 -04:00
|
|
|
tp = ngx_timeofday();
|
|
|
|
r->start_sec = tp->sec;
|
|
|
|
r->start_msec = tp->msec;
|
2005-03-01 12:20:36 -03:00
|
|
|
|
2006-04-07 10:08:04 -04:00
|
|
|
r->method = NGX_HTTP_UNKNOWN;
|
2013-09-01 19:45:14 -04:00
|
|
|
r->http_version = NGX_HTTP_VERSION_10;
|
2006-04-07 10:08:04 -04:00
|
|
|
|
2003-04-25 10:43:13 -04:00
|
|
|
r->headers_in.content_length_n = -1;
|
2003-10-21 13:49:56 -03:00
|
|
|
r->headers_in.keep_alive_n = -1;
|
|
|
|
r->headers_out.content_length_n = -1;
|
2002-12-15 03:25:09 -03:00
|
|
|
r->headers_out.last_modified_time = -1;
|
|
|
|
|
2006-08-16 09:09:33 -04:00
|
|
|
r->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1;
|
|
|
|
r->subrequests = NGX_HTTP_MAX_SUBREQUESTS + 1;
|
|
|
|
|
2004-06-24 12:07:04 -04:00
|
|
|
r->http_state = NGX_HTTP_READING_REQUEST_STATE;
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
r->log_handler = ngx_http_log_error_handler;
|
2005-03-28 10:43:02 -04:00
|
|
|
|
2013-03-07 15:14:27 -03:00
|
|
|
return r;
|
2004-07-16 13:11:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if (NGX_HTTP_SSL)
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static void
|
|
|
|
ngx_http_ssl_handshake(ngx_event_t *rev)
|
2004-07-16 13:11:43 -04:00
|
|
|
{
|
2017-05-29 09:34:29 -04:00
|
|
|
u_char *p, buf[NGX_PROXY_PROTOCOL_MAX_HEADER + 1];
|
|
|
|
size_t size;
|
|
|
|
ssize_t n;
|
|
|
|
ngx_err_t err;
|
|
|
|
ngx_int_t rc;
|
|
|
|
ngx_connection_t *c;
|
|
|
|
ngx_http_connection_t *hc;
|
|
|
|
ngx_http_ssl_srv_conf_t *sscf;
|
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
2021-01-19 14:32:00 -03:00
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
2004-07-16 13:11:43 -04:00
|
|
|
|
|
|
|
c = rev->data;
|
2014-03-17 10:41:24 -03:00
|
|
|
hc = c->data;
|
2004-07-16 13:11:43 -04:00
|
|
|
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0,
|
|
|
|
"http check ssl handshake");
|
|
|
|
|
|
|
|
if (rev->timedout) {
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
|
2013-02-27 14:21:21 -03:00
|
|
|
ngx_http_close_connection(c);
|
2004-07-16 13:11:43 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-15 16:49:54 -03:00
|
|
|
if (c->close) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-17 10:41:24 -03:00
|
|
|
size = hc->proxy_protocol ? sizeof(buf) : 1;
|
|
|
|
|
|
|
|
n = recv(c->fd, (char *) buf, size, MSG_PEEK);
|
2004-07-16 13:11:43 -04:00
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
err = ngx_socket_errno;
|
2008-01-08 17:51:06 -03:00
|
|
|
|
2016-03-30 20:33:57 -03:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %z", n);
|
2008-01-08 17:51:06 -03:00
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
if (n == -1) {
|
|
|
|
if (err == NGX_EAGAIN) {
|
2015-03-02 15:15:46 -03:00
|
|
|
rev->ready = 0;
|
2013-02-27 14:21:21 -03:00
|
|
|
|
|
|
|
if (!rev->timer_set) {
|
2021-01-19 14:32:00 -03:00
|
|
|
cscf = ngx_http_get_module_srv_conf(hc->conf_ctx,
|
|
|
|
ngx_http_core_module);
|
|
|
|
ngx_add_timer(rev, cscf->client_header_timeout);
|
2013-03-15 16:49:54 -03:00
|
|
|
ngx_reusable_connection(c, 1);
|
2013-02-27 14:21:21 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2008-01-09 05:21:57 -03:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
ngx_connection_error(c, err, "recv() failed");
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
|
2004-07-16 13:11:43 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-17 10:41:24 -03:00
|
|
|
if (hc->proxy_protocol) {
|
|
|
|
hc->proxy_protocol = 0;
|
|
|
|
|
2015-06-16 07:45:19 -03:00
|
|
|
p = ngx_proxy_protocol_read(c, buf, buf + n);
|
2014-03-17 10:41:24 -03:00
|
|
|
|
|
|
|
if (p == NULL) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
size = p - buf;
|
|
|
|
|
|
|
|
if (c->recv(c, buf, size) != (ssize_t) size) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
c->log->action = "SSL handshaking";
|
|
|
|
|
|
|
|
if (n == (ssize_t) size) {
|
|
|
|
ngx_post_event(rev, &ngx_posted_events);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
n = 1;
|
|
|
|
buf[0] = *p;
|
|
|
|
}
|
|
|
|
|
2004-07-16 13:11:43 -04:00
|
|
|
if (n == 1) {
|
2010-07-05 09:35:20 -04:00
|
|
|
if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
|
2004-07-16 13:11:43 -04:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0,
|
2004-11-11 11:07:14 -03:00
|
|
|
"https ssl handshake: 0x%02Xd", buf[0]);
|
2004-07-16 13:11:43 -04:00
|
|
|
|
2017-05-29 09:34:29 -04:00
|
|
|
clcf = ngx_http_get_module_loc_conf(hc->conf_ctx,
|
|
|
|
ngx_http_core_module);
|
|
|
|
|
|
|
|
if (clcf->tcp_nodelay && ngx_tcp_nodelay(c) != NGX_OK) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
sscf = ngx_http_get_module_srv_conf(hc->conf_ctx,
|
|
|
|
ngx_http_ssl_module);
|
|
|
|
|
|
|
|
if (ngx_ssl_create_connection(&sscf->ssl, c, NGX_SSL_BUFFER)
|
|
|
|
!= NGX_OK)
|
|
|
|
{
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-27 13:03:21 -03:00
|
|
|
ngx_reusable_connection(c, 0);
|
|
|
|
|
2004-07-18 15:11:20 -04:00
|
|
|
rc = ngx_ssl_handshake(c);
|
|
|
|
|
2005-09-30 10:41:25 -04:00
|
|
|
if (rc == NGX_AGAIN) {
|
2008-01-04 06:32:12 -03:00
|
|
|
|
|
|
|
if (!rev->timer_set) {
|
2021-01-19 14:32:00 -03:00
|
|
|
cscf = ngx_http_get_module_srv_conf(hc->conf_ctx,
|
|
|
|
ngx_http_core_module);
|
|
|
|
ngx_add_timer(rev, cscf->client_header_timeout);
|
2008-01-04 06:32:12 -03:00
|
|
|
}
|
|
|
|
|
2005-09-30 10:41:25 -04:00
|
|
|
c->ssl->handler = ngx_http_ssl_handshake_handler;
|
2004-07-18 15:11:20 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-09-30 10:41:25 -04:00
|
|
|
ngx_http_ssl_handshake_handler(c);
|
|
|
|
|
|
|
|
return;
|
2013-02-27 14:21:21 -03:00
|
|
|
}
|
2004-07-16 13:11:43 -04:00
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "plain http");
|
2004-07-16 13:11:43 -04:00
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
c->log->action = "waiting for request";
|
2004-07-16 13:11:43 -04:00
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
rev->handler = ngx_http_wait_request_handler;
|
|
|
|
ngx_http_wait_request_handler(rev);
|
2008-09-01 10:19:01 -04:00
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0, "client closed connection");
|
|
|
|
ngx_http_close_connection(c);
|
2002-08-06 12:39:45 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 10:41:25 -04:00
|
|
|
|
|
|
|
static void
|
|
|
|
ngx_http_ssl_handshake_handler(ngx_connection_t *c)
|
|
|
|
{
|
|
|
|
if (c->ssl->handshaked) {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The majority of browsers do not send the "close notify" alert.
|
|
|
|
* Among them are MSIE, old Mozilla, Netscape 4, Konqueror,
|
|
|
|
* and Links. And what is more, MSIE ignores the server's alert.
|
|
|
|
*
|
|
|
|
* Opera and recent Mozilla send the alert.
|
|
|
|
*/
|
|
|
|
|
|
|
|
c->ssl->no_wait_shutdown = 1;
|
|
|
|
|
2015-09-11 14:13:06 -03:00
|
|
|
#if (NGX_HTTP_V2 \
|
2021-10-15 04:02:15 -03:00
|
|
|
&& defined TLSEXT_TYPE_application_layer_protocol_negotiation)
|
2013-03-20 07:36:57 -03:00
|
|
|
{
|
2015-11-05 09:01:09 -03:00
|
|
|
unsigned int len;
|
|
|
|
const unsigned char *data;
|
|
|
|
ngx_http_connection_t *hc;
|
|
|
|
|
|
|
|
hc = c->data;
|
|
|
|
|
|
|
|
if (hc->addr_conf->http2) {
|
2013-03-20 07:36:57 -03:00
|
|
|
|
2015-11-05 09:01:09 -03:00
|
|
|
SSL_get0_alpn_selected(c->ssl->connection, &data, &len);
|
2014-01-28 20:33:49 -03:00
|
|
|
|
2015-11-05 09:01:09 -03:00
|
|
|
if (len == 2 && data[0] == 'h' && data[1] == '2') {
|
|
|
|
ngx_http_v2_init(c->read);
|
|
|
|
return;
|
|
|
|
}
|
2013-03-20 07:36:57 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
c->log->action = "waiting for request";
|
2012-04-16 10:05:20 -03:00
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
c->read->handler = ngx_http_wait_request_handler;
|
2005-09-30 10:41:25 -04:00
|
|
|
/* STUB: epoll edge */ c->write->handler = ngx_http_empty_handler;
|
|
|
|
|
2013-03-15 16:49:54 -03:00
|
|
|
ngx_reusable_connection(c, 1);
|
|
|
|
|
2013-03-07 14:21:50 -03:00
|
|
|
ngx_http_wait_request_handler(c->read);
|
2005-09-30 10:41:25 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
if (c->read->timedout) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
|
|
|
|
}
|
2005-09-30 10:41:25 -04:00
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
ngx_http_close_connection(c);
|
2005-09-30 10:41:25 -04:00
|
|
|
}
|
|
|
|
|
2019-02-25 10:41:08 -03:00
|
|
|
|
2007-05-29 11:21:09 -04:00
|
|
|
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
|
|
|
|
|
|
|
int
|
|
|
|
ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
|
|
|
|
{
|
2019-03-03 10:48:06 -03:00
|
|
|
ngx_int_t rc;
|
2013-02-27 14:06:52 -03:00
|
|
|
ngx_str_t host;
|
|
|
|
const char *servername;
|
|
|
|
ngx_connection_t *c;
|
|
|
|
ngx_http_connection_t *hc;
|
|
|
|
ngx_http_ssl_srv_conf_t *sscf;
|
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
2007-05-29 11:21:09 -04:00
|
|
|
|
|
|
|
c = ngx_ssl_get_connection(ssl_conn);
|
|
|
|
|
2018-10-02 11:46:18 -03:00
|
|
|
if (c->ssl->handshaked) {
|
2019-03-03 10:48:06 -03:00
|
|
|
*ad = SSL_AD_NO_RENEGOTIATION;
|
|
|
|
return SSL_TLSEXT_ERR_ALERT_FATAL;
|
2015-12-08 10:59:43 -03:00
|
|
|
}
|
|
|
|
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
hc = c->data;
|
|
|
|
|
2019-03-05 10:34:19 -03:00
|
|
|
servername = SSL_get_servername(ssl_conn, TLSEXT_NAMETYPE_host_name);
|
|
|
|
|
|
|
|
if (servername == NULL) {
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"SSL server name: null");
|
|
|
|
goto done;
|
2019-03-05 10:34:19 -03:00
|
|
|
}
|
|
|
|
|
2007-05-29 11:21:09 -04:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"SSL server name: \"%s\"", servername);
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
host.len = ngx_strlen(servername);
|
2008-08-21 08:56:10 -04:00
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
if (host.len == 0) {
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
goto done;
|
2008-08-21 08:56:10 -04:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
host.data = (u_char *) servername;
|
2009-09-24 09:15:50 -04:00
|
|
|
|
2019-03-03 10:48:06 -03:00
|
|
|
rc = ngx_http_validate_host(&host, c->pool, 1);
|
|
|
|
|
|
|
|
if (rc == NGX_ERROR) {
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
goto error;
|
2019-03-03 10:48:06 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rc == NGX_DECLINED) {
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
goto done;
|
2009-09-24 09:15:50 -04:00
|
|
|
}
|
|
|
|
|
2019-03-03 10:48:06 -03:00
|
|
|
rc = ngx_http_find_virtual_server(c, hc->addr_conf->virtual_names, &host,
|
|
|
|
NULL, &cscf);
|
|
|
|
|
|
|
|
if (rc == NGX_ERROR) {
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
goto error;
|
2019-03-03 10:48:06 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rc == NGX_DECLINED) {
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
goto done;
|
2007-05-29 11:21:09 -04:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:33:59 -03:00
|
|
|
hc->ssl_servername = ngx_palloc(c->pool, sizeof(ngx_str_t));
|
|
|
|
if (hc->ssl_servername == NULL) {
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
goto error;
|
2013-02-27 14:33:59 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
*hc->ssl_servername = host;
|
|
|
|
|
2013-02-27 14:12:48 -03:00
|
|
|
hc->conf_ctx = cscf->ctx;
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module);
|
2013-02-27 14:06:52 -03:00
|
|
|
|
2015-04-25 16:44:02 -03:00
|
|
|
ngx_set_connection_log(c, clcf->error_log);
|
2013-02-27 14:06:52 -03:00
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
|
2007-05-29 11:21:09 -04:00
|
|
|
|
2017-02-02 14:29:16 -03:00
|
|
|
c->ssl->buffer_size = sscf->buffer_size;
|
|
|
|
|
2011-11-22 13:27:45 -03:00
|
|
|
if (sscf->ssl.ctx) {
|
2020-09-24 09:51:29 -03:00
|
|
|
if (SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx) == NULL) {
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
goto error;
|
2020-09-24 09:51:29 -03:00
|
|
|
}
|
2007-05-29 11:21:09 -04:00
|
|
|
|
2011-11-22 13:27:45 -03:00
|
|
|
/*
|
|
|
|
* SSL_set_SSL_CTX() only changes certs as of 1.0.0d
|
|
|
|
* adjust other things we care about
|
|
|
|
*/
|
2011-08-23 11:36:31 -03:00
|
|
|
|
2011-11-22 13:27:45 -03:00
|
|
|
SSL_set_verify(ssl_conn, SSL_CTX_get_verify_mode(sscf->ssl.ctx),
|
|
|
|
SSL_CTX_get_verify_callback(sscf->ssl.ctx));
|
2011-08-23 11:36:31 -03:00
|
|
|
|
2011-11-22 13:27:45 -03:00
|
|
|
SSL_set_verify_depth(ssl_conn, SSL_CTX_get_verify_depth(sscf->ssl.ctx));
|
2011-08-23 11:36:31 -03:00
|
|
|
|
2018-07-16 10:47:20 -04:00
|
|
|
#if OPENSSL_VERSION_NUMBER >= 0x009080dfL
|
2011-11-22 13:27:45 -03:00
|
|
|
/* only in 0.9.8m+ */
|
|
|
|
SSL_clear_options(ssl_conn, SSL_get_options(ssl_conn) &
|
|
|
|
~SSL_CTX_get_options(sscf->ssl.ctx));
|
2011-08-23 11:36:31 -03:00
|
|
|
#endif
|
|
|
|
|
2011-11-22 13:27:45 -03:00
|
|
|
SSL_set_options(ssl_conn, SSL_CTX_get_options(sscf->ssl.ctx));
|
2018-10-02 11:46:18 -03:00
|
|
|
|
|
|
|
#ifdef SSL_OP_NO_RENEGOTIATION
|
|
|
|
SSL_set_options(ssl_conn, SSL_OP_NO_RENEGOTIATION);
|
2021-12-07 09:49:51 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SSL_OP_ENABLE_MIDDLEBOX_COMPAT
|
2021-12-09 05:15:25 -03:00
|
|
|
#if (NGX_HTTP_V3)
|
2021-12-07 09:49:51 -03:00
|
|
|
if (c->listening->quic) {
|
|
|
|
SSL_clear_options(ssl_conn, SSL_OP_ENABLE_MIDDLEBOX_COMPAT);
|
|
|
|
}
|
|
|
|
#endif
|
2018-10-02 11:46:18 -03:00
|
|
|
#endif
|
2011-11-22 13:27:45 -03:00
|
|
|
}
|
2011-08-23 11:36:31 -03:00
|
|
|
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
done:
|
|
|
|
|
|
|
|
sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
|
|
|
|
|
|
|
|
if (sscf->reject_handshake) {
|
|
|
|
c->ssl->handshake_rejected = 1;
|
|
|
|
*ad = SSL_AD_UNRECOGNIZED_NAME;
|
|
|
|
return SSL_TLSEXT_ERR_ALERT_FATAL;
|
|
|
|
}
|
|
|
|
|
2007-05-29 11:21:09 -04:00
|
|
|
return SSL_TLSEXT_ERR_OK;
|
SSL: ssl_reject_handshake directive (ticket #195).
In some cases it might be needed to reject SSL handshake based on SNI
server name provided, for example, to make sure an invalid certificate
is not returned to clients trying to contact a name-based virtual server
without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for
this. This workaround, however, is not compatible with TLSv1.3, in
particular, when using BoringSSL, where it is not possible to configure
TLSv1.3 ciphers at all.
With this change, the ssl_reject_handshake directive is introduced,
which instructs nginx to reject SSL handshakes with an "unrecognized_name"
alert in a particular server block.
For example, to reject handshake with names other than example.com,
one can use the following configuration:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
}
The following configuration can be used to reject all SSL handshakes
without SNI server name provided:
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name ~^;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}
Additionally, the ssl_reject_handshake directive makes configuring
certificates for the default server block optional. If no certificates
are configured in the default server for a given listening socket,
certificates must be defined in all non-default server blocks with
the listening socket in question.
2020-10-22 12:02:28 -03:00
|
|
|
|
|
|
|
error:
|
|
|
|
|
|
|
|
*ad = SSL_AD_INTERNAL_ERROR;
|
|
|
|
return SSL_TLSEXT_ERR_ALERT_FATAL;
|
2007-05-29 11:21:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2005-09-30 10:41:25 -04:00
|
|
|
|
2019-02-25 10:42:05 -03:00
|
|
|
|
|
|
|
#ifdef SSL_R_CERT_CB_ERROR
|
|
|
|
|
|
|
|
int
|
|
|
|
ngx_http_ssl_certificate(ngx_ssl_conn_t *ssl_conn, void *arg)
|
|
|
|
{
|
|
|
|
ngx_str_t cert, key;
|
|
|
|
ngx_uint_t i, nelts;
|
|
|
|
ngx_connection_t *c;
|
|
|
|
ngx_http_request_t *r;
|
|
|
|
ngx_http_ssl_srv_conf_t *sscf;
|
|
|
|
ngx_http_complex_value_t *certs, *keys;
|
|
|
|
|
|
|
|
c = ngx_ssl_get_connection(ssl_conn);
|
|
|
|
|
|
|
|
if (c->ssl->handshaked) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = ngx_http_alloc_request(c);
|
|
|
|
if (r == NULL) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->logged = 1;
|
|
|
|
|
2019-02-25 15:16:26 -03:00
|
|
|
sscf = arg;
|
2019-02-25 10:42:05 -03:00
|
|
|
|
|
|
|
nelts = sscf->certificate_values->nelts;
|
|
|
|
certs = sscf->certificate_values->elts;
|
|
|
|
keys = sscf->certificate_key_values->elts;
|
|
|
|
|
|
|
|
for (i = 0; i < nelts; i++) {
|
|
|
|
|
|
|
|
if (ngx_http_complex_value(r, &certs[i], &cert) != NGX_OK) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"ssl cert: \"%s\"", cert.data);
|
|
|
|
|
|
|
|
if (ngx_http_complex_value(r, &keys[i], &key) != NGX_OK) {
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"ssl key: \"%s\"", key.data);
|
|
|
|
|
2019-02-25 10:42:23 -03:00
|
|
|
if (ngx_ssl_connection_certificate(c, r->pool, &cert, &key,
|
|
|
|
sscf->passwords)
|
2019-02-25 10:42:05 -03:00
|
|
|
!= NGX_OK)
|
|
|
|
{
|
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_http_free_request(r, 0);
|
2021-05-24 11:23:42 -04:00
|
|
|
c->log->action = "SSL handshaking";
|
2019-02-25 10:42:05 -03:00
|
|
|
c->destroyed = 0;
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
failed:
|
|
|
|
|
|
|
|
ngx_http_free_request(r, 0);
|
2021-05-24 11:23:42 -04:00
|
|
|
c->log->action = "SSL handshaking";
|
2019-02-25 10:42:05 -03:00
|
|
|
c->destroyed = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2004-07-16 13:11:43 -04:00
|
|
|
#endif
|
|
|
|
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static void
|
|
|
|
ngx_http_process_request_line(ngx_event_t *rev)
|
2002-08-06 12:39:45 -04:00
|
|
|
{
|
2013-03-20 06:36:27 -03:00
|
|
|
ssize_t n;
|
|
|
|
ngx_int_t rc, rv;
|
|
|
|
ngx_str_t host;
|
|
|
|
ngx_connection_t *c;
|
|
|
|
ngx_http_request_t *r;
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2003-05-19 12:39:14 -04:00
|
|
|
c = rev->data;
|
|
|
|
r = c->data;
|
2002-08-06 12:39:45 -04:00
|
|
|
|
2003-12-09 12:08:11 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0,
|
|
|
|
"http process request line");
|
2003-03-20 12:09:44 -04:00
|
|
|
|
|
|
|
if (rev->timedout) {
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
|
|
|
|
c->timedout = 1;
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT);
|
2003-05-12 11:52:24 -04:00
|
|
|
return;
|
2003-03-20 12:09:44 -04:00
|
|
|
}
|
2002-08-06 12:39:45 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
rc = NGX_AGAIN;
|
2003-05-12 11:52:24 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
for ( ;; ) {
|
2003-05-19 12:39:14 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (rc == NGX_AGAIN) {
|
|
|
|
n = ngx_http_read_request_header(r);
|
2003-05-12 11:52:24 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (n == NGX_AGAIN || n == NGX_ERROR) {
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
2003-04-08 11:40:10 -04:00
|
|
|
}
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
rc = ngx_http_parse_request_line(r, r->header_in);
|
2003-10-24 13:10:38 -03:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (rc == NGX_OK) {
|
2003-11-28 14:41:47 -03:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
/* the request line has been parsed successfully */
|
2003-11-28 14:41:47 -03:00
|
|
|
|
2004-11-11 11:07:14 -03:00
|
|
|
r->request_line.len = r->request_end - r->request_start;
|
|
|
|
r->request_line.data = r->request_start;
|
2021-01-22 10:34:06 -03:00
|
|
|
r->request_length = r->header_in->pos - r->request_start;
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2013-03-20 06:36:27 -03:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"http request line: \"%V\"", &r->request_line);
|
2003-03-04 03:33:48 -03:00
|
|
|
|
2020-11-25 14:57:43 -03:00
|
|
|
r->method_name.len = r->method_end - r->request_start + 1;
|
|
|
|
r->method_name.data = r->request_line.data;
|
|
|
|
|
|
|
|
if (r->http_protocol.data) {
|
|
|
|
r->http_protocol.len = r->request_end - r->http_protocol.data;
|
|
|
|
}
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2013-03-20 06:36:27 -03:00
|
|
|
if (ngx_http_process_request_uri(r) != NGX_OK) {
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2009-07-14 04:51:20 -04:00
|
|
|
}
|
2004-11-11 11:07:14 -03:00
|
|
|
|
2018-06-07 13:01:41 -04:00
|
|
|
if (r->schema_end) {
|
|
|
|
r->schema.len = r->schema_end - r->schema_start;
|
|
|
|
r->schema.data = r->schema_start;
|
|
|
|
}
|
|
|
|
|
2018-06-07 12:53:43 -04:00
|
|
|
if (r->host_end) {
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
host.len = r->host_end - r->host_start;
|
|
|
|
host.data = r->host_start;
|
|
|
|
|
|
|
|
rc = ngx_http_validate_host(&host, r->pool, 0);
|
2009-09-24 09:15:50 -04:00
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
if (rc == NGX_DECLINED) {
|
2008-05-15 10:44:47 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
|
|
|
"client sent invalid host in request line");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2008-05-15 10:44:47 -04:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
if (rc == NGX_ERROR) {
|
2009-09-24 09:15:50 -04:00
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2009-09-24 09:15:50 -04:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:27:15 -03:00
|
|
|
if (ngx_http_set_virtual_server(r, &host) == NGX_ERROR) {
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2013-02-27 14:27:15 -03:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
r->headers_in.server = host;
|
2008-05-15 10:44:47 -04:00
|
|
|
}
|
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (r->http_version < NGX_HTTP_VERSION_10) {
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2013-02-27 14:27:15 -03:00
|
|
|
if (r->headers_in.server.len == 0
|
|
|
|
&& ngx_http_set_virtual_server(r, &r->headers_in.server)
|
|
|
|
== NGX_ERROR)
|
2008-05-15 10:44:47 -04:00
|
|
|
{
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2008-05-15 10:44:47 -04:00
|
|
|
}
|
|
|
|
|
2007-06-04 16:40:03 -04:00
|
|
|
ngx_http_process_request(r);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2004-03-23 02:01:52 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (ngx_list_init(&r->headers_in.headers, r->pool, 20,
|
2005-11-26 07:11:11 -03:00
|
|
|
sizeof(ngx_table_elt_t))
|
2009-02-24 07:42:23 -03:00
|
|
|
!= NGX_OK)
|
2004-09-23 02:32:00 -04:00
|
|
|
{
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
2004-03-23 02:01:52 -04:00
|
|
|
|
2005-01-25 09:27:35 -03:00
|
|
|
c->log->action = "reading client request headers";
|
2002-08-29 12:59:54 -04:00
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
rev->handler = ngx_http_process_request_headers;
|
2004-09-23 02:32:00 -04:00
|
|
|
ngx_http_process_request_headers(rev);
|
2003-05-13 12:02:32 -04:00
|
|
|
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2005-03-28 10:43:02 -04:00
|
|
|
}
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
if (rc != NGX_AGAIN) {
|
2003-03-05 14:30:51 -03:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
/* there was error while a request line parsing */
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
|
|
|
ngx_http_client_errors[rc - NGX_HTTP_CLIENT_ERROR]);
|
2017-04-25 17:39:13 -03:00
|
|
|
|
|
|
|
if (rc == NGX_HTTP_PARSE_INVALID_VERSION) {
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_VERSION_NOT_SUPPORTED);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
}
|
|
|
|
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
2003-03-05 14:30:51 -03:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
/* NGX_AGAIN: a request line parsing is still incomplete */
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
if (r->header_in->pos == r->header_in->end) {
|
2003-03-05 14:30:51 -03:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
rv = ngx_http_alloc_large_header_buffer(r, 1);
|
2003-05-19 12:39:14 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (rv == NGX_ERROR) {
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
2003-03-05 14:30:51 -03:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (rv == NGX_DECLINED) {
|
2021-01-22 10:34:06 -03:00
|
|
|
r->request_line.len = r->header_in->end - r->request_start;
|
|
|
|
r->request_line.data = r->request_start;
|
2005-03-28 10:43:02 -04:00
|
|
|
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
|
|
|
"client sent too long URI");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_REQUEST_URI_TOO_LARGE);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2003-03-05 14:30:51 -03:00
|
|
|
}
|
|
|
|
}
|
2002-09-13 10:47:42 -04:00
|
|
|
}
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
|
|
|
|
ngx_http_run_posted_requests(c);
|
2002-08-06 12:39:45 -04:00
|
|
|
}
|
|
|
|
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2013-03-20 07:36:57 -03:00
|
|
|
ngx_int_t
|
2013-03-20 06:36:27 -03:00
|
|
|
ngx_http_process_request_uri(ngx_http_request_t *r)
|
|
|
|
{
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
|
|
|
|
|
|
|
if (r->args_start) {
|
|
|
|
r->uri.len = r->args_start - 1 - r->uri_start;
|
|
|
|
} else {
|
|
|
|
r->uri.len = r->uri_end - r->uri_start;
|
|
|
|
}
|
|
|
|
|
2020-12-10 14:09:30 -03:00
|
|
|
if (r->complex_uri || r->quoted_uri || r->empty_path_in_uri) {
|
2013-03-20 06:36:27 -03:00
|
|
|
|
2020-12-10 14:09:30 -03:00
|
|
|
if (r->empty_path_in_uri) {
|
|
|
|
r->uri.len++;
|
|
|
|
}
|
2013-03-20 06:36:27 -03:00
|
|
|
|
2020-12-10 14:09:39 -03:00
|
|
|
r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
|
2013-03-20 06:36:27 -03:00
|
|
|
if (r->uri.data == NULL) {
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
|
|
|
|
|
|
|
if (ngx_http_parse_complex_uri(r, cscf->merge_slashes) != NGX_OK) {
|
2014-07-18 12:02:11 -04:00
|
|
|
r->uri.len = 0;
|
|
|
|
|
2013-03-20 06:36:27 -03:00
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent invalid request");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
r->uri.data = r->uri_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->unparsed_uri.len = r->uri_end - r->uri_start;
|
|
|
|
r->unparsed_uri.data = r->uri_start;
|
|
|
|
|
2021-06-28 11:01:13 -04:00
|
|
|
r->valid_unparsed_uri = r->empty_path_in_uri ? 0 : 1;
|
2013-03-20 06:36:27 -03:00
|
|
|
|
|
|
|
if (r->uri_ext) {
|
|
|
|
if (r->args_start) {
|
|
|
|
r->exten.len = r->args_start - 1 - r->uri_ext;
|
|
|
|
} else {
|
|
|
|
r->exten.len = r->uri_end - r->uri_ext;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->exten.data = r->uri_ext;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (r->args_start && r->uri_end > r->args_start) {
|
|
|
|
r->args.len = r->uri_end - r->args_start;
|
|
|
|
r->args.data = r->args_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if (NGX_WIN32)
|
|
|
|
{
|
|
|
|
u_char *p, *last;
|
|
|
|
|
|
|
|
p = r->uri.data;
|
|
|
|
last = r->uri.data + r->uri.len;
|
|
|
|
|
|
|
|
while (p < last) {
|
|
|
|
|
|
|
|
if (*p++ == ':') {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* this check covers "::$data", "::$index_allocation" and
|
|
|
|
* ":$i30:$index_allocation"
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (p < last && *p == '$') {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent unsafe win32 URI");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p = r->uri.data + r->uri.len - 1;
|
|
|
|
|
|
|
|
while (p > r->uri.data) {
|
|
|
|
|
|
|
|
if (*p == ' ') {
|
|
|
|
p--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*p == '.') {
|
|
|
|
p--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p != r->uri.data + r->uri.len - 1) {
|
|
|
|
r->uri.len = p + 1 - r->uri.data;
|
|
|
|
ngx_http_set_exten(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
|
|
"http uri: \"%V\"", &r->uri);
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
|
|
"http args: \"%V\"", &r->args);
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
|
|
"http exten: \"%V\"", &r->exten);
|
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static void
|
|
|
|
ngx_http_process_request_headers(ngx_event_t *rev)
|
2002-08-06 12:39:45 -04:00
|
|
|
{
|
2009-09-01 08:35:52 -04:00
|
|
|
u_char *p;
|
|
|
|
size_t len;
|
2005-04-08 11:18:55 -04:00
|
|
|
ssize_t n;
|
|
|
|
ngx_int_t rc, rv;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
ngx_table_elt_t *h;
|
2005-04-08 11:18:55 -04:00
|
|
|
ngx_connection_t *c;
|
|
|
|
ngx_http_header_t *hh;
|
|
|
|
ngx_http_request_t *r;
|
2005-05-14 14:42:03 -04:00
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
2005-04-08 11:18:55 -04:00
|
|
|
ngx_http_core_main_conf_t *cmcf;
|
2003-05-19 12:39:14 -04:00
|
|
|
|
|
|
|
c = rev->data;
|
|
|
|
r = c->data;
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2003-11-30 17:03:18 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0,
|
|
|
|
"http process request header line");
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2003-05-12 11:52:24 -04:00
|
|
|
if (rev->timedout) {
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
|
|
|
|
c->timedout = 1;
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT);
|
2003-05-12 11:52:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-04-08 11:18:55 -04:00
|
|
|
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
rc = NGX_AGAIN;
|
2003-05-12 11:52:24 -04:00
|
|
|
|
2002-08-29 12:59:54 -04:00
|
|
|
for ( ;; ) {
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
if (rc == NGX_AGAIN) {
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
if (r->header_in->pos == r->header_in->end) {
|
2004-09-23 02:32:00 -04:00
|
|
|
|
|
|
|
rv = ngx_http_alloc_large_header_buffer(r, 0);
|
|
|
|
|
|
|
|
if (rv == NGX_ERROR) {
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rv == NGX_DECLINED) {
|
2021-01-22 10:34:06 -03:00
|
|
|
p = r->header_name_start;
|
2009-09-01 08:35:52 -04:00
|
|
|
|
2011-01-20 07:37:58 -03:00
|
|
|
r->lingering_close = 1;
|
|
|
|
|
2009-11-03 15:12:20 -03:00
|
|
|
if (p == NULL) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
|
|
|
"client sent too large request");
|
2011-01-20 07:37:58 -03:00
|
|
|
ngx_http_finalize_request(r,
|
|
|
|
NGX_HTTP_REQUEST_HEADER_TOO_LARGE);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2009-11-03 15:12:20 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
len = r->header_in->end - p;
|
|
|
|
|
2009-09-01 08:35:52 -04:00
|
|
|
if (len > NGX_MAX_ERROR_STR - 300) {
|
|
|
|
len = NGX_MAX_ERROR_STR - 300;
|
2005-07-25 05:41:38 -04:00
|
|
|
}
|
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
2014-10-08 10:16:04 -03:00
|
|
|
"client sent too long header line: \"%*s...\"",
|
2021-01-22 10:34:06 -03:00
|
|
|
len, r->header_name_start);
|
2011-01-20 07:37:58 -03:00
|
|
|
|
|
|
|
ngx_http_finalize_request(r,
|
|
|
|
NGX_HTTP_REQUEST_HEADER_TOO_LARGE);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
n = ngx_http_read_request_header(r);
|
2002-08-29 12:59:54 -04:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
if (n == NGX_AGAIN || n == NGX_ERROR) {
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:27:15 -03:00
|
|
|
/* the host header could change the server configuration context */
|
|
|
|
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
rc = ngx_http_parse_header_line(r, r->header_in,
|
|
|
|
cscf->underscores_in_headers);
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2003-03-05 14:30:51 -03:00
|
|
|
if (rc == NGX_OK) {
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
r->request_length += r->header_in->pos - r->header_name_start;
|
2012-07-06 00:27:06 -04:00
|
|
|
|
2005-05-14 14:42:03 -04:00
|
|
|
if (r->invalid_header && cscf->ignore_invalid_headers) {
|
2005-03-22 12:02:46 -04:00
|
|
|
|
|
|
|
/* there was error while a header line parsing */
|
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
2021-01-22 10:34:06 -03:00
|
|
|
"client sent invalid header line: \"%*s\"",
|
|
|
|
r->header_end - r->header_name_start,
|
|
|
|
r->header_name_start);
|
2005-03-22 12:02:46 -04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
/* a header line has been parsed successfully */
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
h = ngx_list_push(&r->headers_in.headers);
|
|
|
|
if (h == NULL) {
|
2003-05-13 12:02:32 -04:00
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2003-03-20 12:09:44 -04:00
|
|
|
}
|
|
|
|
|
2005-04-08 11:18:55 -04:00
|
|
|
h->hash = r->header_hash;
|
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
h->key.len = r->header_name_end - r->header_name_start;
|
2004-09-23 02:32:00 -04:00
|
|
|
h->key.data = r->header_name_start;
|
2021-01-22 10:34:06 -03:00
|
|
|
h->key.data[h->key.len] = '\0';
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
h->value.len = r->header_end - r->header_start;
|
|
|
|
h->value.data = r->header_start;
|
2021-01-22 10:34:06 -03:00
|
|
|
h->value.data[h->value.len] = '\0';
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2008-06-17 11:00:30 -04:00
|
|
|
h->lowcase_key = ngx_pnalloc(r->pool, h->key.len);
|
2006-05-11 10:43:47 -04:00
|
|
|
if (h->lowcase_key == NULL) {
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2006-05-11 10:43:47 -04:00
|
|
|
}
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2006-05-11 10:43:47 -04:00
|
|
|
if (h->key.len == r->lowcase_index) {
|
|
|
|
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
|
|
|
|
|
|
|
|
} else {
|
2008-08-04 06:07:00 -04:00
|
|
|
ngx_strlow(h->lowcase_key, h->key.data, h->key.len);
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
|
|
|
|
2006-05-11 10:43:47 -04:00
|
|
|
hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash,
|
|
|
|
h->lowcase_key, h->key.len);
|
|
|
|
|
|
|
|
if (hh && hh->handler(r, h, hh->offset) != NGX_OK) {
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2006-05-11 10:43:47 -04:00
|
|
|
}
|
|
|
|
|
2003-12-14 17:10:27 -03:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2004-11-11 11:07:14 -03:00
|
|
|
"http header: \"%V: %V\"",
|
|
|
|
&h->key, &h->value);
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2003-05-27 08:18:54 -04:00
|
|
|
continue;
|
2005-03-28 10:43:02 -04:00
|
|
|
}
|
2003-05-27 08:18:54 -04:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
|
2002-09-02 10:48:24 -04:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
/* a whole header has been parsed successfully */
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2003-12-14 17:10:27 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
|
|
"http header done");
|
2002-12-15 03:25:09 -03:00
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
r->request_length += r->header_in->pos - r->header_name_start;
|
2004-12-06 11:45:08 -03:00
|
|
|
|
2004-06-24 12:07:04 -04:00
|
|
|
r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE;
|
|
|
|
|
2003-10-21 13:49:56 -03:00
|
|
|
rc = ngx_http_process_request_header(r);
|
2003-10-12 13:49:16 -03:00
|
|
|
|
2003-10-21 13:49:56 -03:00
|
|
|
if (rc != NGX_OK) {
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2003-04-25 10:43:13 -04:00
|
|
|
}
|
|
|
|
|
2007-06-04 16:40:03 -04:00
|
|
|
ngx_http_process_request(r);
|
2005-08-30 06:55:07 -04:00
|
|
|
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2005-03-28 10:43:02 -04:00
|
|
|
}
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
if (rc == NGX_AGAIN) {
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
/* a header line parsing is still not complete */
|
2003-12-22 06:40:48 -03:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
continue;
|
2003-03-05 14:30:51 -03:00
|
|
|
}
|
|
|
|
|
2016-02-24 10:01:23 -03:00
|
|
|
/* rc == NGX_HTTP_PARSE_INVALID_HEADER */
|
2003-03-05 14:30:51 -03:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
2021-06-28 11:01:20 -04:00
|
|
|
"client sent invalid header line: \"%*s\\x%02xd...\"",
|
|
|
|
r->header_end - r->header_name_start,
|
|
|
|
r->header_name_start, *r->header_end);
|
2016-02-24 10:01:23 -03:00
|
|
|
|
2007-08-27 16:52:40 -04:00
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
break;
|
2002-08-29 12:59:54 -04:00
|
|
|
}
|
Fixed socket leak with "return 444" in error_page (ticket #274).
Socket leak was observed in the following configuration:
error_page 400 = /close;
location = /close {
return 444;
}
The problem is that "return 444" triggers termination of the request,
and due to error_page termination thinks that it needs to use a posted
request to clear stack. But at the early request processing where 400
errors are generated there are no ngx_http_run_posted_requests() calls,
so the request is only terminated after an external event.
Variants of the problem include "error_page 497" instead (ticket #695)
and various other errors generated during early request processing
(405, 414, 421, 494, 495, 496, 501, 505).
The same problem can be also triggered with "return 499" and "return 408"
as both codes trigger ngx_http_terminate_request(), much like "return 444".
To fix this, the patch adds ngx_http_run_posted_requests() calls to
ngx_http_process_request_line() and ngx_http_process_request_headers()
functions, and to ngx_http_v2_run_request() and ngx_http_v2_push_stream()
functions in HTTP/2.
Since the ngx_http_process_request() function is now only called via
other functions which call ngx_http_run_posted_requests(), the call
there is no longer needed and was removed.
2018-09-21 09:59:30 -03:00
|
|
|
|
|
|
|
ngx_http_run_posted_requests(c);
|
2002-09-02 10:48:24 -04:00
|
|
|
}
|
2002-08-06 12:39:45 -04:00
|
|
|
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static ssize_t
|
|
|
|
ngx_http_read_request_header(ngx_http_request_t *r)
|
2002-09-02 10:48:24 -04:00
|
|
|
{
|
2003-05-23 07:53:01 -04:00
|
|
|
ssize_t n;
|
|
|
|
ngx_event_t *rev;
|
2006-08-30 06:39:17 -04:00
|
|
|
ngx_connection_t *c;
|
2003-05-23 07:53:01 -04:00
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
2002-12-02 13:09:40 -03:00
|
|
|
|
2006-08-30 06:39:17 -04:00
|
|
|
c = r->connection;
|
|
|
|
rev = c->read;
|
2003-06-11 11:28:34 -04:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
n = r->header_in->last - r->header_in->pos;
|
2002-12-02 13:09:40 -03:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
if (n > 0) {
|
|
|
|
return n;
|
|
|
|
}
|
2003-03-04 03:33:48 -03:00
|
|
|
|
2005-06-15 14:33:41 -04:00
|
|
|
if (rev->ready) {
|
2006-08-30 06:39:17 -04:00
|
|
|
n = c->recv(c, r->header_in->last,
|
|
|
|
r->header_in->end - r->header_in->last);
|
2005-06-15 14:33:41 -04:00
|
|
|
} else {
|
|
|
|
n = NGX_AGAIN;
|
2003-11-18 13:49:00 -03:00
|
|
|
}
|
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
if (n == NGX_AGAIN) {
|
2008-01-08 17:55:27 -03:00
|
|
|
if (!rev->timer_set) {
|
2004-07-16 13:11:43 -04:00
|
|
|
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
2003-05-23 07:53:01 -04:00
|
|
|
ngx_add_timer(rev, cscf->client_header_timeout);
|
2003-01-28 12:56:37 -03:00
|
|
|
}
|
|
|
|
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
2003-10-10 11:10:50 -04:00
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
return NGX_AGAIN;
|
2002-12-02 13:09:40 -03:00
|
|
|
}
|
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
if (n == 0) {
|
2006-08-30 06:39:17 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
2012-04-12 16:35:41 -03:00
|
|
|
"client prematurely closed connection");
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
2002-09-02 10:48:24 -04:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
if (n == 0 || n == NGX_ERROR) {
|
2007-01-08 15:22:06 -03:00
|
|
|
c->error = 1;
|
2007-01-08 15:23:38 -03:00
|
|
|
c->log->action = "reading client request headers";
|
2006-08-30 06:39:17 -04:00
|
|
|
|
2007-01-08 15:22:06 -03:00
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
2003-05-13 12:02:32 -04:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->header_in->last += n;
|
|
|
|
|
|
|
|
return n;
|
2002-09-02 10:48:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static ngx_int_t
|
|
|
|
ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
|
|
|
|
ngx_uint_t request_line)
|
2004-09-22 12:18:21 -04:00
|
|
|
{
|
|
|
|
u_char *old, *new;
|
|
|
|
ngx_buf_t *b;
|
2017-03-07 12:49:31 -03:00
|
|
|
ngx_chain_t *cl;
|
2004-09-22 12:18:21 -04:00
|
|
|
ngx_http_connection_t *hc;
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
|
|
|
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
|
|
"http alloc large header buffer");
|
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (request_line && r->state == 0) {
|
|
|
|
|
|
|
|
/* the client fills up the buffer with "\r\n" */
|
|
|
|
|
|
|
|
r->header_in->pos = r->header_in->start;
|
|
|
|
r->header_in->last = r->header_in->start;
|
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
old = request_line ? r->request_start : r->header_name_start;
|
2004-09-22 12:18:21 -04:00
|
|
|
|
|
|
|
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (r->state != 0
|
|
|
|
&& (size_t) (r->header_in->pos - old)
|
|
|
|
>= cscf->large_client_header_buffers.size)
|
|
|
|
{
|
2004-09-22 12:18:21 -04:00
|
|
|
return NGX_DECLINED;
|
|
|
|
}
|
|
|
|
|
|
|
|
hc = r->http_connection;
|
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
if (hc->free) {
|
|
|
|
cl = hc->free;
|
|
|
|
hc->free = cl->next;
|
|
|
|
|
|
|
|
b = cl->buf;
|
2004-09-22 12:18:21 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2004-11-11 11:07:14 -03:00
|
|
|
"http large header free: %p %uz",
|
2004-09-23 12:39:34 -04:00
|
|
|
b->pos, b->end - b->last);
|
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
} else if (hc->nbusy < cscf->large_client_header_buffers.num) {
|
2004-09-22 12:18:21 -04:00
|
|
|
|
|
|
|
b = ngx_create_temp_buf(r->connection->pool,
|
2004-09-23 02:32:00 -04:00
|
|
|
cscf->large_client_header_buffers.size);
|
2004-09-22 12:18:21 -04:00
|
|
|
if (b == NULL) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
cl = ngx_alloc_chain_link(r->connection->pool);
|
|
|
|
if (cl == NULL) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl->buf = b;
|
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2004-11-11 11:07:14 -03:00
|
|
|
"http large header alloc: %p %uz",
|
2004-09-23 12:39:34 -04:00
|
|
|
b->pos, b->end - b->last);
|
|
|
|
|
2004-09-22 12:18:21 -04:00
|
|
|
} else {
|
|
|
|
return NGX_DECLINED;
|
|
|
|
}
|
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
cl->next = hc->busy;
|
|
|
|
hc->busy = cl;
|
|
|
|
hc->nbusy++;
|
2004-09-22 12:18:21 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
if (r->state == 0) {
|
|
|
|
/*
|
|
|
|
* r->state == 0 means that a header line was parsed successfully
|
|
|
|
* and we do not need to copy incomplete header line and
|
|
|
|
* to relocate the parser header pointers
|
|
|
|
*/
|
|
|
|
|
|
|
|
r->header_in = b;
|
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2016-03-30 20:33:57 -03:00
|
|
|
"http large header copy: %uz", r->header_in->pos - old);
|
2004-09-23 12:39:34 -04:00
|
|
|
|
2020-08-05 22:02:22 -04:00
|
|
|
if (r->header_in->pos - old > b->end - b->start) {
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
|
|
|
|
"too large header to copy");
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2004-09-22 12:18:21 -04:00
|
|
|
new = b->start;
|
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
ngx_memcpy(new, old, r->header_in->pos - old);
|
2004-09-22 12:18:21 -04:00
|
|
|
|
|
|
|
b->pos = new + (r->header_in->pos - old);
|
2004-09-23 12:39:34 -04:00
|
|
|
b->last = new + (r->header_in->pos - old);
|
2004-09-22 12:18:21 -04:00
|
|
|
|
|
|
|
if (request_line) {
|
|
|
|
r->request_start = new;
|
2004-09-23 02:32:00 -04:00
|
|
|
|
|
|
|
if (r->request_end) {
|
|
|
|
r->request_end = new + (r->request_end - old);
|
|
|
|
}
|
|
|
|
|
2020-05-19 09:20:33 -04:00
|
|
|
r->method_end = new + (r->method_end - old);
|
2004-09-22 12:18:21 -04:00
|
|
|
|
2020-05-19 09:20:33 -04:00
|
|
|
r->uri_start = new + (r->uri_start - old);
|
|
|
|
r->uri_end = new + (r->uri_end - old);
|
2004-09-22 12:18:21 -04:00
|
|
|
|
2020-05-19 09:20:33 -04:00
|
|
|
if (r->schema_start) {
|
2004-09-23 02:32:00 -04:00
|
|
|
r->schema_start = new + (r->schema_start - old);
|
|
|
|
r->schema_end = new + (r->schema_end - old);
|
|
|
|
}
|
|
|
|
|
2020-05-19 09:20:33 -04:00
|
|
|
if (r->host_start) {
|
2004-09-23 02:32:00 -04:00
|
|
|
r->host_start = new + (r->host_start - old);
|
2006-12-15 07:24:57 -03:00
|
|
|
if (r->host_end) {
|
|
|
|
r->host_end = new + (r->host_end - old);
|
|
|
|
}
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
|
|
|
|
2020-05-19 09:20:33 -04:00
|
|
|
if (r->port_start) {
|
2004-09-23 02:32:00 -04:00
|
|
|
r->port_start = new + (r->port_start - old);
|
|
|
|
r->port_end = new + (r->port_end - old);
|
|
|
|
}
|
|
|
|
|
2020-05-19 09:20:33 -04:00
|
|
|
if (r->uri_ext) {
|
2004-09-22 12:18:21 -04:00
|
|
|
r->uri_ext = new + (r->uri_ext - old);
|
|
|
|
}
|
|
|
|
|
2020-05-19 09:20:33 -04:00
|
|
|
if (r->args_start) {
|
2004-09-22 12:18:21 -04:00
|
|
|
r->args_start = new + (r->args_start - old);
|
|
|
|
}
|
|
|
|
|
2020-05-19 09:20:33 -04:00
|
|
|
if (r->http_protocol.data) {
|
2007-12-01 09:22:48 -03:00
|
|
|
r->http_protocol.data = new + (r->http_protocol.data - old);
|
|
|
|
}
|
|
|
|
|
2004-09-22 12:18:21 -04:00
|
|
|
} else {
|
2020-05-19 09:20:33 -04:00
|
|
|
r->header_name_start = new;
|
|
|
|
r->header_name_end = new + (r->header_name_end - old);
|
|
|
|
r->header_start = new + (r->header_start - old);
|
|
|
|
r->header_end = new + (r->header_end - old);
|
2004-09-22 12:18:21 -04:00
|
|
|
}
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
r->header_in = b;
|
|
|
|
|
2004-09-22 12:18:21 -04:00
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
static ngx_int_t
|
|
|
|
ngx_http_process_header_line(ngx_http_request_t *r, ngx_table_elt_t *h,
|
|
|
|
ngx_uint_t offset)
|
|
|
|
{
|
|
|
|
ngx_table_elt_t **ph;
|
|
|
|
|
|
|
|
ph = (ngx_table_elt_t **) ((char *) &r->headers_in + offset);
|
|
|
|
|
2022-05-30 14:25:35 -04:00
|
|
|
while (*ph) { ph = &(*ph)->next; }
|
|
|
|
|
|
|
|
*ph = h;
|
|
|
|
h->next = NULL;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-15 14:33:41 -04:00
|
|
|
static ngx_int_t
|
|
|
|
ngx_http_process_unique_header_line(ngx_http_request_t *r, ngx_table_elt_t *h,
|
|
|
|
ngx_uint_t offset)
|
|
|
|
{
|
|
|
|
ngx_table_elt_t **ph;
|
|
|
|
|
|
|
|
ph = (ngx_table_elt_t **) ((char *) &r->headers_in + offset);
|
|
|
|
|
|
|
|
if (*ph == NULL) {
|
|
|
|
*ph = h;
|
2022-05-30 14:25:33 -04:00
|
|
|
h->next = NULL;
|
2005-06-15 14:33:41 -04:00
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
2006-08-30 06:39:17 -04:00
|
|
|
"client sent duplicate header line: \"%V: %V\", "
|
|
|
|
"previous value: \"%V: %V\"",
|
|
|
|
&h->key, &h->value, &(*ph)->key, &(*ph)->value);
|
2005-06-15 14:33:41 -04:00
|
|
|
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-09 14:28:49 -04:00
|
|
|
static ngx_int_t
|
2008-05-15 10:44:47 -04:00
|
|
|
ngx_http_process_host(ngx_http_request_t *r, ngx_table_elt_t *h,
|
2007-09-09 14:28:49 -04:00
|
|
|
ngx_uint_t offset)
|
|
|
|
{
|
2013-02-27 14:03:14 -03:00
|
|
|
ngx_int_t rc;
|
|
|
|
ngx_str_t host;
|
2007-09-09 14:28:49 -04:00
|
|
|
|
2020-02-20 10:51:07 -03:00
|
|
|
if (r->headers_in.host) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent duplicate host header: \"%V: %V\", "
|
|
|
|
"previous value: \"%V: %V\"",
|
|
|
|
&h->key, &h->value, &r->headers_in.host->key,
|
|
|
|
&r->headers_in.host->value);
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
return NGX_ERROR;
|
2008-05-15 10:44:47 -04:00
|
|
|
}
|
|
|
|
|
2020-02-20 10:51:07 -03:00
|
|
|
r->headers_in.host = h;
|
2022-05-30 14:25:33 -04:00
|
|
|
h->next = NULL;
|
2020-02-20 10:51:07 -03:00
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
host = h->value;
|
|
|
|
|
|
|
|
rc = ngx_http_validate_host(&host, r->pool, 0);
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
if (rc == NGX_DECLINED) {
|
2008-05-15 10:44:47 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent invalid host header");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
if (rc == NGX_ERROR) {
|
2009-09-24 09:15:50 -04:00
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2008-05-15 10:44:47 -04:00
|
|
|
if (r->headers_in.server.len) {
|
|
|
|
return NGX_OK;
|
2007-09-09 14:28:49 -04:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:27:15 -03:00
|
|
|
if (ngx_http_set_virtual_server(r, &host) == NGX_ERROR) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
r->headers_in.server = host;
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2007-09-09 14:28:49 -04:00
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
static ngx_int_t
|
2008-05-15 10:44:47 -04:00
|
|
|
ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h,
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
ngx_uint_t offset)
|
|
|
|
{
|
2022-05-30 14:25:25 -04:00
|
|
|
if (ngx_http_process_header_line(r, h, offset) != NGX_OK) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2008-05-15 10:44:47 -04:00
|
|
|
if (ngx_strcasestrn(h->value.data, "close", 5 - 1)) {
|
|
|
|
r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2008-05-15 10:44:47 -04:00
|
|
|
} else if (ngx_strcasestrn(h->value.data, "keep-alive", 10 - 1)) {
|
|
|
|
r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
}
|
|
|
|
|
2008-05-15 10:44:47 -04:00
|
|
|
return NGX_OK;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-13 05:18:58 -04:00
|
|
|
static ngx_int_t
|
|
|
|
ngx_http_process_user_agent(ngx_http_request_t *r, ngx_table_elt_t *h,
|
|
|
|
ngx_uint_t offset)
|
|
|
|
{
|
2008-08-26 11:09:28 -04:00
|
|
|
u_char *user_agent, *msie;
|
2008-05-13 05:18:58 -04:00
|
|
|
|
2022-05-30 14:25:35 -04:00
|
|
|
if (ngx_http_process_header_line(r, h, offset) != NGX_OK) {
|
|
|
|
return NGX_ERROR;
|
2008-05-13 05:18:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* check some widespread browsers while the header is in CPU cache */
|
|
|
|
|
|
|
|
user_agent = h->value.data;
|
|
|
|
|
2008-08-26 11:09:28 -04:00
|
|
|
msie = ngx_strstrn(user_agent, "MSIE ", 5 - 1);
|
2008-05-13 05:18:58 -04:00
|
|
|
|
2008-08-26 11:09:28 -04:00
|
|
|
if (msie && msie + 7 < user_agent + h->value.len) {
|
2008-05-13 05:18:58 -04:00
|
|
|
|
|
|
|
r->headers_in.msie = 1;
|
|
|
|
|
2008-08-26 11:09:28 -04:00
|
|
|
if (msie[6] == '.') {
|
|
|
|
|
|
|
|
switch (msie[5]) {
|
|
|
|
case '4':
|
|
|
|
case '5':
|
|
|
|
r->headers_in.msie6 = 1;
|
2009-08-28 04:19:02 -04:00
|
|
|
break;
|
|
|
|
case '6':
|
|
|
|
if (ngx_strstrn(msie + 8, "SV1", 3 - 1) == NULL) {
|
|
|
|
r->headers_in.msie6 = 1;
|
|
|
|
}
|
|
|
|
break;
|
2008-08-26 11:09:28 -04:00
|
|
|
}
|
2008-05-13 05:18:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* MSIE ignores the SSL "close notify" alert */
|
|
|
|
if (c->ssl) {
|
|
|
|
c->ssl->no_send_shutdown = 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ngx_strstrn(user_agent, "Opera", 5 - 1)) {
|
|
|
|
r->headers_in.opera = 1;
|
|
|
|
r->headers_in.msie = 0;
|
2008-08-26 11:09:28 -04:00
|
|
|
r->headers_in.msie6 = 0;
|
2008-05-13 05:18:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!r->headers_in.msie && !r->headers_in.opera) {
|
|
|
|
|
|
|
|
if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
|
|
|
|
r->headers_in.gecko = 1;
|
|
|
|
|
2009-11-12 11:23:18 -03:00
|
|
|
} else if (ngx_strstrn(user_agent, "Chrome/", 7 - 1)) {
|
|
|
|
r->headers_in.chrome = 1;
|
|
|
|
|
2012-03-22 07:42:27 -03:00
|
|
|
} else if (ngx_strstrn(user_agent, "Safari/", 7 - 1)
|
|
|
|
&& ngx_strstrn(user_agent, "Mac OS X", 8 - 1))
|
|
|
|
{
|
2010-02-01 09:01:01 -03:00
|
|
|
r->headers_in.safari = 1;
|
|
|
|
|
2008-05-13 05:18:58 -04:00
|
|
|
} else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
|
|
|
|
r->headers_in.konqueror = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-20 07:36:57 -03:00
|
|
|
ngx_int_t
|
2008-05-15 10:44:47 -04:00
|
|
|
ngx_http_process_request_header(ngx_http_request_t *r)
|
|
|
|
{
|
2013-02-27 14:27:15 -03:00
|
|
|
if (r->headers_in.server.len == 0
|
|
|
|
&& ngx_http_set_virtual_server(r, &r->headers_in.server)
|
|
|
|
== NGX_ERROR)
|
|
|
|
{
|
2008-05-15 10:44:47 -04:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2005-03-28 10:43:02 -04:00
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
if (r->headers_in.host == NULL && r->http_version > NGX_HTTP_VERSION_10) {
|
2008-05-15 10:44:47 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent HTTP/1.1 request without \"Host\" header");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
return NGX_ERROR;
|
2003-10-21 13:49:56 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (r->headers_in.content_length) {
|
|
|
|
r->headers_in.content_length_n =
|
2006-07-07 12:33:19 -04:00
|
|
|
ngx_atoof(r->headers_in.content_length->value.data,
|
2003-10-21 13:49:56 -03:00
|
|
|
r->headers_in.content_length->value.len);
|
|
|
|
|
|
|
|
if (r->headers_in.content_length_n == NGX_ERROR) {
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent invalid \"Content-Length\" header");
|
2012-11-20 22:08:11 -03:00
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
2005-03-28 10:43:02 -04:00
|
|
|
return NGX_ERROR;
|
2003-10-21 13:49:56 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-20 22:08:11 -03:00
|
|
|
if (r->headers_in.transfer_encoding) {
|
2021-08-09 11:12:12 -04:00
|
|
|
if (r->http_version < NGX_HTTP_VERSION_11) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent HTTP/1.0 request with "
|
|
|
|
"\"Transfer-Encoding\" header");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2012-11-20 22:08:11 -03:00
|
|
|
if (r->headers_in.transfer_encoding->value.len == 7
|
|
|
|
&& ngx_strncasecmp(r->headers_in.transfer_encoding->value.data,
|
|
|
|
(u_char *) "chunked", 7) == 0)
|
|
|
|
{
|
2021-06-28 11:01:06 -04:00
|
|
|
if (r->headers_in.content_length) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent \"Content-Length\" and "
|
|
|
|
"\"Transfer-Encoding\" headers "
|
|
|
|
"at the same time");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2012-11-20 22:08:11 -03:00
|
|
|
r->headers_in.chunked = 1;
|
|
|
|
|
2020-02-20 10:19:34 -03:00
|
|
|
} else {
|
2012-11-20 22:08:11 -03:00
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent unknown \"Transfer-Encoding\": \"%V\"",
|
|
|
|
&r->headers_in.transfer_encoding->value);
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_NOT_IMPLEMENTED);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2004-03-30 02:27:36 -04:00
|
|
|
}
|
|
|
|
|
2007-09-09 14:28:49 -04:00
|
|
|
if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) {
|
|
|
|
if (r->headers_in.keep_alive) {
|
|
|
|
r->headers_in.keep_alive_n =
|
|
|
|
ngx_atotm(r->headers_in.keep_alive->value.data,
|
|
|
|
r->headers_in.keep_alive->value.len);
|
2003-10-21 13:49:56 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-28 11:01:04 -04:00
|
|
|
if (r->method == NGX_HTTP_CONNECT) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent CONNECT method");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2021-06-28 11:01:00 -04:00
|
|
|
if (r->method == NGX_HTTP_TRACE) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client sent TRACE method");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2007-06-04 16:40:03 -04:00
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-20 07:36:57 -03:00
|
|
|
void
|
2007-06-04 16:40:03 -04:00
|
|
|
ngx_http_process_request(ngx_http_request_t *r)
|
|
|
|
{
|
2007-12-10 09:09:51 -03:00
|
|
|
ngx_connection_t *c;
|
2007-06-04 16:40:03 -04:00
|
|
|
|
|
|
|
c = r->connection;
|
|
|
|
|
2006-08-04 12:04:04 -04:00
|
|
|
#if (NGX_HTTP_SSL)
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
if (r->http_connection->ssl) {
|
2007-12-10 09:09:51 -03:00
|
|
|
long rc;
|
2008-04-23 14:57:25 -04:00
|
|
|
X509 *cert;
|
2020-05-22 10:30:12 -04:00
|
|
|
const char *s;
|
2007-12-10 09:09:51 -03:00
|
|
|
ngx_http_ssl_srv_conf_t *sscf;
|
|
|
|
|
2013-02-27 14:21:21 -03:00
|
|
|
if (c->ssl == NULL) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
|
|
|
"client sent plain HTTP request to HTTPS port");
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-08-04 12:04:04 -04:00
|
|
|
sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
|
|
|
|
|
2009-07-22 13:41:42 -04:00
|
|
|
if (sscf->verify) {
|
2007-06-04 16:40:03 -04:00
|
|
|
rc = SSL_get_verify_result(c->ssl->connection);
|
2006-08-04 12:04:04 -04:00
|
|
|
|
2012-10-03 12:24:08 -03:00
|
|
|
if (rc != X509_V_OK
|
|
|
|
&& (sscf->verify != 3 || !ngx_ssl_verify_error_optional(rc)))
|
|
|
|
{
|
2007-06-04 16:40:03 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
2006-08-09 15:59:45 -04:00
|
|
|
"client SSL certificate verify error: (%l:%s)",
|
2006-08-04 12:04:04 -04:00
|
|
|
rc, X509_verify_cert_error_string(rc));
|
2008-03-10 11:47:07 -03:00
|
|
|
|
2018-01-30 11:46:31 -03:00
|
|
|
ngx_ssl_remove_cached_session(c->ssl->session_ctx,
|
2008-03-10 11:47:07 -03:00
|
|
|
(SSL_get0_session(c->ssl->connection)));
|
|
|
|
|
2006-08-04 12:04:04 -04:00
|
|
|
ngx_http_finalize_request(r, NGX_HTTPS_CERT_ERROR);
|
2007-06-04 16:40:03 -04:00
|
|
|
return;
|
2006-08-04 12:04:04 -04:00
|
|
|
}
|
|
|
|
|
2009-07-22 13:41:42 -04:00
|
|
|
if (sscf->verify == 1) {
|
|
|
|
cert = SSL_get_peer_certificate(c->ssl->connection);
|
2008-04-23 14:57:25 -04:00
|
|
|
|
2009-07-22 13:41:42 -04:00
|
|
|
if (cert == NULL) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
|
|
|
"client sent no required SSL certificate");
|
2008-03-10 11:47:07 -03:00
|
|
|
|
2018-01-30 11:46:31 -03:00
|
|
|
ngx_ssl_remove_cached_session(c->ssl->session_ctx,
|
2008-03-10 11:47:07 -03:00
|
|
|
(SSL_get0_session(c->ssl->connection)));
|
|
|
|
|
2009-07-22 13:41:42 -04:00
|
|
|
ngx_http_finalize_request(r, NGX_HTTPS_NO_CERT);
|
|
|
|
return;
|
|
|
|
}
|
2008-04-23 14:57:25 -04:00
|
|
|
|
2009-07-22 13:41:42 -04:00
|
|
|
X509_free(cert);
|
|
|
|
}
|
2020-05-22 10:30:12 -04:00
|
|
|
|
|
|
|
if (ngx_ssl_ocsp_get_status(c, &s) != NGX_OK) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
|
|
|
"client SSL certificate verify error: %s", s);
|
|
|
|
|
|
|
|
ngx_ssl_remove_cached_session(c->ssl->session_ctx,
|
|
|
|
(SSL_get0_session(c->ssl->connection)));
|
|
|
|
|
|
|
|
ngx_http_finalize_request(r, NGX_HTTPS_CERT_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
2006-08-04 12:04:04 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2007-06-04 16:40:03 -04:00
|
|
|
if (c->read->timer_set) {
|
|
|
|
ngx_del_timer(c->read);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if (NGX_STAT_STUB)
|
2009-06-18 09:14:51 -04:00
|
|
|
(void) ngx_atomic_fetch_add(ngx_stat_reading, -1);
|
2007-06-04 16:40:03 -04:00
|
|
|
r->stat_reading = 0;
|
2009-06-18 09:14:51 -04:00
|
|
|
(void) ngx_atomic_fetch_add(ngx_stat_writing, 1);
|
2007-06-04 16:40:03 -04:00
|
|
|
r->stat_writing = 1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
c->read->handler = ngx_http_request_handler;
|
|
|
|
c->write->handler = ngx_http_request_handler;
|
2007-08-06 11:22:40 -04:00
|
|
|
r->read_event_handler = ngx_http_block_reading;
|
2007-06-04 16:40:03 -04:00
|
|
|
|
|
|
|
ngx_http_handler(r);
|
2003-10-21 13:49:56 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
ngx_int_t
|
2013-02-27 14:03:14 -03:00
|
|
|
ngx_http_validate_host(ngx_str_t *host, ngx_pool_t *pool, ngx_uint_t alloc)
|
2004-12-21 09:30:30 -03:00
|
|
|
{
|
2011-11-28 06:15:33 -03:00
|
|
|
u_char *h, ch;
|
|
|
|
size_t i, dot_pos, host_len;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
sw_usual = 0,
|
|
|
|
sw_literal,
|
|
|
|
sw_rest
|
|
|
|
} state;
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
dot_pos = host->len;
|
|
|
|
host_len = host->len;
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
h = host->data;
|
2011-11-28 06:15:33 -03:00
|
|
|
|
|
|
|
state = sw_usual;
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
for (i = 0; i < host->len; i++) {
|
2009-09-24 09:15:50 -04:00
|
|
|
ch = h[i];
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2011-11-28 06:15:33 -03:00
|
|
|
switch (ch) {
|
|
|
|
|
|
|
|
case '.':
|
|
|
|
if (dot_pos == i - 1) {
|
2013-02-27 14:03:14 -03:00
|
|
|
return NGX_DECLINED;
|
2008-05-15 10:44:47 -04:00
|
|
|
}
|
2011-11-28 06:15:33 -03:00
|
|
|
dot_pos = i;
|
|
|
|
break;
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2011-11-28 06:15:33 -03:00
|
|
|
case ':':
|
|
|
|
if (state == sw_usual) {
|
|
|
|
host_len = i;
|
|
|
|
state = sw_rest;
|
|
|
|
}
|
|
|
|
break;
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2011-11-28 06:15:33 -03:00
|
|
|
case '[':
|
|
|
|
if (i == 0) {
|
|
|
|
state = sw_literal;
|
|
|
|
}
|
|
|
|
break;
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2011-11-28 06:15:33 -03:00
|
|
|
case ']':
|
|
|
|
if (state == sw_literal) {
|
|
|
|
host_len = i + 1;
|
|
|
|
state = sw_rest;
|
|
|
|
}
|
|
|
|
break;
|
2008-05-15 10:44:47 -04:00
|
|
|
|
2011-11-28 06:15:33 -03:00
|
|
|
default:
|
|
|
|
|
|
|
|
if (ngx_path_separator(ch)) {
|
2013-02-27 14:03:14 -03:00
|
|
|
return NGX_DECLINED;
|
2011-11-28 06:15:33 -03:00
|
|
|
}
|
|
|
|
|
2021-06-28 11:01:24 -04:00
|
|
|
if (ch <= 0x20 || ch == 0x7f) {
|
|
|
|
return NGX_DECLINED;
|
|
|
|
}
|
|
|
|
|
2011-11-28 06:15:33 -03:00
|
|
|
if (ch >= 'A' && ch <= 'Z') {
|
|
|
|
alloc = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2008-05-15 10:44:47 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-28 06:15:33 -03:00
|
|
|
if (dot_pos == host_len - 1) {
|
|
|
|
host_len--;
|
2008-05-15 10:44:47 -04:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
if (host_len == 0) {
|
|
|
|
return NGX_DECLINED;
|
|
|
|
}
|
|
|
|
|
2009-09-24 09:15:50 -04:00
|
|
|
if (alloc) {
|
2013-02-27 14:03:14 -03:00
|
|
|
host->data = ngx_pnalloc(pool, host_len);
|
|
|
|
if (host->data == NULL) {
|
|
|
|
return NGX_ERROR;
|
2009-09-24 09:15:50 -04:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
ngx_strlow(host->data, h, host_len);
|
2009-09-24 09:15:50 -04:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:03:14 -03:00
|
|
|
host->len = host_len;
|
|
|
|
|
|
|
|
return NGX_OK;
|
2008-05-15 10:44:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
ngx_int_t
|
2013-02-27 14:06:52 -03:00
|
|
|
ngx_http_set_virtual_server(ngx_http_request_t *r, ngx_str_t *host)
|
2008-05-15 10:44:47 -04:00
|
|
|
{
|
2013-02-27 14:06:52 -03:00
|
|
|
ngx_int_t rc;
|
|
|
|
ngx_http_connection_t *hc;
|
2005-12-26 14:07:48 -03:00
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
2013-02-27 13:53:01 -03:00
|
|
|
|
2014-01-31 07:18:52 -03:00
|
|
|
#if (NGX_SUPPRESS_WARN)
|
|
|
|
cscf = NULL;
|
|
|
|
#endif
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
hc = r->http_connection;
|
|
|
|
|
2013-05-11 10:49:30 -04:00
|
|
|
#if (NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME)
|
2013-02-27 14:33:59 -03:00
|
|
|
|
|
|
|
if (hc->ssl_servername) {
|
|
|
|
if (hc->ssl_servername->len == host->len
|
|
|
|
&& ngx_strncmp(hc->ssl_servername->data,
|
|
|
|
host->data, host->len) == 0)
|
|
|
|
{
|
|
|
|
#if (NGX_PCRE)
|
|
|
|
if (hc->ssl_servername_regex
|
|
|
|
&& ngx_http_regex_exec(r, hc->ssl_servername_regex,
|
|
|
|
hc->ssl_servername) != NGX_OK)
|
|
|
|
{
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
rc = ngx_http_find_virtual_server(r->connection,
|
|
|
|
hc->addr_conf->virtual_names,
|
|
|
|
host, r, &cscf);
|
|
|
|
|
|
|
|
if (rc == NGX_ERROR) {
|
|
|
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2013-05-11 10:49:30 -04:00
|
|
|
#if (NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME)
|
2013-02-27 14:38:54 -03:00
|
|
|
|
|
|
|
if (hc->ssl_servername) {
|
2013-02-27 14:41:34 -03:00
|
|
|
ngx_http_ssl_srv_conf_t *sscf;
|
|
|
|
|
2013-02-27 14:38:54 -03:00
|
|
|
if (rc == NGX_DECLINED) {
|
|
|
|
cscf = hc->addr_conf->default_server;
|
|
|
|
rc = NGX_OK;
|
|
|
|
}
|
2013-02-27 14:41:34 -03:00
|
|
|
|
|
|
|
sscf = ngx_http_get_module_srv_conf(cscf->ctx, ngx_http_ssl_module);
|
|
|
|
|
|
|
|
if (sscf->verify) {
|
|
|
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
|
|
|
"client attempted to request the server name "
|
2016-06-07 10:44:20 -04:00
|
|
|
"different from the one that was negotiated");
|
2016-05-20 11:41:17 -04:00
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_MISDIRECTED_REQUEST);
|
2013-02-27 14:41:34 -03:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2013-02-27 14:38:54 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
if (rc == NGX_DECLINED) {
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->srv_conf = cscf->ctx->srv_conf;
|
|
|
|
r->loc_conf = cscf->ctx->loc_conf;
|
|
|
|
|
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
|
|
|
|
2015-04-25 16:44:02 -03:00
|
|
|
ngx_set_connection_log(r->connection, clcf->error_log);
|
2013-02-27 14:06:52 -03:00
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static ngx_int_t
|
|
|
|
ngx_http_find_virtual_server(ngx_connection_t *c,
|
|
|
|
ngx_http_virtual_names_t *virtual_names, ngx_str_t *host,
|
|
|
|
ngx_http_request_t *r, ngx_http_core_srv_conf_t **cscfp)
|
|
|
|
{
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
2004-12-21 09:30:30 -03:00
|
|
|
|
2013-02-27 13:53:01 -03:00
|
|
|
if (virtual_names == NULL) {
|
2008-05-15 10:44:47 -04:00
|
|
|
return NGX_DECLINED;
|
|
|
|
}
|
|
|
|
|
2013-02-27 13:53:01 -03:00
|
|
|
cscf = ngx_hash_find_combined(&virtual_names->names,
|
2013-02-27 14:06:52 -03:00
|
|
|
ngx_hash_key(host->data, host->len),
|
|
|
|
host->data, host->len);
|
2004-12-21 09:30:30 -03:00
|
|
|
|
2007-06-11 15:49:22 -04:00
|
|
|
if (cscf) {
|
2013-02-27 14:06:52 -03:00
|
|
|
*cscfp = cscf;
|
|
|
|
return NGX_OK;
|
2004-12-21 09:30:30 -03:00
|
|
|
}
|
|
|
|
|
2007-08-12 15:48:12 -04:00
|
|
|
#if (NGX_PCRE)
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
if (host->len && virtual_names->nregex) {
|
2007-12-10 09:09:51 -03:00
|
|
|
ngx_int_t n;
|
|
|
|
ngx_uint_t i;
|
|
|
|
ngx_http_server_name_t *sn;
|
2007-08-12 15:48:12 -04:00
|
|
|
|
2013-02-27 13:53:01 -03:00
|
|
|
sn = virtual_names->regex;
|
2007-08-12 15:48:12 -04:00
|
|
|
|
2013-05-11 10:49:30 -04:00
|
|
|
#if (NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME)
|
2013-02-27 14:06:52 -03:00
|
|
|
|
|
|
|
if (r == NULL) {
|
2013-02-27 14:33:59 -03:00
|
|
|
ngx_http_connection_t *hc;
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
for (i = 0; i < virtual_names->nregex; i++) {
|
2007-08-12 15:48:12 -04:00
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
n = ngx_regex_exec(sn[i].regex->regex, host, NULL, 0);
|
2009-03-06 09:50:20 -03:00
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
if (n == NGX_REGEX_NO_MATCHED) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n >= 0) {
|
2013-02-27 14:33:59 -03:00
|
|
|
hc = c->data;
|
|
|
|
hc->ssl_servername_regex = sn[i].regex;
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
*cscfp = sn[i].server;
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
|
|
|
|
ngx_regex_exec_n " failed: %i "
|
|
|
|
"on \"%V\" using \"%V\"",
|
|
|
|
n, host, &sn[i].regex->name);
|
|
|
|
|
|
|
|
return NGX_ERROR;
|
2009-03-06 09:50:20 -03:00
|
|
|
}
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
return NGX_DECLINED;
|
|
|
|
}
|
|
|
|
|
2013-05-11 10:49:30 -04:00
|
|
|
#endif /* NGX_HTTP_SSL && defined SSL_CTRL_SET_TLSEXT_HOSTNAME */
|
2013-02-27 14:06:52 -03:00
|
|
|
|
|
|
|
for (i = 0; i < virtual_names->nregex; i++) {
|
|
|
|
|
|
|
|
n = ngx_http_regex_exec(r, sn[i].regex, host);
|
|
|
|
|
2009-11-16 09:19:02 -03:00
|
|
|
if (n == NGX_DECLINED) {
|
2007-08-12 15:48:12 -04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
if (n == NGX_OK) {
|
|
|
|
*cscfp = sn[i].server;
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-16 09:19:02 -03:00
|
|
|
return NGX_ERROR;
|
2007-08-12 15:48:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:06:52 -03:00
|
|
|
#endif /* NGX_PCRE */
|
2007-08-12 15:48:12 -04:00
|
|
|
|
2012-07-30 07:42:03 -04:00
|
|
|
return NGX_DECLINED;
|
2004-12-21 09:30:30 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
static void
|
|
|
|
ngx_http_request_handler(ngx_event_t *ev)
|
|
|
|
{
|
|
|
|
ngx_connection_t *c;
|
|
|
|
ngx_http_request_t *r;
|
|
|
|
|
|
|
|
c = ev->data;
|
|
|
|
r = c->data;
|
|
|
|
|
2014-12-01 23:54:54 -03:00
|
|
|
ngx_http_set_log_request(c->log, r);
|
2006-07-11 09:20:19 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"http run request: \"%V?%V\"", &r->uri, &r->args);
|
|
|
|
|
2017-11-20 10:31:07 -03:00
|
|
|
if (c->close) {
|
|
|
|
r->main->count++;
|
|
|
|
ngx_http_terminate_request(r, 0);
|
|
|
|
ngx_http_run_posted_requests(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-04-02 08:32:29 -03:00
|
|
|
if (ev->delayed && ev->timedout) {
|
|
|
|
ev->delayed = 0;
|
|
|
|
ev->timedout = 0;
|
|
|
|
}
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
if (ev->write) {
|
|
|
|
r->write_event_handler(r);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
r->read_event_handler(r);
|
|
|
|
}
|
2008-12-08 11:23:20 -03:00
|
|
|
|
|
|
|
ngx_http_run_posted_requests(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ngx_http_run_posted_requests(ngx_connection_t *c)
|
|
|
|
{
|
|
|
|
ngx_http_request_t *r;
|
|
|
|
ngx_http_posted_request_t *pr;
|
|
|
|
|
|
|
|
for ( ;; ) {
|
|
|
|
|
|
|
|
if (c->destroyed) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = c->data;
|
|
|
|
pr = r->main->posted_requests;
|
|
|
|
|
|
|
|
if (pr == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->main->posted_requests = pr->next;
|
|
|
|
|
|
|
|
r = pr->request;
|
|
|
|
|
2014-12-01 23:54:54 -03:00
|
|
|
ngx_http_set_log_request(c->log, r);
|
2008-12-08 11:23:20 -03:00
|
|
|
|
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"http posted request: \"%V?%V\"", &r->uri, &r->args);
|
|
|
|
|
|
|
|
r->write_event_handler(r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ngx_int_t
|
2009-08-30 05:47:11 -04:00
|
|
|
ngx_http_post_request(ngx_http_request_t *r, ngx_http_posted_request_t *pr)
|
2008-12-08 11:23:20 -03:00
|
|
|
{
|
2009-08-30 05:47:11 -04:00
|
|
|
ngx_http_posted_request_t **p;
|
2008-12-08 11:23:20 -03:00
|
|
|
|
|
|
|
if (pr == NULL) {
|
2009-08-30 05:47:11 -04:00
|
|
|
pr = ngx_palloc(r->pool, sizeof(ngx_http_posted_request_t));
|
|
|
|
if (pr == NULL) {
|
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
2008-12-08 11:23:20 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
pr->request = r;
|
|
|
|
pr->next = NULL;
|
|
|
|
|
|
|
|
for (p = &r->main->posted_requests; *p; p = &(*p)->next) { /* void */ }
|
|
|
|
|
|
|
|
*p = pr;
|
|
|
|
|
|
|
|
return NGX_OK;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
void
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
2002-12-10 15:05:12 -03:00
|
|
|
{
|
2007-08-27 11:53:00 -04:00
|
|
|
ngx_connection_t *c;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
ngx_http_request_t *pr;
|
2003-12-14 17:10:27 -03:00
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
c = r->connection;
|
|
|
|
|
|
|
|
ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
2016-03-30 20:33:57 -03:00
|
|
|
"http finalize request: %i, \"%V?%V\" a:%d, c:%d",
|
2009-08-26 12:04:05 -04:00
|
|
|
rc, &r->uri, &r->args, r == c->data, r->main->count);
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
if (rc == NGX_DONE) {
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_finalize_connection(r);
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-05-08 10:25:51 -04:00
|
|
|
if (rc == NGX_OK && r->filter_finalize) {
|
|
|
|
c->error = 1;
|
|
|
|
}
|
|
|
|
|
2006-08-30 06:39:17 -04:00
|
|
|
if (rc == NGX_DECLINED) {
|
|
|
|
r->content_handler = NULL;
|
|
|
|
r->write_event_handler = ngx_http_core_run_phases;
|
|
|
|
ngx_http_core_run_phases(r);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-10-13 11:20:10 -04:00
|
|
|
if (r != r->main && r->post_subrequest) {
|
|
|
|
rc = r->post_subrequest->handler(r, r->post_subrequest->data, rc);
|
2006-07-28 11:16:17 -04:00
|
|
|
}
|
|
|
|
|
2007-12-27 10:13:34 -03:00
|
|
|
if (rc == NGX_ERROR
|
|
|
|
|| rc == NGX_HTTP_REQUEST_TIME_OUT
|
|
|
|
|| rc == NGX_HTTP_CLIENT_CLOSED_REQUEST
|
|
|
|
|| c->error)
|
|
|
|
{
|
2006-02-16 12:26:46 -03:00
|
|
|
if (ngx_http_post_action(r) == NGX_OK) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_terminate_request(r, rc);
|
2005-10-24 12:09:41 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-04-19 11:30:56 -04:00
|
|
|
if (rc >= NGX_HTTP_SPECIAL_RESPONSE
|
|
|
|
|| rc == NGX_HTTP_CREATED
|
|
|
|
|| rc == NGX_HTTP_NO_CONTENT)
|
|
|
|
{
|
2005-12-07 11:51:31 -03:00
|
|
|
if (rc == NGX_HTTP_CLOSE) {
|
2018-07-12 05:50:20 -04:00
|
|
|
c->timedout = 1;
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_terminate_request(r, rc);
|
2005-12-07 11:51:31 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-11 12:26:57 -03:00
|
|
|
if (r == r->main) {
|
2007-08-27 11:53:00 -04:00
|
|
|
if (c->read->timer_set) {
|
|
|
|
ngx_del_timer(c->read);
|
2005-10-24 12:09:41 -03:00
|
|
|
}
|
|
|
|
|
2007-08-27 11:53:00 -04:00
|
|
|
if (c->write->timer_set) {
|
|
|
|
ngx_del_timer(c->write);
|
2005-10-24 12:09:41 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-15 12:44:37 -04:00
|
|
|
c->read->handler = ngx_http_request_handler;
|
|
|
|
c->write->handler = ngx_http_request_handler;
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc));
|
2003-10-09 03:00:45 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (r != r->main) {
|
2008-09-29 09:18:41 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (r->buffered || r->postponed) {
|
2008-09-29 09:18:41 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (ngx_http_set_write_handler(r) != NGX_OK) {
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_terminate_request(r, 0);
|
2008-12-08 11:23:20 -03:00
|
|
|
}
|
2008-09-29 09:18:41 -04:00
|
|
|
|
2005-06-23 09:41:06 -04:00
|
|
|
return;
|
|
|
|
}
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
pr = r->parent;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2020-02-28 13:54:13 -03:00
|
|
|
if (r == c->data || r->background) {
|
2009-08-26 12:04:05 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (!r->logged) {
|
2020-02-28 13:54:13 -03:00
|
|
|
|
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (clcf->log_subrequest) {
|
|
|
|
ngx_http_log_request(r);
|
|
|
|
}
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
r->logged = 1;
|
2006-07-11 09:20:19 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
} else {
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
|
|
|
|
"subrequest: \"%V?%V\" logged again",
|
|
|
|
&r->uri, &r->args);
|
|
|
|
}
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
r->done = 1;
|
2005-07-08 10:34:20 -04:00
|
|
|
|
2020-02-28 13:54:13 -03:00
|
|
|
if (r->background) {
|
|
|
|
ngx_http_finalize_connection(r);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->main->count--;
|
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (pr->postponed && pr->postponed->request == r) {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
pr->postponed = pr->postponed->next;
|
2006-01-11 12:26:57 -03:00
|
|
|
}
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
c->data = pr;
|
2006-05-04 11:32:46 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
} else {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2012-04-27 07:48:42 -03:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"http finalize non-active request: \"%V?%V\"",
|
|
|
|
&r->uri, &r->args);
|
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
r->write_event_handler = ngx_http_request_finalizer;
|
2006-01-11 12:26:57 -03:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (r->waited) {
|
|
|
|
r->done = 1;
|
2006-05-04 11:32:46 -04:00
|
|
|
}
|
2008-09-27 11:08:02 -04:00
|
|
|
}
|
|
|
|
|
2009-08-30 05:47:11 -04:00
|
|
|
if (ngx_http_post_request(pr, NULL) != NGX_OK) {
|
2009-08-26 12:04:05 -04:00
|
|
|
r->main->count++;
|
|
|
|
ngx_http_terminate_request(r, 0);
|
2008-12-08 11:23:20 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"http wake parent request: \"%V?%V\"",
|
|
|
|
&pr->uri, &pr->args);
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
return;
|
|
|
|
}
|
2003-10-27 05:53:49 -03:00
|
|
|
|
2017-05-29 16:33:38 -04:00
|
|
|
if (r->buffered || c->buffered || r->postponed) {
|
2008-12-08 11:23:20 -03:00
|
|
|
|
|
|
|
if (ngx_http_set_write_handler(r) != NGX_OK) {
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_terminate_request(r, 0);
|
2008-12-08 11:23:20 -03:00
|
|
|
}
|
|
|
|
|
2003-10-10 11:10:50 -04:00
|
|
|
return;
|
2005-07-08 10:34:20 -04:00
|
|
|
}
|
2003-10-09 03:00:45 -04:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (r != c->data) {
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
|
|
|
|
"http finalize non-active request: \"%V?%V\"",
|
|
|
|
&r->uri, &r->args);
|
2003-10-10 11:10:50 -04:00
|
|
|
return;
|
2003-03-20 12:09:44 -04:00
|
|
|
}
|
2002-12-10 15:05:12 -03:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
r->done = 1;
|
2017-05-25 08:57:59 -04:00
|
|
|
|
|
|
|
r->read_event_handler = ngx_http_block_reading;
|
2010-01-28 05:33:24 -03:00
|
|
|
r->write_event_handler = ngx_http_request_empty_handler;
|
2008-12-08 11:23:20 -03:00
|
|
|
|
2006-04-05 09:40:54 -04:00
|
|
|
if (!r->post_action) {
|
|
|
|
r->request_complete = 1;
|
|
|
|
}
|
|
|
|
|
2006-02-16 12:26:46 -03:00
|
|
|
if (ngx_http_post_action(r) == NGX_OK) {
|
2005-11-15 10:30:52 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-08-27 11:53:00 -04:00
|
|
|
if (c->read->timer_set) {
|
|
|
|
ngx_del_timer(c->read);
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
2002-12-10 15:05:12 -03:00
|
|
|
|
2007-08-27 11:53:00 -04:00
|
|
|
if (c->write->timer_set) {
|
|
|
|
c->write->delayed = 0;
|
|
|
|
ngx_del_timer(c->write);
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
2002-12-10 15:05:12 -03:00
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_finalize_connection(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
ngx_http_terminate_request(ngx_http_request_t *r, ngx_int_t rc)
|
|
|
|
{
|
2009-08-30 05:47:11 -04:00
|
|
|
ngx_http_cleanup_t *cln;
|
|
|
|
ngx_http_request_t *mr;
|
|
|
|
ngx_http_ephemeral_t *e;
|
2009-08-26 12:04:05 -04:00
|
|
|
|
|
|
|
mr = r->main;
|
|
|
|
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2009-08-28 04:12:35 -04:00
|
|
|
"http terminate request count:%d", mr->count);
|
2009-08-26 12:04:05 -04:00
|
|
|
|
2009-09-30 08:05:08 -04:00
|
|
|
if (rc > 0 && (mr->headers_out.status == 0 || mr->connection->sent == 0)) {
|
|
|
|
mr->headers_out.status = rc;
|
|
|
|
}
|
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
cln = mr->cleanup;
|
|
|
|
mr->cleanup = NULL;
|
|
|
|
|
|
|
|
while (cln) {
|
|
|
|
if (cln->handler) {
|
|
|
|
cln->handler(cln->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
cln = cln->next;
|
|
|
|
}
|
|
|
|
|
2009-08-28 04:12:35 -04:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
|
|
"http terminate cleanup count:%d blk:%d",
|
|
|
|
mr->count, mr->blocked);
|
2009-08-26 12:04:05 -04:00
|
|
|
|
|
|
|
if (mr->write_event_handler) {
|
2009-08-28 04:12:35 -04:00
|
|
|
|
|
|
|
if (mr->blocked) {
|
2017-05-29 16:33:38 -04:00
|
|
|
r->connection->error = 1;
|
|
|
|
r->write_event_handler = ngx_http_request_finalizer;
|
2009-08-28 04:12:35 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-08-30 05:47:11 -04:00
|
|
|
e = ngx_http_ephemeral(mr);
|
2009-08-28 03:50:45 -04:00
|
|
|
mr->posted_requests = NULL;
|
|
|
|
mr->write_event_handler = ngx_http_terminate_handler;
|
2009-08-30 05:47:11 -04:00
|
|
|
(void) ngx_http_post_request(mr, &e->terminal_posted_request);
|
2009-08-26 12:04:05 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ngx_http_close_request(mr, rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
ngx_http_terminate_handler(ngx_http_request_t *r)
|
|
|
|
{
|
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2009-08-28 04:12:35 -04:00
|
|
|
"http terminate handler count:%d", r->count);
|
2009-08-26 12:04:05 -04:00
|
|
|
|
|
|
|
r->count = 1;
|
|
|
|
|
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
ngx_http_finalize_connection(ngx_http_request_t *r)
|
|
|
|
{
|
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
|
|
|
|
2015-09-11 14:13:06 -03:00
|
|
|
#if (NGX_HTTP_V2)
|
|
|
|
if (r->stream) {
|
2013-03-20 07:36:57 -03:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-06 07:02:36 -03:00
|
|
|
#if (NGX_HTTP_V3)
|
2020-11-10 16:40:00 -03:00
|
|
|
if (r->connection->quic) {
|
2020-08-25 05:45:21 -04:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-19 11:08:09 -03:00
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
if (r->main->count != 1) {
|
2009-10-19 11:08:09 -03:00
|
|
|
|
2009-10-19 13:12:13 -03:00
|
|
|
if (r->discard_body) {
|
|
|
|
r->read_event_handler = ngx_http_discarded_request_body_handler;
|
2011-08-01 09:52:54 -04:00
|
|
|
ngx_add_timer(r->connection->read, clcf->lingering_timeout);
|
2009-10-19 13:12:13 -03:00
|
|
|
|
|
|
|
if (r->lingering_time == 0) {
|
|
|
|
r->lingering_time = ngx_time()
|
2009-10-19 11:08:09 -03:00
|
|
|
+ (time_t) (clcf->lingering_time / 1000);
|
2009-10-19 13:12:13 -03:00
|
|
|
}
|
2009-10-19 11:08:09 -03:00
|
|
|
}
|
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-25 08:57:59 -04:00
|
|
|
r = r->main;
|
|
|
|
|
2021-03-24 08:03:33 -03:00
|
|
|
if (r->connection->read->eof) {
|
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-03-23 15:09:19 -03:00
|
|
|
if (r->reading_body) {
|
|
|
|
r->keepalive = 0;
|
|
|
|
r->lingering_close = 1;
|
|
|
|
}
|
|
|
|
|
2004-01-16 03:15:48 -03:00
|
|
|
if (!ngx_terminate
|
2004-04-25 16:13:21 -04:00
|
|
|
&& !ngx_exiting
|
2008-05-21 13:39:51 -04:00
|
|
|
&& r->keepalive
|
2004-01-16 03:15:48 -03:00
|
|
|
&& clcf->keepalive_timeout > 0)
|
|
|
|
{
|
2003-05-13 12:02:32 -04:00
|
|
|
ngx_http_set_keepalive(r);
|
2004-01-16 03:15:48 -03:00
|
|
|
return;
|
2011-08-01 09:26:55 -04:00
|
|
|
}
|
2002-12-10 15:05:12 -03:00
|
|
|
|
2011-08-01 09:26:55 -04:00
|
|
|
if (clcf->lingering_close == NGX_HTTP_LINGERING_ALWAYS
|
|
|
|
|| (clcf->lingering_close == NGX_HTTP_LINGERING_ON
|
|
|
|
&& (r->lingering_close
|
|
|
|
|| r->header_in->pos < r->header_in->last
|
|
|
|
|| r->connection->read->ready)))
|
2011-08-01 07:08:57 -04:00
|
|
|
{
|
2020-11-06 17:44:54 -03:00
|
|
|
ngx_http_set_lingering_close(r->connection);
|
2004-01-16 03:15:48 -03:00
|
|
|
return;
|
2003-03-20 12:09:44 -04:00
|
|
|
}
|
2003-10-09 03:00:45 -04:00
|
|
|
|
2004-01-16 03:15:48 -03:00
|
|
|
ngx_http_close_request(r, 0);
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2005-06-23 09:41:06 -04:00
|
|
|
static ngx_int_t
|
2005-03-19 08:38:37 -04:00
|
|
|
ngx_http_set_write_handler(ngx_http_request_t *r)
|
2003-05-13 12:02:32 -04:00
|
|
|
{
|
|
|
|
ngx_event_t *wev;
|
2003-05-19 12:39:14 -04:00
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2004-06-25 10:42:03 -04:00
|
|
|
r->http_state = NGX_HTTP_WRITING_REQUEST_STATE;
|
|
|
|
|
2009-10-19 13:13:38 -03:00
|
|
|
r->read_event_handler = r->discard_body ?
|
|
|
|
ngx_http_discarded_request_body_handler:
|
|
|
|
ngx_http_test_reading;
|
2005-06-23 09:41:06 -04:00
|
|
|
r->write_event_handler = ngx_http_writer;
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
wev = r->connection->write;
|
|
|
|
|
2004-06-21 11:59:32 -04:00
|
|
|
if (wev->ready && wev->delayed) {
|
2005-06-23 09:41:06 -04:00
|
|
|
return NGX_OK;
|
2003-04-17 13:59:35 -04:00
|
|
|
}
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
2004-06-21 11:59:32 -04:00
|
|
|
if (!wev->delayed) {
|
2004-06-20 15:54:15 -04:00
|
|
|
ngx_add_timer(wev, clcf->send_timeout);
|
|
|
|
}
|
2003-02-06 14:21:13 -03:00
|
|
|
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
|
2003-10-10 11:10:50 -04:00
|
|
|
ngx_http_close_request(r, 0);
|
2005-06-23 09:41:06 -04:00
|
|
|
return NGX_ERROR;
|
2003-10-10 11:10:50 -04:00
|
|
|
}
|
2005-06-23 09:41:06 -04:00
|
|
|
|
|
|
|
return NGX_OK;
|
2002-12-10 15:05:12 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
static void
|
|
|
|
ngx_http_writer(ngx_http_request_t *r)
|
2002-12-15 03:25:09 -03:00
|
|
|
{
|
2017-04-03 03:29:40 -03:00
|
|
|
ngx_int_t rc;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
ngx_event_t *wev;
|
2002-12-15 03:25:09 -03:00
|
|
|
ngx_connection_t *c;
|
2003-05-27 08:18:54 -04:00
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
2002-12-15 03:25:09 -03:00
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
c = r->connection;
|
|
|
|
wev = c->write;
|
2003-11-19 13:26:41 -03:00
|
|
|
|
2005-12-05 10:18:09 -03:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, wev->log, 0,
|
|
|
|
"http writer handler: \"%V?%V\"", &r->uri, &r->args);
|
2002-12-15 03:25:09 -03:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
clcf = ngx_http_get_module_loc_conf(r->main, ngx_http_core_module);
|
|
|
|
|
2003-10-27 05:53:49 -03:00
|
|
|
if (wev->timedout) {
|
2017-04-02 08:32:29 -03:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
|
|
|
|
"client timed out");
|
|
|
|
c->timedout = 1;
|
2004-06-20 15:54:15 -04:00
|
|
|
|
2017-04-02 08:32:29 -03:00
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT);
|
|
|
|
return;
|
2011-10-11 15:00:23 -03:00
|
|
|
}
|
2004-06-21 11:59:32 -04:00
|
|
|
|
2011-10-11 15:00:23 -03:00
|
|
|
if (wev->delayed || r->aio) {
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
|
|
|
|
"http writer delayed");
|
2004-06-21 11:59:32 -04:00
|
|
|
|
2017-04-02 08:32:29 -03:00
|
|
|
if (!wev->delayed) {
|
|
|
|
ngx_add_timer(wev, clcf->send_timeout);
|
|
|
|
}
|
|
|
|
|
2011-10-11 15:00:23 -03:00
|
|
|
if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
|
|
|
|
ngx_http_close_request(r, 0);
|
2004-06-20 15:54:15 -04:00
|
|
|
}
|
2011-10-11 15:00:23 -03:00
|
|
|
|
|
|
|
return;
|
2003-10-27 05:53:49 -03:00
|
|
|
}
|
|
|
|
|
2005-12-05 10:18:09 -03:00
|
|
|
rc = ngx_http_output_filter(r, NULL);
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
2005-12-05 10:18:09 -03:00
|
|
|
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
2017-04-03 03:29:40 -03:00
|
|
|
"http writer output filter: %i, \"%V?%V\"",
|
2005-12-05 10:18:09 -03:00
|
|
|
rc, &r->uri, &r->args);
|
2002-12-15 03:25:09 -03:00
|
|
|
|
2009-05-25 05:56:01 -04:00
|
|
|
if (rc == NGX_ERROR) {
|
|
|
|
ngx_http_finalize_request(r, rc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
if (r->buffered || r->postponed || (r == r->main && c->buffered)) {
|
|
|
|
|
2011-10-11 14:58:51 -03:00
|
|
|
if (!wev->delayed) {
|
2003-10-12 13:49:16 -03:00
|
|
|
ngx_add_timer(wev, clcf->send_timeout);
|
2002-12-15 03:25:09 -03:00
|
|
|
}
|
|
|
|
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
|
2005-10-24 12:09:41 -03:00
|
|
|
ngx_http_close_request(r, 0);
|
2003-10-12 13:49:16 -03:00
|
|
|
}
|
2002-12-15 03:25:09 -03:00
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
return;
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
2002-12-15 03:25:09 -03:00
|
|
|
|
2005-12-05 10:18:09 -03:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, wev->log, 0,
|
|
|
|
"http writer done: \"%V?%V\"", &r->uri, &r->args);
|
2002-12-15 03:25:09 -03:00
|
|
|
|
2009-10-20 08:48:28 -03:00
|
|
|
r->write_event_handler = ngx_http_request_empty_handler;
|
|
|
|
|
2003-10-12 13:49:16 -03:00
|
|
|
ngx_http_finalize_request(r, rc);
|
2003-05-12 11:52:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-08 11:23:20 -03:00
|
|
|
static void
|
|
|
|
ngx_http_request_finalizer(ngx_http_request_t *r)
|
|
|
|
{
|
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
|
|
"http finalizer done: \"%V?%V\"", &r->uri, &r->args);
|
|
|
|
|
|
|
|
ngx_http_finalize_request(r, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-06 11:22:40 -04:00
|
|
|
void
|
|
|
|
ngx_http_block_reading(ngx_http_request_t *r)
|
2007-07-10 16:53:45 -04:00
|
|
|
{
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2007-08-06 11:22:40 -04:00
|
|
|
"http reading blocked");
|
2007-07-10 16:53:45 -04:00
|
|
|
|
|
|
|
/* aio does not call this handler */
|
|
|
|
|
|
|
|
if ((ngx_event_flags & NGX_USE_LEVEL_EVENT)
|
|
|
|
&& r->connection->read->active)
|
|
|
|
{
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_del_event(r->connection->read, NGX_READ_EVENT, 0) != NGX_OK) {
|
2007-07-10 16:53:45 -04:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-10 12:22:33 -03:00
|
|
|
void
|
2007-08-06 11:22:40 -04:00
|
|
|
ngx_http_test_reading(ngx_http_request_t *r)
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
{
|
2007-01-19 05:10:06 -03:00
|
|
|
int n;
|
|
|
|
char buf[1];
|
|
|
|
ngx_err_t err;
|
|
|
|
ngx_event_t *rev;
|
|
|
|
ngx_connection_t *c;
|
|
|
|
|
|
|
|
c = r->connection;
|
|
|
|
rev = c->read;
|
|
|
|
|
2007-08-06 11:22:40 -04:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http test reading");
|
2007-01-19 05:10:06 -03:00
|
|
|
|
2015-09-11 14:13:06 -03:00
|
|
|
#if (NGX_HTTP_V2)
|
2013-03-20 07:36:57 -03:00
|
|
|
|
2015-09-11 14:13:06 -03:00
|
|
|
if (r->stream) {
|
2013-03-20 07:36:57 -03:00
|
|
|
if (c->error) {
|
|
|
|
err = 0;
|
|
|
|
goto closed;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-12-06 07:02:36 -03:00
|
|
|
#if (NGX_HTTP_V3)
|
2020-08-11 03:41:39 -04:00
|
|
|
|
2020-11-10 16:40:00 -03:00
|
|
|
if (c->quic) {
|
2022-01-12 05:57:06 -03:00
|
|
|
if (rev->error) {
|
2022-01-12 05:57:46 -03:00
|
|
|
c->error = 1;
|
2020-08-11 03:41:39 -04:00
|
|
|
err = 0;
|
|
|
|
goto closed;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2007-01-19 05:10:06 -03:00
|
|
|
#if (NGX_HAVE_KQUEUE)
|
|
|
|
|
|
|
|
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
|
|
|
|
|
|
|
|
if (!rev->pending_eof) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rev->eof = 1;
|
|
|
|
c->error = 1;
|
|
|
|
err = rev->kq_errno;
|
|
|
|
|
|
|
|
goto closed;
|
|
|
|
}
|
|
|
|
|
2013-09-16 11:33:39 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (NGX_HAVE_EPOLLRDHUP)
|
|
|
|
|
2016-05-13 11:19:23 -03:00
|
|
|
if ((ngx_event_flags & NGX_USE_EPOLL_EVENT) && ngx_use_epoll_rdhup) {
|
2013-09-16 11:33:39 -03:00
|
|
|
socklen_t len;
|
|
|
|
|
2016-05-13 11:19:23 -03:00
|
|
|
if (!rev->pending_eof) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-09-16 11:33:39 -03:00
|
|
|
rev->eof = 1;
|
|
|
|
c->error = 1;
|
|
|
|
|
|
|
|
err = 0;
|
|
|
|
len = sizeof(ngx_err_t);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* BSDs and Linux return 0 and set a pending error in err
|
|
|
|
* Solaris returns -1 and sets errno
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len)
|
|
|
|
== -1)
|
|
|
|
{
|
2014-02-03 19:17:17 -03:00
|
|
|
err = ngx_socket_errno;
|
2013-09-16 11:33:39 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
goto closed;
|
|
|
|
}
|
|
|
|
|
2007-01-19 05:10:06 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
n = recv(c->fd, buf, 1, MSG_PEEK);
|
|
|
|
|
|
|
|
if (n == 0) {
|
|
|
|
rev->eof = 1;
|
|
|
|
c->error = 1;
|
|
|
|
err = 0;
|
|
|
|
|
|
|
|
goto closed;
|
|
|
|
|
|
|
|
} else if (n == -1) {
|
|
|
|
err = ngx_socket_errno;
|
|
|
|
|
|
|
|
if (err != NGX_EAGAIN) {
|
|
|
|
rev->eof = 1;
|
|
|
|
c->error = 1;
|
|
|
|
|
|
|
|
goto closed;
|
|
|
|
}
|
|
|
|
}
|
2002-12-10 15:05:12 -03:00
|
|
|
|
2003-02-06 14:21:13 -03:00
|
|
|
/* aio does not call this handler */
|
|
|
|
|
2007-01-19 05:10:06 -03:00
|
|
|
if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && rev->active) {
|
|
|
|
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_del_event(rev, NGX_READ_EVENT, 0) != NGX_OK) {
|
2003-05-15 11:42:53 -04:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
}
|
2003-02-06 14:21:13 -03:00
|
|
|
}
|
2007-01-19 05:10:06 -03:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
closed:
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
rev->error = 1;
|
|
|
|
}
|
|
|
|
|
2020-08-10 11:52:34 -04:00
|
|
|
#if (NGX_HTTP_SSL)
|
|
|
|
if (c->ssl) {
|
|
|
|
c->ssl->no_send_shutdown = 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-01-19 05:10:06 -03:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, err,
|
2012-04-12 16:35:41 -03:00
|
|
|
"client prematurely closed connection");
|
2007-01-19 05:10:06 -03:00
|
|
|
|
2013-06-14 12:56:07 -04:00
|
|
|
ngx_http_finalize_request(r, NGX_HTTP_CLIENT_CLOSED_REQUEST);
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
|
|
|
|
2003-05-15 11:42:53 -04:00
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static void
|
|
|
|
ngx_http_set_keepalive(ngx_http_request_t *r)
|
2003-02-11 04:14:40 -03:00
|
|
|
{
|
2004-10-11 12:07:03 -03:00
|
|
|
int tcp_nodelay;
|
2004-09-23 02:32:00 -04:00
|
|
|
ngx_buf_t *b, *f;
|
2017-03-07 12:49:31 -03:00
|
|
|
ngx_chain_t *cl, *ln;
|
2003-05-23 07:53:01 -04:00
|
|
|
ngx_event_t *rev, *wev;
|
|
|
|
ngx_connection_t *c;
|
2004-09-21 01:38:28 -04:00
|
|
|
ngx_http_connection_t *hc;
|
2003-05-23 07:53:01 -04:00
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
2003-02-11 04:14:40 -03:00
|
|
|
|
2003-05-27 08:18:54 -04:00
|
|
|
c = r->connection;
|
2003-03-05 03:37:42 -03:00
|
|
|
rev = c->read;
|
2003-02-11 04:14:40 -03:00
|
|
|
|
2007-08-07 06:53:27 -04:00
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
|
|
|
|
2004-01-26 05:52:49 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "set http keepalive handler");
|
2003-05-22 11:23:47 -04:00
|
|
|
|
2005-01-25 09:27:35 -03:00
|
|
|
c->log->action = "closing request";
|
2004-09-21 01:38:28 -04:00
|
|
|
|
|
|
|
hc = r->http_connection;
|
2004-09-23 02:32:00 -04:00
|
|
|
b = r->header_in;
|
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
if (b->pos < b->last) {
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
/* the pipelined request */
|
2004-09-23 02:32:00 -04:00
|
|
|
|
|
|
|
if (b != c->buffer) {
|
|
|
|
|
2004-10-21 12:34:38 -03:00
|
|
|
/*
|
|
|
|
* If the large header buffers were allocated while the previous
|
|
|
|
* request processing then we do not use c->buffer for
|
2013-03-07 15:14:27 -03:00
|
|
|
* the pipelined request (see ngx_http_create_request()).
|
2005-11-15 10:30:52 -03:00
|
|
|
*
|
2004-10-21 12:34:38 -03:00
|
|
|
* Now we would move the large header buffers to the free list.
|
|
|
|
*/
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
for (cl = hc->busy; cl; /* void */) {
|
|
|
|
ln = cl;
|
|
|
|
cl = cl->next;
|
2004-09-23 12:39:34 -04:00
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
if (ln->buf == b) {
|
|
|
|
ngx_free_chain(c->pool, ln);
|
|
|
|
continue;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
f = ln->buf;
|
2004-09-23 02:32:00 -04:00
|
|
|
f->pos = f->start;
|
|
|
|
f->last = f->start;
|
2017-03-07 12:49:31 -03:00
|
|
|
|
|
|
|
ln->next = hc->free;
|
|
|
|
hc->free = ln;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
cl = ngx_alloc_chain_link(c->pool);
|
|
|
|
if (cl == NULL) {
|
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl->buf = b;
|
2017-03-24 10:26:12 -03:00
|
|
|
cl->next = NULL;
|
2017-03-07 12:49:31 -03:00
|
|
|
|
|
|
|
hc->busy = cl;
|
2004-09-23 02:32:00 -04:00
|
|
|
hc->nbusy = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-01 11:55:42 -03:00
|
|
|
/* guard against recursive call from ngx_http_finalize_connection() */
|
2009-10-02 07:30:47 -04:00
|
|
|
r->keepalive = 0;
|
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_free_request(r, 0);
|
2005-10-24 12:09:41 -03:00
|
|
|
|
2004-09-21 01:38:28 -04:00
|
|
|
c->data = hc;
|
2003-03-11 16:38:13 -04:00
|
|
|
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
2003-10-12 13:49:16 -03:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
2003-03-11 16:38:13 -04:00
|
|
|
}
|
2003-02-11 04:14:40 -03:00
|
|
|
|
2004-02-12 17:57:10 -03:00
|
|
|
wev = c->write;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
wev->handler = ngx_http_empty_handler;
|
2003-03-05 03:37:42 -03:00
|
|
|
|
2004-05-28 11:49:23 -04:00
|
|
|
if (b->pos < b->last) {
|
2003-03-05 03:37:42 -03:00
|
|
|
|
2004-01-26 05:52:49 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request");
|
2003-05-27 08:18:54 -04:00
|
|
|
|
2005-01-25 09:27:35 -03:00
|
|
|
c->log->action = "reading client pipelined request line";
|
2005-10-21 16:12:18 -03:00
|
|
|
|
2013-03-07 15:14:27 -03:00
|
|
|
r = ngx_http_create_request(c);
|
|
|
|
if (r == NULL) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->pipeline = 1;
|
|
|
|
|
|
|
|
c->data = r;
|
|
|
|
|
|
|
|
c->sent = 0;
|
|
|
|
c->destroyed = 0;
|
|
|
|
|
2013-03-07 14:41:40 -03:00
|
|
|
if (rev->timer_set) {
|
|
|
|
ngx_del_timer(rev);
|
|
|
|
}
|
|
|
|
|
2013-03-07 15:14:27 -03:00
|
|
|
rev->handler = ngx_http_process_request_line;
|
2008-05-19 06:24:22 -04:00
|
|
|
ngx_post_event(rev, &ngx_posted_events);
|
2003-05-13 12:02:32 -04:00
|
|
|
return;
|
2003-03-05 03:37:42 -03:00
|
|
|
}
|
|
|
|
|
2004-10-21 12:34:38 -03:00
|
|
|
/*
|
2013-03-01 11:55:42 -03:00
|
|
|
* To keep a memory footprint as small as possible for an idle keepalive
|
|
|
|
* connection we try to free c->buffer's memory if it was allocated outside
|
|
|
|
* the c->pool. The large header buffers are always allocated outside the
|
|
|
|
* c->pool and are freed too.
|
2004-10-21 12:34:38 -03:00
|
|
|
*/
|
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
b = c->buffer;
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
if (ngx_pfree(c->pool, b->start) == NGX_OK) {
|
2004-10-21 12:34:38 -03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* the special note for ngx_http_keepalive_handler() that
|
|
|
|
* c->buffer's memory was freed
|
|
|
|
*/
|
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
b->pos = NULL;
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
} else {
|
|
|
|
b->pos = b->start;
|
|
|
|
b->last = b->start;
|
|
|
|
}
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc free: %p",
|
|
|
|
hc->free);
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
if (hc->free) {
|
2017-03-07 12:49:31 -03:00
|
|
|
for (cl = hc->free; cl; /* void */) {
|
|
|
|
ln = cl;
|
|
|
|
cl = cl->next;
|
|
|
|
ngx_pfree(c->pool, ln->buf->start);
|
|
|
|
ngx_free_chain(c->pool, ln);
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
hc->free = NULL;
|
2004-09-23 12:39:34 -04:00
|
|
|
}
|
|
|
|
|
2016-03-30 20:33:57 -03:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc busy: %p %i",
|
2004-09-23 12:39:34 -04:00
|
|
|
hc->busy, hc->nbusy);
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
if (hc->busy) {
|
2017-03-07 12:49:31 -03:00
|
|
|
for (cl = hc->busy; cl; /* void */) {
|
|
|
|
ln = cl;
|
|
|
|
cl = cl->next;
|
|
|
|
ngx_pfree(c->pool, ln->buf->start);
|
|
|
|
ngx_free_chain(c->pool, ln);
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
2004-09-23 12:39:34 -04:00
|
|
|
|
2017-03-07 12:49:31 -03:00
|
|
|
hc->busy = NULL;
|
2004-09-23 12:39:34 -04:00
|
|
|
hc->nbusy = 0;
|
2004-09-23 02:32:00 -04:00
|
|
|
}
|
|
|
|
|
2007-12-26 18:07:30 -03:00
|
|
|
#if (NGX_HTTP_SSL)
|
|
|
|
if (c->ssl) {
|
|
|
|
ngx_ssl_free_buffer(c);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
rev->handler = ngx_http_keepalive_handler;
|
2003-03-05 03:37:42 -03:00
|
|
|
|
2005-12-05 10:18:09 -03:00
|
|
|
if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) {
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
|
2005-12-05 10:18:09 -03:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
2003-03-05 03:37:42 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-25 09:27:35 -03:00
|
|
|
c->log->action = "keepalive";
|
2003-06-04 13:28:33 -04:00
|
|
|
|
2004-06-01 02:04:46 -04:00
|
|
|
if (c->tcp_nopush == NGX_TCP_NOPUSH_SET) {
|
2005-03-19 08:38:37 -04:00
|
|
|
if (ngx_tcp_push(c->fd) == -1) {
|
2004-04-28 02:14:50 -04:00
|
|
|
ngx_connection_error(c, ngx_socket_errno, ngx_tcp_push_n " failed");
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
2003-06-04 13:28:33 -04:00
|
|
|
}
|
2004-10-11 12:07:03 -03:00
|
|
|
|
2004-06-01 02:04:46 -04:00
|
|
|
c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
|
2004-12-02 15:40:46 -03:00
|
|
|
tcp_nodelay = ngx_tcp_nodelay_and_tcp_nopush ? 1 : 0;
|
2004-10-11 12:07:03 -03:00
|
|
|
|
|
|
|
} else {
|
2004-12-02 15:40:46 -03:00
|
|
|
tcp_nodelay = 1;
|
|
|
|
}
|
2004-10-11 12:07:03 -03:00
|
|
|
|
2017-05-26 15:52:48 -04:00
|
|
|
if (tcp_nodelay && clcf->tcp_nodelay && ngx_tcp_nodelay(c) != NGX_OK) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
2003-06-04 13:28:33 -04:00
|
|
|
}
|
2003-03-04 03:33:48 -03:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
#if 0
|
2004-10-21 12:34:38 -03:00
|
|
|
/* if ngx_http_request_t was freed then we need some other place */
|
2004-06-24 03:53:37 -04:00
|
|
|
r->http_state = NGX_HTTP_KEEPALIVE_STATE;
|
2004-09-23 02:32:00 -04:00
|
|
|
#endif
|
2004-06-24 03:53:37 -04:00
|
|
|
|
2007-03-19 09:20:15 -04:00
|
|
|
c->idle = 1;
|
2011-04-04 09:26:53 -03:00
|
|
|
ngx_reusable_connection(c, 1);
|
2007-03-19 09:20:15 -04:00
|
|
|
|
2013-03-07 14:41:40 -03:00
|
|
|
ngx_add_timer(rev, clcf->keepalive_timeout);
|
|
|
|
|
2003-10-29 05:30:44 -03:00
|
|
|
if (rev->ready) {
|
2008-05-19 06:24:22 -04:00
|
|
|
ngx_post_event(rev, &ngx_posted_events);
|
2003-03-11 16:38:13 -04:00
|
|
|
}
|
2003-02-11 04:14:40 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static void
|
|
|
|
ngx_http_keepalive_handler(ngx_event_t *rev)
|
2002-08-26 11:18:19 -04:00
|
|
|
{
|
2005-03-19 08:38:37 -04:00
|
|
|
size_t size;
|
|
|
|
ssize_t n;
|
|
|
|
ngx_buf_t *b;
|
|
|
|
ngx_connection_t *c;
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2004-07-16 02:33:35 -04:00
|
|
|
c = rev->data;
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2004-01-26 05:52:49 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http keepalive handler");
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2007-03-19 09:20:15 -04:00
|
|
|
if (rev->timedout || c->close) {
|
2003-05-13 12:02:32 -04:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
2003-03-12 13:32:22 -04:00
|
|
|
}
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2004-11-25 13:17:31 -03:00
|
|
|
#if (NGX_HAVE_KQUEUE)
|
2004-09-23 12:39:34 -04:00
|
|
|
|
2004-10-21 12:34:38 -03:00
|
|
|
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
|
2005-12-07 11:51:31 -03:00
|
|
|
if (rev->pending_eof) {
|
2005-01-25 09:27:35 -03:00
|
|
|
c->log->handler = NULL;
|
2004-09-23 12:39:34 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno,
|
2004-11-11 11:07:14 -03:00
|
|
|
"kevent() reported that client %V closed "
|
2005-01-25 09:27:35 -03:00
|
|
|
"keepalive connection", &c->addr_text);
|
2004-12-02 15:40:46 -03:00
|
|
|
#if (NGX_HTTP_SSL)
|
|
|
|
if (c->ssl) {
|
2005-09-30 10:41:25 -04:00
|
|
|
c->ssl->no_send_shutdown = 1;
|
2004-12-02 15:40:46 -03:00
|
|
|
}
|
|
|
|
#endif
|
2004-09-23 12:39:34 -04:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
b = c->buffer;
|
|
|
|
size = b->end - b->start;
|
|
|
|
|
|
|
|
if (b->pos == NULL) {
|
2004-10-21 12:34:38 -03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The c->buffer's memory was freed by ngx_http_set_keepalive().
|
|
|
|
* However, the c->buffer->start and c->buffer->end were not changed
|
|
|
|
* to keep the buffer size.
|
|
|
|
*/
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
b->pos = ngx_palloc(c->pool, size);
|
|
|
|
if (b->pos == NULL) {
|
2004-09-23 12:39:34 -04:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
b->start = b->pos;
|
|
|
|
b->last = b->pos;
|
|
|
|
b->end = b->pos + size;
|
|
|
|
}
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2003-10-12 13:49:16 -03:00
|
|
|
/*
|
|
|
|
* MSIE closes a keepalive connection with RST flag
|
|
|
|
* so we ignore ECONNRESET here.
|
|
|
|
*/
|
2003-03-11 16:38:13 -04:00
|
|
|
|
2004-02-10 13:23:38 -03:00
|
|
|
c->log_error = NGX_ERROR_IGNORE_ECONNRESET;
|
2003-03-11 16:38:13 -04:00
|
|
|
ngx_set_socket_errno(0);
|
2004-07-18 15:11:20 -04:00
|
|
|
|
2004-09-23 12:39:34 -04:00
|
|
|
n = c->recv(c, b->last, size);
|
2004-02-10 13:23:38 -03:00
|
|
|
c->log_error = NGX_ERROR_INFO;
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
if (n == NGX_AGAIN) {
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
2004-12-06 11:45:08 -03:00
|
|
|
ngx_http_close_connection(c);
|
2013-02-23 10:23:48 -03:00
|
|
|
return;
|
2004-12-06 11:45:08 -03:00
|
|
|
}
|
|
|
|
|
2012-10-23 11:36:18 -03:00
|
|
|
/*
|
|
|
|
* Like ngx_http_set_keepalive() we are trying to not hold
|
|
|
|
* c->buffer's memory for a keepalive connection.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (ngx_pfree(c->pool, b->start) == NGX_OK) {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the special note that c->buffer's memory was freed
|
|
|
|
*/
|
|
|
|
|
|
|
|
b->pos = NULL;
|
|
|
|
}
|
|
|
|
|
2003-05-13 12:02:32 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n == NGX_ERROR) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
2003-03-12 13:32:22 -04:00
|
|
|
}
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2005-01-25 09:27:35 -03:00
|
|
|
c->log->handler = NULL;
|
2002-09-16 11:01:44 -04:00
|
|
|
|
2002-12-15 03:25:09 -03:00
|
|
|
if (n == 0) {
|
2003-03-20 12:09:44 -04:00
|
|
|
ngx_log_error(NGX_LOG_INFO, c->log, ngx_socket_errno,
|
2005-01-25 09:27:35 -03:00
|
|
|
"client %V closed keepalive connection", &c->addr_text);
|
2003-05-13 12:02:32 -04:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
2002-09-12 10:42:29 -04:00
|
|
|
}
|
2002-08-26 11:18:19 -04:00
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
b->last += n;
|
2005-01-25 09:27:35 -03:00
|
|
|
|
|
|
|
c->log->handler = ngx_http_log_error;
|
|
|
|
c->log->action = "reading client request line";
|
2002-09-16 11:01:44 -04:00
|
|
|
|
2007-03-19 09:20:15 -04:00
|
|
|
c->idle = 0;
|
2011-04-04 09:26:53 -03:00
|
|
|
ngx_reusable_connection(c, 0);
|
2007-03-19 09:20:15 -04:00
|
|
|
|
2013-03-07 15:14:27 -03:00
|
|
|
c->data = ngx_http_create_request(c);
|
|
|
|
if (c->data == NULL) {
|
|
|
|
ngx_http_close_connection(c);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
c->sent = 0;
|
|
|
|
c->destroyed = 0;
|
|
|
|
|
2013-03-07 14:41:40 -03:00
|
|
|
ngx_del_timer(rev);
|
|
|
|
|
2013-03-07 15:14:27 -03:00
|
|
|
rev->handler = ngx_http_process_request_line;
|
|
|
|
ngx_http_process_request_line(rev);
|
2002-09-16 11:01:44 -04:00
|
|
|
}
|
|
|
|
|
2002-12-10 15:05:12 -03:00
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static void
|
2020-11-06 17:44:54 -03:00
|
|
|
ngx_http_set_lingering_close(ngx_connection_t *c)
|
2005-11-15 10:30:52 -03:00
|
|
|
{
|
2003-10-12 13:49:16 -03:00
|
|
|
ngx_event_t *rev, *wev;
|
2020-11-06 17:44:54 -03:00
|
|
|
ngx_http_request_t *r;
|
2003-05-27 08:18:54 -04:00
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
2003-01-09 02:36:00 -03:00
|
|
|
|
2020-11-06 17:44:54 -03:00
|
|
|
r = c->data;
|
2003-01-26 18:08:14 -03:00
|
|
|
|
2003-05-27 08:18:54 -04:00
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
2003-01-09 02:36:00 -03:00
|
|
|
|
2020-11-06 17:44:54 -03:00
|
|
|
if (r->lingering_time == 0) {
|
|
|
|
r->lingering_time = ngx_time() + (time_t) (clcf->lingering_time / 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if (NGX_HTTP_SSL)
|
|
|
|
if (c->ssl) {
|
|
|
|
ngx_int_t rc;
|
|
|
|
|
2021-06-01 10:37:51 -04:00
|
|
|
c->ssl->shutdown_without_free = 1;
|
|
|
|
|
2020-11-06 17:44:54 -03:00
|
|
|
rc = ngx_ssl_shutdown(c);
|
|
|
|
|
|
|
|
if (rc == NGX_ERROR) {
|
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rc == NGX_AGAIN) {
|
|
|
|
c->ssl->handler = ngx_http_set_lingering_close;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-10-12 13:49:16 -03:00
|
|
|
rev = c->read;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
rev->handler = ngx_http_lingering_close_handler;
|
2002-09-16 11:01:44 -04:00
|
|
|
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
2003-10-12 13:49:16 -03:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
2003-01-26 18:08:14 -03:00
|
|
|
}
|
|
|
|
|
2003-10-12 13:49:16 -03:00
|
|
|
wev = c->write;
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
wev->handler = ngx_http_empty_handler;
|
2002-09-16 11:01:44 -04:00
|
|
|
|
2005-12-05 10:18:09 -03:00
|
|
|
if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) {
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
|
2005-12-05 10:18:09 -03:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
2002-12-24 04:09:57 -03:00
|
|
|
}
|
2003-03-11 16:38:13 -04:00
|
|
|
}
|
|
|
|
|
2020-12-21 14:35:13 -03:00
|
|
|
if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) {
|
|
|
|
ngx_connection_error(c, ngx_socket_errno,
|
|
|
|
ngx_shutdown_socket_n " failed");
|
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
2003-02-11 04:14:40 -03:00
|
|
|
}
|
|
|
|
|
2021-02-11 15:52:09 -03:00
|
|
|
c->close = 0;
|
|
|
|
ngx_reusable_connection(c, 1);
|
|
|
|
|
2020-11-06 17:44:54 -03:00
|
|
|
ngx_add_timer(rev, clcf->lingering_timeout);
|
|
|
|
|
2003-10-29 05:30:44 -03:00
|
|
|
if (rev->ready) {
|
2003-05-13 12:02:32 -04:00
|
|
|
ngx_http_lingering_close_handler(rev);
|
2003-02-11 04:14:40 -03:00
|
|
|
}
|
2002-08-26 11:18:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
static void
|
|
|
|
ngx_http_lingering_close_handler(ngx_event_t *rev)
|
2002-08-26 11:18:19 -04:00
|
|
|
{
|
2003-03-20 12:09:44 -04:00
|
|
|
ssize_t n;
|
|
|
|
ngx_msec_t timer;
|
|
|
|
ngx_connection_t *c;
|
|
|
|
ngx_http_request_t *r;
|
2003-05-27 08:18:54 -04:00
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
2004-09-23 02:32:00 -04:00
|
|
|
u_char buffer[NGX_HTTP_LINGERING_BUFFER_SIZE];
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2003-05-27 08:18:54 -04:00
|
|
|
c = rev->data;
|
|
|
|
r = c->data;
|
2003-01-30 04:28:09 -03:00
|
|
|
|
2004-01-26 05:52:49 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"http lingering close handler");
|
2003-03-20 12:09:44 -04:00
|
|
|
|
2021-02-11 15:52:09 -03:00
|
|
|
if (rev->timedout || c->close) {
|
2003-05-13 12:02:32 -04:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
2002-12-24 04:09:57 -03:00
|
|
|
}
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2013-05-13 09:39:45 -04:00
|
|
|
timer = (ngx_msec_t) r->lingering_time - (ngx_msec_t) ngx_time();
|
|
|
|
if ((ngx_msec_int_t) timer <= 0) {
|
2003-05-13 12:02:32 -04:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
2002-12-24 04:09:57 -03:00
|
|
|
}
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2003-03-20 12:09:44 -04:00
|
|
|
do {
|
2004-09-23 02:32:00 -04:00
|
|
|
n = c->recv(c, buffer, NGX_HTTP_LINGERING_BUFFER_SIZE);
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2016-03-30 20:33:57 -03:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "lingering read: %z", n);
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2018-09-10 12:57:13 -03:00
|
|
|
if (n == NGX_AGAIN) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-03-20 12:09:44 -04:00
|
|
|
if (n == NGX_ERROR || n == 0) {
|
2003-05-13 12:02:32 -04:00
|
|
|
ngx_http_close_request(r, 0);
|
|
|
|
return;
|
2003-03-20 12:09:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
} while (rev->ready);
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2008-12-09 14:27:48 -03:00
|
|
|
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
2004-12-21 09:30:30 -03:00
|
|
|
ngx_http_close_request(r, 0);
|
2004-12-06 11:45:08 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-09-23 02:32:00 -04:00
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
|
|
|
|
2002-09-16 11:01:44 -04:00
|
|
|
timer *= 1000;
|
2004-09-23 02:32:00 -04:00
|
|
|
|
2003-05-27 08:18:54 -04:00
|
|
|
if (timer > clcf->lingering_timeout) {
|
|
|
|
timer = clcf->lingering_timeout;
|
2002-12-24 04:09:57 -03:00
|
|
|
}
|
2002-09-13 10:47:42 -04:00
|
|
|
|
2003-03-20 12:09:44 -04:00
|
|
|
ngx_add_timer(rev, timer);
|
2002-09-13 10:47:42 -04:00
|
|
|
}
|
|
|
|
|
2002-08-20 10:48:28 -04:00
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
void
|
|
|
|
ngx_http_empty_handler(ngx_event_t *wev)
|
2003-05-22 11:23:47 -04:00
|
|
|
{
|
2004-01-26 05:52:49 -03:00
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, "http empty handler");
|
2003-05-22 11:23:47 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
void
|
|
|
|
ngx_http_request_empty_handler(ngx_http_request_t *r)
|
|
|
|
{
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2005-12-05 10:18:09 -03:00
|
|
|
"http request empty handler");
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
ngx_int_t
|
2005-11-26 07:11:11 -03:00
|
|
|
ngx_http_send_special(ngx_http_request_t *r, ngx_uint_t flags)
|
2003-10-09 03:00:45 -04:00
|
|
|
{
|
2004-05-28 11:49:23 -04:00
|
|
|
ngx_buf_t *b;
|
2003-10-21 13:49:56 -03:00
|
|
|
ngx_chain_t out;
|
2003-10-09 03:00:45 -04:00
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
b = ngx_calloc_buf(r->pool);
|
|
|
|
if (b == NULL) {
|
2004-05-28 11:49:23 -04:00
|
|
|
return NGX_ERROR;
|
|
|
|
}
|
|
|
|
|
2005-11-26 07:11:11 -03:00
|
|
|
if (flags & NGX_HTTP_LAST) {
|
2009-07-09 09:32:51 -04:00
|
|
|
|
|
|
|
if (r == r->main && !r->post_action) {
|
|
|
|
b->last_buf = 1;
|
|
|
|
|
|
|
|
} else {
|
2009-07-22 09:06:27 -04:00
|
|
|
b->sync = 1;
|
2009-07-09 09:32:51 -04:00
|
|
|
b->last_in_chain = 1;
|
|
|
|
}
|
2005-11-26 07:11:11 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & NGX_HTTP_FLUSH) {
|
|
|
|
b->flush = 1;
|
|
|
|
}
|
|
|
|
|
2004-05-28 11:49:23 -04:00
|
|
|
out.buf = b;
|
2003-10-21 13:49:56 -03:00
|
|
|
out.next = NULL;
|
2003-10-09 03:00:45 -04:00
|
|
|
|
2003-10-21 13:49:56 -03:00
|
|
|
return ngx_http_output_filter(r, &out);
|
2003-10-09 03:00:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-16 12:26:46 -03:00
|
|
|
static ngx_int_t
|
|
|
|
ngx_http_post_action(ngx_http_request_t *r)
|
|
|
|
{
|
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
|
|
|
|
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
|
|
|
|
|
|
|
if (clcf->post_action.data == NULL) {
|
|
|
|
return NGX_DECLINED;
|
|
|
|
}
|
|
|
|
|
2012-02-13 12:35:48 -03:00
|
|
|
if (r->post_action && r->uri_changes == 0) {
|
|
|
|
return NGX_DECLINED;
|
|
|
|
}
|
|
|
|
|
2006-03-15 05:53:04 -04:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
|
|
"post action: \"%V\"", &clcf->post_action);
|
|
|
|
|
2009-09-21 14:34:22 -04:00
|
|
|
r->main->count--;
|
|
|
|
|
2006-02-16 12:26:46 -03:00
|
|
|
r->http_version = NGX_HTTP_VERSION_9;
|
|
|
|
r->header_only = 1;
|
2006-04-05 09:40:54 -04:00
|
|
|
r->post_action = 1;
|
2006-02-16 12:26:46 -03:00
|
|
|
|
2007-08-06 11:22:40 -04:00
|
|
|
r->read_event_handler = ngx_http_block_reading;
|
2006-12-11 05:31:54 -03:00
|
|
|
|
2008-02-15 09:46:40 -03:00
|
|
|
if (clcf->post_action.data[0] == '/') {
|
|
|
|
ngx_http_internal_redirect(r, &clcf->post_action, NULL);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ngx_http_named_location(r, &clcf->post_action);
|
|
|
|
}
|
2006-02-16 12:26:46 -03:00
|
|
|
|
|
|
|
return NGX_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
void
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_close_request(ngx_http_request_t *r, ngx_int_t rc)
|
2003-05-13 12:02:32 -04:00
|
|
|
{
|
2006-04-21 08:06:44 -04:00
|
|
|
ngx_connection_t *c;
|
2005-10-24 12:09:41 -03:00
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
r = r->main;
|
2005-10-24 12:09:41 -03:00
|
|
|
c = r->connection;
|
|
|
|
|
2009-08-28 04:12:35 -04:00
|
|
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
|
|
|
"http request count:%d blk:%d", r->count, r->blocked);
|
2009-08-26 12:04:05 -04:00
|
|
|
|
|
|
|
if (r->count == 0) {
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, c->log, 0, "http request count is zero");
|
|
|
|
}
|
|
|
|
|
|
|
|
r->count--;
|
|
|
|
|
2009-08-28 04:12:35 -04:00
|
|
|
if (r->count || r->blocked) {
|
2009-08-26 12:04:05 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-11 14:13:06 -03:00
|
|
|
#if (NGX_HTTP_V2)
|
|
|
|
if (r->stream) {
|
|
|
|
ngx_http_v2_close_stream(r->stream, rc);
|
2013-03-20 07:36:57 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_free_request(r, rc);
|
2005-10-24 12:09:41 -03:00
|
|
|
ngx_http_close_connection(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-20 07:36:57 -03:00
|
|
|
void
|
2009-08-26 12:04:05 -04:00
|
|
|
ngx_http_free_request(ngx_http_request_t *r, ngx_int_t rc)
|
2005-10-24 12:09:41 -03:00
|
|
|
{
|
2008-09-27 11:08:02 -04:00
|
|
|
ngx_log_t *log;
|
2013-03-01 11:55:42 -03:00
|
|
|
ngx_pool_t *pool;
|
2008-09-27 11:08:02 -04:00
|
|
|
struct linger linger;
|
|
|
|
ngx_http_cleanup_t *cln;
|
|
|
|
ngx_http_log_ctx_t *ctx;
|
|
|
|
ngx_http_core_loc_conf_t *clcf;
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2003-11-30 17:03:18 -03:00
|
|
|
log = r->connection->log;
|
|
|
|
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http close request");
|
2003-05-13 12:02:32 -04:00
|
|
|
|
|
|
|
if (r->pool == NULL) {
|
2005-07-25 05:41:38 -04:00
|
|
|
ngx_log_error(NGX_LOG_ALERT, log, 0, "http request already closed");
|
2003-05-13 12:02:32 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-09-04 13:17:00 -04:00
|
|
|
cln = r->cleanup;
|
|
|
|
r->cleanup = NULL;
|
|
|
|
|
|
|
|
while (cln) {
|
2006-04-21 08:06:44 -04:00
|
|
|
if (cln->handler) {
|
|
|
|
cln->handler(cln->data);
|
|
|
|
}
|
2013-09-04 13:17:00 -04:00
|
|
|
|
|
|
|
cln = cln->next;
|
2006-04-21 08:06:44 -04:00
|
|
|
}
|
|
|
|
|
2004-09-15 12:00:43 -04:00
|
|
|
#if (NGX_STAT_STUB)
|
2005-10-21 16:12:18 -03:00
|
|
|
|
2004-09-15 12:00:43 -04:00
|
|
|
if (r->stat_reading) {
|
2009-06-18 09:14:51 -04:00
|
|
|
(void) ngx_atomic_fetch_add(ngx_stat_reading, -1);
|
2004-09-15 12:00:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (r->stat_writing) {
|
2009-06-18 09:14:51 -04:00
|
|
|
(void) ngx_atomic_fetch_add(ngx_stat_writing, -1);
|
2004-09-15 12:00:43 -04:00
|
|
|
}
|
2005-10-21 16:12:18 -03:00
|
|
|
|
2004-09-15 12:00:43 -04:00
|
|
|
#endif
|
|
|
|
|
2009-08-26 12:04:05 -04:00
|
|
|
if (rc > 0 && (r->headers_out.status == 0 || r->connection->sent == 0)) {
|
|
|
|
r->headers_out.status = rc;
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
|
|
|
|
2019-02-25 10:42:05 -03:00
|
|
|
if (!r->logged) {
|
|
|
|
log->action = "logging request";
|
2008-06-30 11:32:57 -04:00
|
|
|
|
2019-02-25 10:42:05 -03:00
|
|
|
ngx_http_log_request(r);
|
|
|
|
}
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2008-06-30 11:32:57 -04:00
|
|
|
log->action = "closing request";
|
|
|
|
|
2021-10-18 09:47:06 -03:00
|
|
|
if (r->connection->timedout
|
2021-12-06 07:02:36 -03:00
|
|
|
#if (NGX_HTTP_V3)
|
2021-10-18 09:47:06 -03:00
|
|
|
&& r->connection->quic == NULL
|
|
|
|
#endif
|
|
|
|
)
|
|
|
|
{
|
2004-06-06 15:49:18 -04:00
|
|
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
|
|
|
|
|
|
|
if (clcf->reset_timedout_connection) {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
linger.l_onoff = 1;
|
|
|
|
linger.l_linger = 0;
|
2004-06-06 15:49:18 -04:00
|
|
|
|
|
|
|
if (setsockopt(r->connection->fd, SOL_SOCKET, SO_LINGER,
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
(const void *) &linger, sizeof(struct linger)) == -1)
|
2004-06-06 15:49:18 -04:00
|
|
|
{
|
|
|
|
ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno,
|
|
|
|
"setsockopt(SO_LINGER) failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
/* the various request strings were allocated from r->pool */
|
2003-11-30 17:03:18 -03:00
|
|
|
ctx = log->data;
|
2004-11-11 11:07:14 -03:00
|
|
|
ctx->request = NULL;
|
2003-05-13 12:02:32 -04:00
|
|
|
|
2004-06-24 03:53:37 -04:00
|
|
|
r->request_line.len = 0;
|
|
|
|
|
2005-12-05 10:18:09 -03:00
|
|
|
r->connection->destroyed = 1;
|
|
|
|
|
2013-03-01 11:55:42 -03:00
|
|
|
/*
|
|
|
|
* Setting r->pool to NULL will increase probability to catch double close
|
|
|
|
* of request since the request object is allocated from its own pool.
|
|
|
|
*/
|
|
|
|
|
|
|
|
pool = r->pool;
|
|
|
|
r->pool = NULL;
|
|
|
|
|
|
|
|
ngx_destroy_pool(pool);
|
2003-05-13 12:02:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-27 11:08:02 -04:00
|
|
|
static void
|
|
|
|
ngx_http_log_request(ngx_http_request_t *r)
|
|
|
|
{
|
|
|
|
ngx_uint_t i, n;
|
|
|
|
ngx_http_handler_pt *log_handler;
|
|
|
|
ngx_http_core_main_conf_t *cmcf;
|
|
|
|
|
|
|
|
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
|
|
|
|
|
|
|
log_handler = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.elts;
|
|
|
|
n = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.nelts;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
log_handler[i](r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-20 07:36:57 -03:00
|
|
|
void
|
2005-03-19 08:38:37 -04:00
|
|
|
ngx_http_close_connection(ngx_connection_t *c)
|
2003-05-12 11:52:24 -04:00
|
|
|
{
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 10:03:58 -03:00
|
|
|
ngx_pool_t *pool;
|
|
|
|
|
2004-01-26 05:52:49 -03:00
|
|
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
2004-02-11 14:08:49 -03:00
|
|
|
"close http connection: %d", c->fd);
|
2003-05-12 11:52:24 -04:00
|
|
|
|
2005-09-06 12:09:32 -04:00
|
|
|
#if (NGX_HTTP_SSL)
|
2004-10-11 12:07:03 -03:00
|
|
|
|
|
|
|
if (c->ssl) {
|
|
|
|
if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
|
2005-11-15 10:30:52 -03:00
|
|
|
c->ssl->handler = ngx_http_close_connection;
|
2004-10-11 12:07:03 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-10-18 09:47:06 -03:00
|
|
|
#if (NGX_HTTP_V3)
|
2021-12-06 07:02:36 -03:00
|
|
|
if (c->quic) {
|
2022-08-22 06:09:03 -04:00
|
|
|
ngx_http_v3_reset_stream(c);
|
2021-10-18 09:47:06 -03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-09-14 15:39:54 -04:00
|
|
|
#if (NGX_STAT_STUB)
|
2009-06-18 09:14:51 -04:00
|
|
|
(void) ngx_atomic_fetch_add(ngx_stat_active, -1);
|
2004-09-14 15:39:54 -04:00
|
|
|
#endif
|
|
|
|
|
2005-12-05 10:18:09 -03:00
|
|
|
c->destroyed = 1;
|
|
|
|
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 10:03:58 -03:00
|
|
|
pool = c->pool;
|
|
|
|
|
2004-09-07 11:29:22 -04:00
|
|
|
ngx_close_connection(c);
|
nginx-0.1.14-RELEASE import
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; the bug had appeared in
0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
2005-01-18 10:03:58 -03:00
|
|
|
|
2005-03-19 08:38:37 -04:00
|
|
|
ngx_destroy_pool(pool);
|
2002-10-04 13:58:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-17 10:32:23 -03:00
|
|
|
static u_char *
|
2005-03-19 08:38:37 -04:00
|
|
|
ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len)
|
2002-08-26 11:18:19 -04:00
|
|
|
{
|
2005-01-25 09:27:35 -03:00
|
|
|
u_char *p;
|
2005-03-28 10:43:02 -04:00
|
|
|
ngx_http_request_t *r;
|
2005-01-25 09:27:35 -03:00
|
|
|
ngx_http_log_ctx_t *ctx;
|
2003-06-02 11:24:30 -04:00
|
|
|
|
2005-01-25 09:27:35 -03:00
|
|
|
if (log->action) {
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
p = ngx_snprintf(buf, len, " while %s", log->action);
|
2004-11-11 11:07:14 -03:00
|
|
|
len -= p - buf;
|
2005-03-28 10:43:02 -04:00
|
|
|
buf = p;
|
2003-03-20 12:09:44 -04:00
|
|
|
}
|
2004-11-11 11:07:14 -03:00
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
ctx = log->data;
|
|
|
|
|
2007-12-30 05:01:50 -03:00
|
|
|
p = ngx_snprintf(buf, len, ", client: %V", &ctx->connection->addr_text);
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
len -= p - buf;
|
2005-03-28 10:43:02 -04:00
|
|
|
|
|
|
|
r = ctx->request;
|
2004-11-11 11:07:14 -03:00
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
if (r) {
|
2006-07-11 09:20:19 -04:00
|
|
|
return r->log_handler(r, ctx->current_request, p, len);
|
2007-12-30 05:01:50 -03:00
|
|
|
|
|
|
|
} else {
|
|
|
|
p = ngx_snprintf(p, len, ", server: %V",
|
|
|
|
&ctx->connection->listening->addr_text);
|
2004-11-11 11:07:14 -03:00
|
|
|
}
|
|
|
|
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static u_char *
|
2006-07-11 09:20:19 -04:00
|
|
|
ngx_http_log_error_handler(ngx_http_request_t *r, ngx_http_request_t *sr,
|
|
|
|
u_char *buf, size_t len)
|
nginx-0.1.29-RELEASE import
*) Feature: the ngx_http_ssi_module supports "include virtual" command.
*) Feature: the ngx_http_ssi_module supports the condition command like
'if expr="$NAME"' and "else" and "endif" commands. Only one nested
level is supported.
*) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
DATE_GMT variables and "config timefmt" command.
*) Feature: the "ssi_ignore_recycled_buffers" directive.
*) Bugfix: the "echo" command did not show the default value for the
empty QUERY_STRING variable.
*) Change: the ngx_http_proxy_module was rewritten.
*) Feature: the "proxy_redirect", "proxy_pass_request_headers",
"proxy_pass_request_body", and "proxy_method" directives.
*) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
canceled and must be replaced with the proxy_set_header directive.
*) Change: the "proxy_preserve_host" is canceled and must be replaced
with the "proxy_set_header Host $host" and the "proxy_redirect off"
directives, the "proxy_set_header Host $host:$proxy_port" directive
and the appropriate proxy_redirect directives.
*) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
with the "proxy_set_header X-Real-IP $remote_addr" directive.
*) Change: the "proxy_add_x_forwarded_for" is canceled and must be
replaced with
the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
directive.
*) Change: the "proxy_set_x_url" is canceled and must be replaced with
the "proxy_set_header X-URL http://$host:$server_port$request_uri"
directive.
*) Feature: the "fastcgi_param" directive.
*) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
directive are canceled and must be replaced with the fastcgi_param
directives.
*) Feature: the "index" directive can use the variables.
*) Feature: the "index" directive can be used at http and server levels.
*) Change: the last index only in the "index" directive can be absolute.
*) Feature: the "rewrite" directive can use the variables.
*) Feature: the "internal" directive.
*) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.
*) Change: nginx now passes the invalid lines in a client request
headers or a backend response header.
*) Bugfix: if the backend did not transfer response for a long time and
the "send_timeout" was less than "proxy_read_timeout", then nginx
returned the 408 response.
*) Bugfix: the segmentation fault was occurred if the backend sent an
invalid line in response header; the bug had appeared in 0.1.26.
*) Bugfix: the segmentation fault may occurred in FastCGI fault
tolerance configuration.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" and "Cache-Control" headers.
*) Bugfix: nginx did not take into account trailing dot in "Host"
header line.
*) Bugfix: the ngx_http_auth_module did not work under Linux.
*) Bugfix: the rewrite directive worked incorrectly, if the arguments
were in a request.
*) Bugfix: nginx could not be built on MacOS X.
2005-05-12 10:58:06 -04:00
|
|
|
{
|
2007-12-30 05:15:27 -03:00
|
|
|
char *uri_separator;
|
|
|
|
u_char *p;
|
|
|
|
ngx_http_upstream_t *u;
|
|
|
|
ngx_http_core_srv_conf_t *cscf;
|
2004-11-11 11:07:14 -03:00
|
|
|
|
2007-12-30 05:15:27 -03:00
|
|
|
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
|
|
|
|
|
|
|
p = ngx_snprintf(buf, len, ", server: %V", &cscf->server_name);
|
|
|
|
len -= p - buf;
|
|
|
|
buf = p;
|
2005-03-22 12:02:46 -04:00
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
if (r->request_line.data == NULL && r->request_start) {
|
|
|
|
for (p = r->request_start; p < r->header_in->last; p++) {
|
2007-11-27 09:22:01 -03:00
|
|
|
if (*p == CR || *p == LF) {
|
|
|
|
break;
|
2005-03-28 10:43:02 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-22 10:34:06 -03:00
|
|
|
r->request_line.len = p - r->request_start;
|
|
|
|
r->request_line.data = r->request_start;
|
2007-11-27 09:22:01 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (r->request_line.len) {
|
|
|
|
p = ngx_snprintf(buf, len, ", request: \"%V\"", &r->request_line);
|
|
|
|
len -= p - buf;
|
|
|
|
buf = p;
|
2004-11-11 11:07:14 -03:00
|
|
|
}
|
|
|
|
|
2006-07-11 09:20:19 -04:00
|
|
|
if (r != sr) {
|
|
|
|
p = ngx_snprintf(buf, len, ", subrequest: \"%V\"", &sr->uri);
|
|
|
|
len -= p - buf;
|
|
|
|
buf = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
u = sr->upstream;
|
|
|
|
|
2006-12-04 13:46:13 -03:00
|
|
|
if (u && u->peer.name) {
|
|
|
|
|
|
|
|
uri_separator = "";
|
|
|
|
|
|
|
|
#if (NGX_HAVE_UNIX_DOMAIN)
|
|
|
|
if (u->peer.sockaddr && u->peer.sockaddr->sa_family == AF_UNIX) {
|
|
|
|
uri_separator = ":";
|
|
|
|
}
|
|
|
|
#endif
|
2006-07-11 09:20:19 -04:00
|
|
|
|
|
|
|
p = ngx_snprintf(buf, len, ", upstream: \"%V%V%s%V\"",
|
2007-11-27 10:34:13 -03:00
|
|
|
&u->schema, u->peer.name,
|
2006-12-04 13:46:13 -03:00
|
|
|
uri_separator, &u->uri);
|
2006-07-11 09:20:19 -04:00
|
|
|
len -= p - buf;
|
|
|
|
buf = p;
|
|
|
|
}
|
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
if (r->headers_in.host) {
|
|
|
|
p = ngx_snprintf(buf, len, ", host: \"%V\"",
|
|
|
|
&r->headers_in.host->value);
|
|
|
|
len -= p - buf;
|
|
|
|
buf = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (r->headers_in.referer) {
|
|
|
|
p = ngx_snprintf(buf, len, ", referrer: \"%V\"",
|
|
|
|
&r->headers_in.referer->value);
|
|
|
|
buf = p;
|
|
|
|
}
|
2004-11-11 11:07:14 -03:00
|
|
|
|
2005-03-28 10:43:02 -04:00
|
|
|
return buf;
|
2002-08-06 12:39:45 -04:00
|
|
|
}
|