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 {
|
2003-11-25 17:44:56 -03:00
|
|
|
in_addr_t addr;
|
2003-01-29 04:25:51 -03:00
|
|
|
int port;
|
|
|
|
int family;
|
|
|
|
ngx_str_t file_name;
|
|
|
|
int line;
|
2004-03-16 03:10:12 -04:00
|
|
|
|
|
|
|
unsigned default_server:1;
|
2003-01-09 02:36:00 -03:00
|
|
|
} ngx_http_listen_t;
|
|
|
|
|
|
|
|
|
2003-11-30 17:03:18 -03:00
|
|
|
typedef enum {
|
|
|
|
NGX_HTTP_REWRITE_PHASE = 0,
|
2004-06-24 12:07:04 -04:00
|
|
|
|
2003-11-30 17:03:18 -03:00
|
|
|
NGX_HTTP_FIND_CONFIG_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 {
|
2003-10-10 11:10:50 -04:00
|
|
|
ngx_array_t handlers;
|
2004-03-16 03:10:12 -04:00
|
|
|
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; /* array of ngx_http_core_srv_conf_t */
|
|
|
|
|
|
|
|
ngx_http_phase_t phases[NGX_HTTP_LAST_PHASE];
|
|
|
|
ngx_array_t index_handlers;
|
2004-06-25 10:42:03 -04:00
|
|
|
|
|
|
|
size_t max_server_name_len;
|
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 ngx_http_core_loc_conf_t, used in the translation handler
|
|
|
|
* and in the merge phase
|
|
|
|
*/
|
|
|
|
ngx_array_t locations;
|
2003-05-19 12:39:14 -04:00
|
|
|
|
2004-07-15 12:35:51 -04:00
|
|
|
/* "listen", array of ngx_http_listen_t */
|
|
|
|
ngx_array_t listen;
|
2003-05-23 07:53:01 -04:00
|
|
|
|
2004-07-15 12:35:51 -04:00
|
|
|
/* "server_name", array of ngx_http_server_name_t */
|
|
|
|
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
|
|
|
|
2004-07-15 12:35:51 -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
|
|
|
|
2004-07-15 12:35:51 -04:00
|
|
|
ngx_msec_t post_accept_timeout;
|
|
|
|
ngx_msec_t client_header_timeout;
|
|
|
|
|
|
|
|
ngx_uint_t restrict_host_names;
|
|
|
|
|
|
|
|
ngx_flag_t large_client_header;
|
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 {
|
|
|
|
int port;
|
2003-05-27 08:18:54 -04:00
|
|
|
ngx_str_t port_name;
|
2003-05-15 11:42:53 -04:00
|
|
|
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
|
|
|
|
2003-01-09 02:36:00 -03:00
|
|
|
typedef struct {
|
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_http_core_srv_conf_t *core_srv_conf; /* default server conf
|
|
|
|
for this address:port */
|
2003-01-09 02:36:00 -03:00
|
|
|
|
2004-03-16 03:10:12 -04:00
|
|
|
unsigned default_server:1;
|
|
|
|
} ngx_http_in_addr_t;
|
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_http_server_name_t;
|
|
|
|
|
|
|
|
|
2003-05-14 13:13:13 -04:00
|
|
|
#define NGX_HTTP_TYPES_HASH_PRIME 13
|
|
|
|
|
|
|
|
#define ngx_http_types_hash_key(key, ext) \
|
|
|
|
{ \
|
2003-05-20 11:37:55 -04:00
|
|
|
u_int 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;
|
|
|
|
} ngx_http_type_t;
|
2003-01-09 02:36:00 -03:00
|
|
|
|
|
|
|
|
2003-11-09 17:03:38 -03:00
|
|
|
typedef struct {
|
2004-04-25 16:13:21 -04:00
|
|
|
ngx_int_t status;
|
|
|
|
ngx_int_t overwrite;
|
2003-11-09 17:03:38 -03:00
|
|
|
ngx_str_t uri;
|
|
|
|
} ngx_http_err_page_t;
|
|
|
|
|
|
|
|
|
2003-01-09 02:36:00 -03:00
|
|
|
typedef struct {
|
2003-05-27 08:18:54 -04:00
|
|
|
ngx_str_t name; /* location name */
|
|
|
|
void **loc_conf ; /* pointer to the modules' 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-03-16 03:10:12 -04:00
|
|
|
size_t discarded_buffer_size; /* discarded_buffer_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
|
|
|
|
2004-03-16 03:10:12 -04:00
|
|
|
ngx_flag_t sendfile; /* sendfile */
|
|
|
|
ngx_flag_t tcp_nopush; /* tcp_nopush */
|
2004-06-06 15:49:18 -04:00
|
|
|
ngx_flag_t reset_timedout_connection; /* reset_timedout_connection */
|
2004-03-16 03:10:12 -04:00
|
|
|
ngx_flag_t msie_padding; /* msie_padding */
|
|
|
|
|
2003-11-09 17:03:38 -03:00
|
|
|
ngx_array_t *error_pages; /* error_page */
|
2003-10-24 03:53:41 -03:00
|
|
|
|
2003-11-30 17:03:18 -03:00
|
|
|
ngx_http_cache_hash_t *open_files;
|
|
|
|
|
2003-12-14 17:10:27 -03:00
|
|
|
#if (HAVE_PCRE)
|
2003-11-25 17:44:56 -03:00
|
|
|
ngx_regex_t *regex;
|
2003-12-14 17:10:27 -03:00
|
|
|
#endif
|
2003-11-25 17:44:56 -03:00
|
|
|
|
|
|
|
unsigned exact_match:1;
|
2003-11-18 18:34:08 -03:00
|
|
|
unsigned auto_redirect:1;
|
2004-03-16 03:10:12 -04:00
|
|
|
unsigned alias:1;
|
2003-11-18 18:34:08 -03:00
|
|
|
|
2003-07-07 02:11:50 -04:00
|
|
|
ngx_log_t *err_log;
|
2003-01-09 02:36:00 -03:00
|
|
|
} ngx_http_core_loc_conf_t;
|
|
|
|
|
|
|
|
|
|
|
|
extern ngx_http_module_t ngx_http_core_module_ctx;
|
|
|
|
extern ngx_module_t ngx_http_core_module;
|
|
|
|
|
|
|
|
extern int ngx_http_max_module;
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-06-16 11:32:11 -04:00
|
|
|
ngx_int_t ngx_http_find_location_config(ngx_http_request_t *r);
|
|
|
|
ngx_int_t ngx_http_core_translate_handler(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);
|
2003-11-30 17:03:18 -03:00
|
|
|
|
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-03-20 12:09:44 -04:00
|
|
|
|
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)
|
2004-06-06 15:49:18 -04:00
|
|
|
(ngx_http_request_t *r, ngx_chain_t *chain);
|
|
|
|
|
|
|
|
|
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_ */
|