nginx-quic/src/http/ngx_http_core_module.h

278 lines
8.2 KiB
C
Raw Normal View History

/*
* Copyright (C) Igor Sysoev
*/
2003-01-09 02:36:00 -03:00
#ifndef _NGX_HTTP_CORE_H_INCLUDED_
#define _NGX_HTTP_CORE_H_INCLUDED_
#include <ngx_string.h>
#include <ngx_array.h>
#include <ngx_http.h>
typedef struct {
unsigned default_server:1;
unsigned bind:1;
int backlog;
int rcvbuf;
int sndbuf;
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
char *accept_filter;
#endif
#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
ngx_uint_t deferred_accept;
#endif
} ngx_http_listen_conf_t;
2003-01-09 02:36:00 -03:00
typedef struct {
in_addr_t addr;
in_port_t port;
int family;
ngx_str_t file_name;
ngx_int_t line;
2004-03-16 03:10:12 -04:00
ngx_http_listen_conf_t conf;
2003-01-09 02:36:00 -03:00
} ngx_http_listen_t;
2003-11-30 17:03:18 -03:00
typedef enum {
NGX_HTTP_FIND_CONFIG_PHASE = 0,
2004-06-24 12:07:04 -04:00
NGX_HTTP_REWRITE_PHASE,
2004-06-24 12:07:04 -04:00
NGX_HTTP_ACCESS_PHASE,
2003-11-30 17:03:18 -03:00
NGX_HTTP_CONTENT_PHASE,
2004-06-24 12:07:04 -04:00
2003-11-30 17:03:18 -03:00
NGX_HTTP_LAST_PHASE
} ngx_http_phases;
2003-05-16 11:27:48 -04:00
typedef struct {
ngx_array_t handlers;
ngx_int_t type; /* NGX_OK, NGX_DECLINED */
2003-10-10 11:10:50 -04:00
} ngx_http_phase_t;
typedef struct {
ngx_array_t servers; /* ngx_http_core_srv_conf_t */
ngx_http_phase_t phases[NGX_HTTP_LAST_PHASE];
ngx_array_t index_handlers;
2003-10-10 11:10:50 -04:00
ngx_hash_t headers_in_hash;
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_hash_t variables_hash;
ngx_uint_t server_names_hash;
ngx_uint_t server_names_hash_threshold;
2004-06-25 10:42:03 -04:00
size_t max_server_name_len;
ngx_array_t variables; /* ngx_http_variable_t */
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_array_t all_variables; /* ngx_http_variable_t */
2003-05-16 11:27:48 -04:00
} ngx_http_core_main_conf_t;
2003-01-09 02:36:00 -03:00
typedef struct {
2004-07-15 12:35:51 -04:00
/*
* array of the ngx_http_core_loc_conf_t,
* used in the translation handler and in the merge phase
2004-07-15 12:35:51 -04:00
*/
ngx_array_t locations;
2003-05-19 12:39:14 -04:00
/* array of the ngx_http_listen_t, "listen" directive */
ngx_array_t listen;
2003-05-23 07:53:01 -04:00
/* array of the ngx_http_server_name_t, "server_name" directive */
ngx_array_t server_names;
2004-03-16 03:10:12 -04:00
2004-07-15 12:35:51 -04:00
/* server ctx */
ngx_http_conf_ctx_t *ctx;
2004-03-16 03:10:12 -04:00
size_t connection_pool_size;
size_t request_pool_size;
size_t client_header_buffer_size;
2004-05-14 12:51:47 -04:00
ngx_bufs_t large_client_header_buffers;
ngx_msec_t client_header_timeout;
2004-07-15 12:35:51 -04:00
ngx_uint_t restrict_host_names;
ngx_flag_t ignore_invalid_headers;
2003-01-09 02:36:00 -03:00
} ngx_http_core_srv_conf_t;
2003-01-29 04:25:51 -03:00
/* list of structures to find core_srv_conf quickly at run time */
2003-01-09 02:36:00 -03:00
typedef struct {
in_port_t port;
ngx_str_t port_text;
ngx_array_t addrs; /* array of ngx_http_in_addr_t */
2003-01-09 02:36:00 -03:00
} ngx_http_in_port_t;
2003-05-15 11:42:53 -04:00
struct ngx_http_in_addr_s {
2003-11-25 17:44:56 -03:00
in_addr_t addr;
2003-01-29 04:25:51 -03:00
ngx_array_t names; /* array of ngx_http_server_name_t */
ngx_array_t *hash; /* hash of ngx_http_server_name_t */
ngx_array_t wildcards; /* array of ngx_http_server_name_t */
/* the default server configuration for this address:port */
ngx_http_core_srv_conf_t *core_srv_conf;
2003-01-09 02:36:00 -03:00
ngx_http_listen_conf_t conf;
};
2003-01-09 02:36:00 -03:00
2003-05-15 11:42:53 -04:00
2003-01-29 04:25:51 -03:00
typedef struct {
ngx_str_t name;
ngx_http_core_srv_conf_t *core_srv_conf; /* virtual name server conf */
ngx_uint_t wildcard; /* unsigned wildcard:1 */
2003-01-29 04:25:51 -03:00
} ngx_http_server_name_t;
#define ngx_http_server_names_hash_key(key, name, len, prime) \
{ \
ngx_uint_t n; \
for (key = 0, n = 0; n < len; n++) { \
key += name[n]; \
} \
key %= prime; \
}
2003-05-14 13:13:13 -04:00
#define NGX_HTTP_TYPES_HASH_PRIME 13
#define ngx_http_types_hash_key(key, ext) \
{ \
ngx_uint_t n; \
2003-05-14 13:13:13 -04:00
for (key = 0, n = 0; n < ext.len; n++) { \
key += ext.data[n]; \
} \
key %= NGX_HTTP_TYPES_HASH_PRIME; \
}
typedef struct {
ngx_str_t exten;
ngx_str_t type;
2003-05-14 13:13:13 -04:00
} ngx_http_type_t;
2003-01-09 02:36:00 -03:00
typedef struct {
ngx_int_t status;
ngx_int_t overwrite;
ngx_str_t uri;
} ngx_http_err_page_t;
2004-07-18 15:11:20 -04:00
typedef struct ngx_http_core_loc_conf_s ngx_http_core_loc_conf_t;
struct ngx_http_core_loc_conf_s {
2003-05-27 08:18:54 -04:00
ngx_str_t name; /* location name */
2004-07-18 15:11:20 -04:00
#if (NGX_PCRE)
2004-07-18 15:11:20 -04:00
ngx_regex_t *regex;
#endif
unsigned noname:1; /* "if () {}" block */
2004-07-18 15:11:20 -04:00
unsigned exact_match:1;
unsigned noregex:1;
2004-07-18 15:11:20 -04:00
unsigned auto_redirect:1;
unsigned alias:1;
/* array of inclusive ngx_http_core_loc_conf_t */
ngx_array_t locations;
/* pointer to the modules' loc_conf */
void **loc_conf ;
2003-01-09 02:36:00 -03:00
2004-06-16 11:32:11 -04:00
ngx_http_handler_pt handler;
2003-04-08 11:40:10 -04:00
2004-03-16 03:10:12 -04:00
ngx_str_t root; /* root, alias */
2003-01-09 02:36:00 -03:00
2003-05-14 13:13:13 -04:00
ngx_array_t *types;
2003-05-27 08:18:54 -04:00
ngx_str_t default_type;
2004-03-19 01:25:53 -04:00
size_t client_max_body_size; /* client_max_body_size */
2004-04-01 12:20:53 -04:00
size_t client_body_buffer_size; /* client_body_buffer_size */
2004-06-21 11:59:32 -04:00
size_t send_lowat; /* send_lowat */
2004-07-14 12:01:42 -04:00
size_t postpone_output; /* postpone_output */
size_t limit_rate; /* limit_rate */
2004-03-16 03:10:12 -04:00
2003-10-27 18:01:00 -03:00
ngx_msec_t client_body_timeout; /* client_body_timeout */
2003-05-27 08:18:54 -04:00
ngx_msec_t send_timeout; /* send_timeout */
ngx_msec_t keepalive_timeout; /* keepalive_timeout */
ngx_msec_t lingering_time; /* lingering_time */
ngx_msec_t lingering_timeout; /* lingering_timeout */
2003-04-08 11:40:10 -04:00
time_t keepalive_header; /* keepalive_timeout */
ngx_flag_t satisfy_any; /* satisfy_any */
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_flag_t internal; /* internal */
2004-03-16 03:10:12 -04:00
ngx_flag_t sendfile; /* sendfile */
ngx_flag_t tcp_nopush; /* tcp_nopush */
ngx_flag_t tcp_nodelay; /* tcp_nodelay */
2004-06-06 15:49:18 -04:00
ngx_flag_t reset_timedout_connection; /* reset_timedout_connection */
ngx_flag_t port_in_redirect; /* port_in_redirect */
2004-03-16 03:10:12 -04:00
ngx_flag_t msie_padding; /* msie_padding */
ngx_flag_t log_not_found; /* log_not_found */
2004-03-16 03:10:12 -04:00
ngx_array_t *error_pages; /* error_page */
2003-10-24 03:53:41 -03:00
ngx_path_t *client_body_temp_path; /* client_body_temp_path */
2003-11-30 17:03:18 -03:00
ngx_http_cache_hash_t *open_files;
2003-07-07 02:11:50 -04:00
ngx_log_t *err_log;
2004-07-18 15:11:20 -04:00
#if 0
2004-07-18 15:11:20 -04:00
ngx_http_core_loc_conf_t *prev_location;
#endif
2004-07-18 15:11:20 -04:00
};
2003-01-09 02:36:00 -03:00
2003-01-09 02:36:00 -03:00
extern ngx_http_module_t ngx_http_core_module_ctx;
extern ngx_module_t ngx_http_core_module;
extern ngx_uint_t ngx_http_max_module;
2003-01-09 02:36:00 -03:00
2004-06-16 11:32:11 -04:00
ngx_int_t ngx_http_find_location_config(ngx_http_request_t *r);
2003-01-09 02:36:00 -03:00
2003-11-30 17:03:18 -03:00
ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r);
2003-12-25 17:26:58 -03:00
ngx_int_t ngx_http_set_exten(ngx_http_request_t *r);
u_char *ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *name,
size_t reserved);
ngx_int_t ngx_http_auth_basic_user(ngx_http_request_t *r);
2003-11-30 17:03:18 -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
ngx_int_t ngx_http_subrequest(ngx_http_request_t *r,
ngx_str_t *uri, ngx_str_t *args);
2004-06-16 11:32:11 -04:00
ngx_int_t ngx_http_internal_redirect(ngx_http_request_t *r,
ngx_str_t *uri, ngx_str_t *args);
2003-01-09 02:36:00 -03:00
2004-06-16 11:32:11 -04:00
typedef ngx_int_t (*ngx_http_output_header_filter_pt)(ngx_http_request_t *r);
typedef ngx_int_t (*ngx_http_output_body_filter_pt)
(ngx_http_request_t *r, ngx_chain_t *chain);
2004-06-06 15:49:18 -04:00
2004-06-16 11:32:11 -04:00
ngx_int_t ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *chain);
ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *chain);
2004-06-06 15:49:18 -04:00
2003-01-09 02:36:00 -03:00
#endif /* _NGX_HTTP_CORE_H_INCLUDED_ */