Mercurial > hg > nginx
diff src/http/ngx_http_core_module.h @ 477:ad1e9ebf93bb release-0.1.13
nginx-0.1.13-RELEASE import
*) Feature: the server_names_hash and server_names_hash_threshold
directives.
*) Bugfix: the *.domain.tld names in the "server_name" directive did
not work.
*) Bugfix: the %request_length log parameter logged the incorrect
length.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 21 Dec 2004 12:30:30 +0000 |
parents | bbd6b0b4a2b1 |
children | c52408583801 |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.h Mon Dec 06 14:45:08 2004 +0000 +++ b/src/http/ngx_http_core_module.h Tue Dec 21 12:30:30 2004 +0000 @@ -14,13 +14,13 @@ typedef struct { - in_addr_t addr; - in_port_t port; - int family; - ngx_str_t file_name; - int line; + in_addr_t addr; + in_port_t port; + int family; + ngx_str_t file_name; + ngx_int_t line; - unsigned default_server:1; + unsigned default_server:1; } ngx_http_listen_t; @@ -37,18 +37,21 @@ typedef struct { - ngx_array_t handlers; - ngx_int_t type; /* NGX_OK, NGX_DECLINED */ + ngx_array_t handlers; + ngx_int_t type; /* NGX_OK, NGX_DECLINED */ } ngx_http_phase_t; typedef struct { - ngx_array_t servers; /* array of ngx_http_core_srv_conf_t */ + 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; - ngx_http_phase_t phases[NGX_HTTP_LAST_PHASE]; - ngx_array_t index_handlers; + ngx_uint_t server_names_hash; + ngx_uint_t server_names_hash_threshold; - size_t max_server_name_len; + size_t max_server_name_len; } ngx_http_core_main_conf_t; @@ -57,62 +60,76 @@ * array of ngx_http_core_loc_conf_t, used in the translation handler * and in the merge phase */ - ngx_array_t locations; + ngx_array_t locations; /* "listen", array of ngx_http_listen_t */ - ngx_array_t listen; + ngx_array_t listen; /* "server_name", array of ngx_http_server_name_t */ - ngx_array_t server_names; + ngx_array_t server_names; /* server ctx */ - ngx_http_conf_ctx_t *ctx; + ngx_http_conf_ctx_t *ctx; - size_t connection_pool_size; - size_t request_pool_size; - size_t client_header_buffer_size; + size_t connection_pool_size; + size_t request_pool_size; + size_t client_header_buffer_size; - ngx_bufs_t large_client_header_buffers; + ngx_bufs_t large_client_header_buffers; - ngx_msec_t post_accept_timeout; - ngx_msec_t client_header_timeout; + ngx_msec_t post_accept_timeout; + ngx_msec_t client_header_timeout; - ngx_uint_t restrict_host_names; + ngx_uint_t restrict_host_names; } ngx_http_core_srv_conf_t; /* list of structures to find core_srv_conf quickly at run time */ typedef struct { - in_port_t port; - ngx_str_t port_text; - ngx_array_t addrs; /* array of ngx_http_in_addr_t */ + in_port_t port; + ngx_str_t port_text; + ngx_array_t addrs; /* array of ngx_http_in_addr_t */ } ngx_http_in_port_t; -typedef struct { +struct ngx_http_in_addr_s { in_addr_t addr; + 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 */ + 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; ngx_uint_t default_server; /* unsigned default_server:1; */ -} ngx_http_in_addr_t; +}; 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; */ + ngx_uint_t wildcard; /* unsigned wildcard:1 */ } 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; \ + } + + #define NGX_HTTP_TYPES_HASH_PRIME 13 #define ngx_http_types_hash_key(key, ext) \ { \ - u_int n; \ + ngx_uint_t n; \ for (key = 0, n = 0; n < ext.len; n++) { \ key += ext.data[n]; \ } \ @@ -120,15 +137,15 @@ } typedef struct { - ngx_str_t exten; - ngx_str_t type; + ngx_str_t exten; + ngx_str_t type; } ngx_http_type_t; typedef struct { - ngx_int_t status; - ngx_int_t overwrite; - ngx_str_t uri; + ngx_int_t status; + ngx_int_t overwrite; + ngx_str_t uri; } ngx_http_err_page_t;