annotate src/core/ngx_hash.c @ 58:b55cbf18157e NGINX_0_1_29

nginx 0.1.29 *) 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; bug 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.
author Igor Sysoev <http://sysoev.ru>
date Thu, 12 May 2005 00:00:00 +0400
parents 3050baa54a26
children 91372f004adf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
1
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
2 /*
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
3 * Copyright (C) Igor Sysoev
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
4 */
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
5
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
6
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
7 #include <ngx_config.h>
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
8 #include <ngx_core.h>
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
9
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
10
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
11 ngx_int_t
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
12 ngx_hash_init(ngx_hash_t *hash, ngx_pool_t *pool, void *names, ngx_uint_t nelts)
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
13 {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
14 u_char *p;
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
15 ngx_str_t *name, *bucket;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
16 ngx_uint_t i, n, key, size, best, *test, buckets, min_buckets;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
17
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
18 if (nelts == 0) {
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
19 for (name = (ngx_str_t *) names;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
20 name->len;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
21 name = (ngx_str_t *) ((char *) name + hash->bucket_size))
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
22 {
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
23 nelts++;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
24 }
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
25 }
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
26
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
27 test = ngx_alloc(hash->max_size * sizeof(ngx_uint_t), pool->log);
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
28 if (test == NULL) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
29 return NGX_ERROR;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
30 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
31
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
32 min_buckets = hash->bucket_limit + 1;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
33
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
34 #if (NGX_SUPPRESS_WARN)
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
35 best = 0;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
36 #endif
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
37
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
38 for (size = 1; size < hash->max_size; size++) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
39
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
40 buckets = 0;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
41
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
42 for (i = 0; i < size; i++) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
43 test[i] = 0;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
44 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
45
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
46 for (n = 0, name = (ngx_str_t *) names;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
47 n < nelts;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
48 n++, name = (ngx_str_t *) ((char *) name + hash->bucket_size))
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
49 {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
50 key = 0;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
51
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
52 for (i = 0; i < name->len; i++) {
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
53 key += ngx_tolower(name->data[i]);
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
54 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
55
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
56 key %= size;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
57
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
58 if (test[key] == hash->bucket_limit) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
59 break;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
60 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
61
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
62 test[key]++;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
63
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
64 if (buckets < test[key]) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
65 buckets = test[key];
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
66 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
67 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
68
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
69 if (n == nelts) {
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
70 if (min_buckets > buckets) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
71 min_buckets = buckets;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
72 best = size;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
73 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
74
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
75 if (hash->bucket_limit == 1) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
76 break;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
77 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
78 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
79 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
80
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
81 if (min_buckets == hash->bucket_limit + 1) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
82 ngx_log_error(NGX_LOG_EMERG, pool->log, 0,
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
83 "could not build the %s hash, you should increase "
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
84 "either %s_size: %i or %s_bucket_limit: %i",
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
85 hash->name, hash->name, hash->max_size,
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
86 hash->name, hash->bucket_limit);
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
87 ngx_free(test);
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
88 return NGX_ERROR;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
89 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
90
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
91 hash->buckets = ngx_pcalloc(pool, best * hash->bucket_size);
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
92 if (hash->buckets == NULL) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
93 ngx_free(test);
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
94 return NGX_ERROR;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
95 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
96
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
97 if (hash->bucket_limit != 1) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
98
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
99 for (i = 0; i < best; i++) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
100 test[i] = 0;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
101 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
102
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
103 for (n = 0, name = (ngx_str_t *) names;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
104 n < nelts;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
105 n++, name = (ngx_str_t *) ((char *) name + hash->bucket_size))
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
106 {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
107 key = 0;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
108
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
109 for (i = 0; i < name->len; i++) {
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
110 key += ngx_tolower(name->data[i]);
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
111 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
112
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
113 key %= best;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
114
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
115 test[key]++;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
116 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
117
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
118 for (i = 0; i < best; i++) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
119 if (test[i] == 0) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
120 continue;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
121 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
122
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
123 bucket = ngx_palloc(pool, test[i] * hash->bucket_size);
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
124 if (bucket == NULL) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
125 ngx_free(test);
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
126 return NGX_ERROR;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
127 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
128
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
129 hash->buckets[i] = bucket;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
130 bucket->len = 0;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
131 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
132 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
133
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
134 for (n = 0, name = (ngx_str_t *) names;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
135 n < nelts;
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
136 n++, name = (ngx_str_t *) ((char *) name + hash->bucket_size))
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
137 {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
138 key = 0;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
139
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
140 for (i = 0; i < name->len; i++) {
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
141 key += ngx_tolower(name->data[i]);
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
142 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
143
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
144 key %= best;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
145
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
146 if (hash->bucket_limit == 1) {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
147 p = (u_char *) hash->buckets + key * hash->bucket_size;
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
148 ngx_memcpy(p, name, hash->bucket_size);
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
149 continue;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
150 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
151
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
152 for (bucket = hash->buckets[key];
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
153 bucket->len;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
154 bucket = (ngx_str_t *) ((char *) bucket + hash->bucket_size))
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
155 {
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
156 bucket->len &= 0x7fffffff;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
157 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
158
58
b55cbf18157e nginx 0.1.29
Igor Sysoev <http://sysoev.ru>
parents: 56
diff changeset
159 ngx_memcpy(bucket, name, hash->bucket_size);
56
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
160 bucket->len |= 0x80000000;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
161 }
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
162
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
163 ngx_free(test);
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
164
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
165 hash->hash_size = best;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
166 hash->min_buckets = min_buckets;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
167
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
168 return NGX_OK;
3050baa54a26 nginx 0.1.28
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
169 }