diff src/http/ngx_http_core_module.c @ 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 8e8f3af115b5
children c52408583801
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -60,6 +60,20 @@ static ngx_conf_enum_t  ngx_http_restric
 
 static ngx_command_t  ngx_http_core_commands[] = {
 
+    { ngx_string("server_names_hash"),
+      NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_num_slot,
+      NGX_HTTP_MAIN_CONF_OFFSET,
+      offsetof(ngx_http_core_main_conf_t, server_names_hash),
+      NULL },
+
+    { ngx_string("server_names_hash_threshold"),
+      NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_num_slot,
+      NGX_HTTP_MAIN_CONF_OFFSET,
+      offsetof(ngx_http_core_main_conf_t, server_names_hash_threshold),
+      NULL },
+
     { ngx_string("server"),
       NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
       ngx_server_block,
@@ -1244,17 +1258,24 @@ static void *ngx_http_core_create_main_c
                    5, sizeof(ngx_http_core_srv_conf_t *),
                    NGX_CONF_ERROR);
 
+    cmcf->server_names_hash = NGX_CONF_UNSET_UINT;
+    cmcf->server_names_hash_threshold = NGX_CONF_UNSET_UINT;
+
     return cmcf;
 }
 
 
 static char *ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf)
 {
-#if 0
     ngx_http_core_main_conf_t *cmcf = conf;
 
-    /* TODO: remove it if no directives */
-#endif
+    if (cmcf->server_names_hash == NGX_CONF_UNSET_UINT) {
+        cmcf->server_names_hash = 1009;
+    }
+
+    if (cmcf->server_names_hash_threshold == NGX_CONF_UNSET_UINT) {
+        cmcf->server_names_hash_threshold = 50;
+    }
 
     return NGX_CONF_OK;
 }