Mercurial > hg > nginx
annotate src/http/modules/ngx_http_index_module.c @ 1590:8f8e0a60685f
fix segfault
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 22 Oct 2007 10:15:27 +0000 |
parents | 223e92651ca5 |
children | 1d659775325a |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
401
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
401
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
401
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
401
diff
changeset
|
5 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
7 #include <ngx_config.h> |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
8 #include <ngx_core.h> |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
9 #include <ngx_http.h> |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
10 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
11 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
12 typedef struct { |
509 | 13 ngx_str_t name; |
14 ngx_array_t *lengths; | |
15 ngx_array_t *values; | |
16 } ngx_http_index_t; | |
17 | |
18 | |
19 typedef struct { | |
20 ngx_array_t *indices; /* array of ngx_http_index_t */ | |
469 | 21 size_t max_index_len; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
22 } ngx_http_index_loc_conf_t; |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
23 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
24 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
25 typedef struct { |
509 | 26 ngx_uint_t current; |
27 | |
557 | 28 ngx_str_t path; |
509 | 29 ngx_str_t index; |
30 | |
773 | 31 size_t root; |
32 | |
509 | 33 ngx_uint_t tested; /* unsigned tested:1 */ |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
34 } ngx_http_index_ctx_t; |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
35 |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
36 |
293
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
37 #define NGX_HTTP_DEFAULT_INDEX "index.html" |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
39 |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
40 static ngx_int_t ngx_http_index_test_dir(ngx_http_request_t *r, |
1454 | 41 ngx_http_core_loc_conf_t *clcf, ngx_http_index_ctx_t *ctx); |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
42 static ngx_int_t ngx_http_index_error(ngx_http_request_t *r, |
509 | 43 ngx_http_index_ctx_t *ctx, ngx_err_t err); |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
44 |
681 | 45 static ngx_int_t ngx_http_index_init(ngx_conf_t *cf); |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
46 static void *ngx_http_index_create_loc_conf(ngx_conf_t *cf); |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
47 static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf, |
509 | 48 void *parent, void *child); |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
32
diff
changeset
|
49 static char *ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, |
509 | 50 void *conf); |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
51 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
52 |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
53 static ngx_command_t ngx_http_index_commands[] = { |
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
54 |
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
55 { ngx_string("index"), |
509 | 56 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
57 ngx_http_index_set_index, |
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
58 NGX_HTTP_LOC_CONF_OFFSET, |
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
59 0, |
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
60 NULL }, |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
61 |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
62 ngx_null_command |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
32
diff
changeset
|
63 }; |
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
32
diff
changeset
|
64 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
65 |
667 | 66 static ngx_http_module_t ngx_http_index_module_ctx = { |
509 | 67 NULL, /* preconfiguration */ |
681 | 68 ngx_http_index_init, /* postconfiguration */ |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
69 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
70 NULL, /* create main configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
71 NULL, /* init main configuration */ |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
72 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
73 NULL, /* create server configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
74 NULL, /* merge server configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
75 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
76 ngx_http_index_create_loc_conf, /* create location configration */ |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
77 ngx_http_index_merge_loc_conf /* merge location configration */ |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
78 }; |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
79 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
80 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
32
diff
changeset
|
81 ngx_module_t ngx_http_index_module = { |
509 | 82 NGX_MODULE_V1, |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
83 &ngx_http_index_module_ctx, /* module context */ |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
84 ngx_http_index_commands, /* module directives */ |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
85 NGX_HTTP_MODULE, /* module type */ |
541 | 86 NULL, /* init master */ |
681 | 87 NULL, /* init module */ |
541 | 88 NULL, /* init process */ |
89 NULL, /* init thread */ | |
90 NULL, /* exit thread */ | |
91 NULL, /* exit process */ | |
92 NULL, /* exit master */ | |
93 NGX_MODULE_V1_PADDING | |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
94 }; |
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
95 |
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
96 |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
97 /* |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
98 * Try to open the first index file before the test of the directory existence |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
99 * because the valid requests should be many more than invalid ones. |
501 | 100 * If open() would fail, then stat() should be more quickly because some data |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
101 * is already cached in the kernel. |
501 | 102 * Besides, Win32 has ERROR_PATH_NOT_FOUND (NGX_ENOTDIR). |
103 * Unix has ENOTDIR error, although it less helpfull - it points only | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
104 * that path contains the usual file in place of the directory. |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
105 */ |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
106 |
509 | 107 static ngx_int_t |
108 ngx_http_index_handler(ngx_http_request_t *r) | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
109 { |
557 | 110 u_char *last; |
509 | 111 size_t len; |
112 ngx_int_t rc; | |
1454 | 113 ngx_str_t path, uri; |
509 | 114 ngx_log_t *log; |
115 ngx_uint_t i; | |
116 ngx_http_index_t *index; | |
117 ngx_http_index_ctx_t *ctx; | |
1454 | 118 ngx_open_file_info_t of; |
509 | 119 ngx_http_script_code_pt code; |
120 ngx_http_script_engine_t e; | |
121 ngx_http_core_loc_conf_t *clcf; | |
122 ngx_http_index_loc_conf_t *ilcf; | |
123 ngx_http_script_len_code_pt lcode; | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
124 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
125 if (r->uri.data[r->uri.len - 1] != '/') { |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
126 return NGX_DECLINED; |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
127 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
128 |
955
ff762576da78
limit the ngx_http_index_module methods to GET, HEAD and POST
Igor Sysoev <igor@sysoev.ru>
parents:
813
diff
changeset
|
129 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) { |
ff762576da78
limit the ngx_http_index_module methods to GET, HEAD and POST
Igor Sysoev <igor@sysoev.ru>
parents:
813
diff
changeset
|
130 return NGX_DECLINED; |
ff762576da78
limit the ngx_http_index_module methods to GET, HEAD and POST
Igor Sysoev <igor@sysoev.ru>
parents:
813
diff
changeset
|
131 } |
ff762576da78
limit the ngx_http_index_module methods to GET, HEAD and POST
Igor Sysoev <igor@sysoev.ru>
parents:
813
diff
changeset
|
132 |
489 | 133 /* TODO: Win32 */ |
134 if (r->zero_in_uri) { | |
135 return NGX_DECLINED; | |
136 } | |
137 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
138 log = r->connection->log; |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
139 |
1454 | 140 ilcf = ngx_http_get_module_loc_conf(r, ngx_http_index_module); |
141 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
142 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
143 /* |
509 | 144 * we use context because the handler supports an async file opening, |
145 * and may be called several times | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
146 */ |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
147 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
148 ctx = ngx_http_get_module_ctx(r, ngx_http_index_module); |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
149 if (ctx == NULL) { |
501 | 150 |
151 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_index_ctx_t)); | |
152 if (ctx == NULL) { | |
153 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
154 } | |
155 | |
156 ngx_http_set_ctx(r, ctx, ngx_http_index_module); | |
509 | 157 } |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
158 |
509 | 159 index = ilcf->indices->elts; |
160 for (i = ctx->current; i < ilcf->indices->nelts; i++) { | |
161 | |
162 if (index[i].lengths == NULL) { | |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
163 |
509 | 164 if (index[i].name.data[0] == '/') { |
165 return ngx_http_internal_redirect(r, &index[i].name, &r->args); | |
166 } | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
167 |
509 | 168 len = ilcf->max_index_len; |
169 ctx->index.len = index[i].name.len; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
170 |
509 | 171 } else { |
172 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
173 |
509 | 174 e.ip = index[i].lengths->elts; |
175 e.request = r; | |
573 | 176 e.flushed = 1; |
509 | 177 |
563 | 178 /* 1 byte for terminating '\0' */ |
557 | 179 |
563 | 180 len = 1; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
181 |
509 | 182 while (*(uintptr_t *) e.ip) { |
183 lcode = *(ngx_http_script_len_code_pt *) e.ip; | |
184 len += lcode(&e); | |
185 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
186 |
509 | 187 ctx->index.len = len; |
563 | 188 |
189 /* 16 bytes are preallocation */ | |
190 | |
191 len += 16; | |
509 | 192 } |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
193 |
681 | 194 if (len > (size_t) (ctx->path.data + ctx->path.len - ctx->index.data)) { |
557 | 195 |
773 | 196 last = ngx_http_map_uri_to_path(r, &ctx->path, &ctx->root, len); |
557 | 197 if (last == NULL) { |
198 return NGX_ERROR; | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
199 } |
557 | 200 |
201 ctx->index.data = last; | |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
202 } |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
203 |
1454 | 204 path.data = ctx->path.data; |
205 | |
509 | 206 if (index[i].values == NULL) { |
557 | 207 |
208 /* index[i].name.len includes the terminating '\0' */ | |
209 | |
210 ngx_memcpy(ctx->index.data, index[i].name.data, index[i].name.len); | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
211 |
1454 | 212 path.len = (ctx->index.data + index[i].name.len - 1) - path.data; |
213 | |
509 | 214 } else { |
215 e.ip = index[i].values->elts; | |
216 e.pos = ctx->index.data; | |
293
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
217 |
509 | 218 while (*(uintptr_t *) e.ip) { |
219 code = *(ngx_http_script_code_pt *) e.ip; | |
220 code((ngx_http_script_engine_t *) &e); | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
221 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
222 |
509 | 223 if (*ctx->index.data == '/') { |
224 ctx->index.len--; | |
225 return ngx_http_internal_redirect(r, &ctx->index, &r->args); | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
226 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
227 |
1454 | 228 path.len = e.pos - path.data; |
229 | |
509 | 230 *e.pos++ = '\0'; |
293
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
231 } |
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
232 |
557 | 233 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, |
1454 | 234 "open index \"%V\"", &path); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
235 |
1454 | 236 of.test_dir = 0; |
237 of.retest = clcf->open_file_cache_retest; | |
238 of.errors = clcf->open_file_cache_errors; | |
1457 | 239 of.events = clcf->open_file_cache_events; |
563 | 240 |
1454 | 241 rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool); |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
242 |
1454 | 243 #if 0 |
244 if (rc == NGX_AGAIN) { | |
509 | 245 ctx->current = i; |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
246 return NGX_AGAIN; |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
247 } |
1454 | 248 #endif |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
249 |
1454 | 250 if (rc == NGX_ERROR) { |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
251 |
1454 | 252 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, of.err, |
557 | 253 ngx_open_file_n " \"%s\" failed", ctx->path.data); |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
254 |
1454 | 255 if (of.err == 0) { |
256 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
257 } | |
47
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
258 |
1454 | 259 if (of.err == NGX_ENOTDIR) { |
260 return ngx_http_index_error(r, ctx, of.err); | |
261 | |
262 } else if (of.err == NGX_EACCES) { | |
263 return ngx_http_index_error(r, ctx, of.err); | |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
264 } |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
265 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
266 if (!ctx->tested) { |
1454 | 267 rc = ngx_http_index_test_dir(r, clcf, ctx); |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
268 |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
269 if (rc != NGX_OK) { |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
270 return rc; |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
271 } |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
272 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
273 ctx->tested = 1; |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
274 } |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
275 |
1454 | 276 if (of.err == NGX_ENOENT) { |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
277 continue; |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
32
diff
changeset
|
278 } |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
279 |
1454 | 280 ngx_log_error(NGX_LOG_ERR, log, of.err, |
557 | 281 ngx_open_file_n " \"%s\" failed", ctx->path.data); |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
282 |
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
283 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
284 } |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
285 |
557 | 286 uri.len = r->uri.len + ctx->index.len - 1; |
287 | |
288 if (!clcf->alias) { | |
773 | 289 uri.data = ctx->path.data + ctx->root; |
557 | 290 |
291 } else { | |
292 uri.data = ngx_palloc(r->pool, uri.len); | |
293 if (uri.data == NULL) { | |
294 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
295 } | |
296 | |
573 | 297 last = ngx_copy(uri.data, r->uri.data, r->uri.len); |
557 | 298 ngx_memcpy(last, ctx->index.data, ctx->index.len - 1); |
199
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
299 } |
a65b630b3a66
nginx-0.0.1-2003-11-28-11:40:40 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
300 |
557 | 301 return ngx_http_internal_redirect(r, &uri, &r->args); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
302 } |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
303 |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
304 return NGX_DECLINED; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
305 } |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
306 |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
11
diff
changeset
|
307 |
509 | 308 static ngx_int_t |
1454 | 309 ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_core_loc_conf_t *clcf, |
310 ngx_http_index_ctx_t *ctx) | |
509 | 311 { |
1454 | 312 u_char c; |
313 ngx_str_t path; | |
314 ngx_uint_t i; | |
315 ngx_open_file_info_t of; | |
509 | 316 |
813
a608349951cf
fix alias without trailing slash
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
317 c = *(ctx->index.data - 1); |
a608349951cf
fix alias without trailing slash
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
318 i = (c == '/') ? 1 : 0; |
a608349951cf
fix alias without trailing slash
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
319 *(ctx->index.data - i) = '\0'; |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
320 |
1454 | 321 path.len = (ctx->index.data - i) - ctx->path.data; |
322 path.data = ctx->path.data; | |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
323 |
1454 | 324 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
325 "http index check dir: \"%V\"", &path); | |
47
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
326 |
1454 | 327 of.test_dir = 1; |
328 of.retest = clcf->open_file_cache_retest; | |
329 of.errors = clcf->open_file_cache_errors; | |
47
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
330 |
1454 | 331 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) |
332 != NGX_OK) | |
333 { | |
334 if (of.err) { | |
335 | |
336 if (of.err == NGX_ENOENT) { | |
337 *(ctx->index.data - i) = c; | |
338 return ngx_http_index_error(r, ctx, of.err); | |
339 } | |
340 | |
341 ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err, | |
342 ngx_open_file_n " \"%s\" failed", path.data); | |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
343 } |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
344 |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
345 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
346 } |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
347 |
813
a608349951cf
fix alias without trailing slash
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
348 *(ctx->index.data - i) = c; |
47
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
349 |
1454 | 350 if (of.is_dir) { |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
351 return NGX_OK; |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
352 } |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
353 |
509 | 354 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, |
1454 | 355 "\"%s\" is not a directory", path.data); |
509 | 356 |
357 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
358 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
359 |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
360 |
509 | 361 static ngx_int_t |
362 ngx_http_index_error(ngx_http_request_t *r, ngx_http_index_ctx_t *ctx, | |
363 ngx_err_t err) | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
364 { |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
365 if (err == NGX_EACCES) { |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
366 ngx_log_error(NGX_LOG_ERR, r->connection->log, err, |
557 | 367 "\"%s\" is forbidden", ctx->path.data); |
577 | 368 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
369 return NGX_HTTP_FORBIDDEN; |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
370 } |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
371 |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
372 ngx_log_error(NGX_LOG_ERR, r->connection->log, err, |
557 | 373 "\"%s\" is not found", ctx->path.data); |
509 | 374 |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
375 return NGX_HTTP_NOT_FOUND; |
46
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
376 } |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
377 |
f84a648211f4
nginx-0.0.1-2003-01-10-20:45:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
378 |
509 | 379 static void * |
380 ngx_http_index_create_loc_conf(ngx_conf_t *cf) | |
381 { | |
382 ngx_http_index_loc_conf_t *conf; | |
383 | |
384 conf = ngx_palloc(cf->pool, sizeof(ngx_http_index_loc_conf_t)); | |
385 if (conf == NULL) { | |
386 return NGX_CONF_ERROR; | |
387 } | |
388 | |
389 conf->indices = NULL; | |
681 | 390 conf->max_index_len = 0; |
509 | 391 |
392 return conf; | |
393 } | |
394 | |
395 | |
396 static char * | |
397 ngx_http_index_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) | |
398 { | |
399 ngx_http_index_loc_conf_t *prev = parent; | |
400 ngx_http_index_loc_conf_t *conf = child; | |
401 | |
402 ngx_http_index_t *index; | |
403 | |
404 if (conf->indices == NULL) { | |
405 conf->indices = prev->indices; | |
406 conf->max_index_len = prev->max_index_len; | |
407 } | |
408 | |
409 if (conf->indices == NULL) { | |
410 conf->indices = ngx_array_create(cf->pool, 1, sizeof(ngx_http_index_t)); | |
411 if (conf->indices == NULL) { | |
412 return NGX_CONF_ERROR; | |
413 } | |
414 | |
415 index = ngx_array_push(conf->indices); | |
416 if (index == NULL) { | |
417 return NGX_CONF_ERROR; | |
418 } | |
419 | |
420 index->name.len = sizeof(NGX_HTTP_DEFAULT_INDEX); | |
421 index->name.data = (u_char *) NGX_HTTP_DEFAULT_INDEX; | |
422 index->lengths = NULL; | |
423 index->values = NULL; | |
424 | |
425 conf->max_index_len = sizeof(NGX_HTTP_DEFAULT_INDEX); | |
426 | |
427 return NGX_CONF_OK; | |
428 } | |
429 | |
430 return NGX_CONF_OK; | |
431 } | |
432 | |
433 | |
681 | 434 static ngx_int_t |
435 ngx_http_index_init(ngx_conf_t *cf) | |
436 { | |
437 ngx_http_handler_pt *h; | |
438 ngx_http_core_main_conf_t *cmcf; | |
439 | |
440 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); | |
441 | |
442 h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers); | |
443 if (h == NULL) { | |
444 return NGX_ERROR; | |
445 } | |
446 | |
447 *h = ngx_http_index_handler; | |
448 | |
449 return NGX_OK; | |
450 } | |
451 | |
452 | |
509 | 453 /* TODO: warn about duplicate indices */ |
454 | |
455 static char * | |
456 ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
457 { | |
458 ngx_http_index_loc_conf_t *ilcf = conf; | |
459 | |
681 | 460 ngx_str_t *value; |
509 | 461 ngx_uint_t i, n; |
462 ngx_http_index_t *index; | |
463 ngx_http_script_compile_t sc; | |
464 | |
465 if (ilcf->indices == NULL) { | |
466 ilcf->indices = ngx_array_create(cf->pool, 2, sizeof(ngx_http_index_t)); | |
467 if (ilcf->indices == NULL) { | |
468 return NGX_CONF_ERROR; | |
469 } | |
470 } | |
471 | |
472 value = cf->args->elts; | |
473 | |
474 for (i = 1; i < cf->args->nelts; i++) { | |
475 if (value[i].data[0] == '/' && i != cf->args->nelts - 1) { | |
476 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
477 "only the last index in \"index\" directive " | |
478 "may be absolute"); | |
479 return NGX_CONF_ERROR; | |
480 } | |
481 | |
482 if (value[i].len == 0) { | |
483 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
484 "index \"%V\" in \"index\" directive is invalid", | |
485 &value[1]); | |
486 return NGX_CONF_ERROR; | |
487 } | |
488 | |
489 index = ngx_array_push(ilcf->indices); | |
490 if (index == NULL) { | |
491 return NGX_CONF_ERROR; | |
492 } | |
493 | |
494 index->name.len = value[i].len; | |
495 index->name.data = value[i].data; | |
496 index->lengths = NULL; | |
497 index->values = NULL; | |
498 | |
499 n = ngx_http_script_variables_count(&value[i]); | |
500 | |
501 if (n == 0) { | |
681 | 502 if (ilcf->max_index_len < index->name.len) { |
509 | 503 ilcf->max_index_len = index->name.len; |
504 } | |
505 | |
573 | 506 /* include the terminating '\0' to the length to use ngx_copy() */ |
557 | 507 index->name.len++; |
508 | |
509 | 509 continue; |
510 } | |
511 | |
512 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
513 | |
514 sc.cf = cf; | |
515 sc.source = &value[i]; | |
516 sc.lengths = &index->lengths; | |
517 sc.values = &index->values; | |
518 sc.variables = n; | |
519 sc.complete_lengths = 1; | |
520 sc.complete_values = 1; | |
521 | |
522 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
523 return NGX_CONF_ERROR; | |
524 } | |
525 } | |
526 | |
527 return NGX_CONF_OK; | |
528 } |