Line data Source code
1 :
2 : /*
3 : * Copyright (C) Yichun Zhang (agentzh)
4 : */
5 :
6 :
7 : #ifndef DDEBUG
8 : #define DDEBUG 0
9 : #endif
10 : #include "ddebug.h"
11 :
12 :
13 : #include "ngx_http_memc_handler.h"
14 : #include "ngx_http_memc_module.h"
15 : #include "ngx_http_memc_request.h"
16 : #include "ngx_http_memc_response.h"
17 : #include "ngx_http_memc_util.h"
18 :
19 :
20 : static ngx_int_t ngx_http_memc_flags_as_http_time_variable(
21 : ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data);
22 :
23 :
24 : static ngx_http_variable_t ngx_http_memc_variables[] = {
25 :
26 : { ngx_string("memc_flags_as_http_time"), NULL,
27 : ngx_http_memc_flags_as_http_time_variable, 0,
28 : 0, 0 },
29 :
30 : { ngx_null_string, NULL, NULL, 0, 0, 0 }
31 : };
32 :
33 :
34 : static ngx_str_t ngx_http_memc_key = ngx_string("memc_key");
35 : static ngx_str_t ngx_http_memc_cmd = ngx_string("memc_cmd");
36 : static ngx_str_t ngx_http_memc_value = ngx_string("memc_value");
37 : static ngx_str_t ngx_http_memc_flags = ngx_string("memc_flags");
38 : static ngx_str_t ngx_http_memc_exptime = ngx_string("memc_exptime");
39 :
40 :
41 : static ngx_int_t ngx_http_memc_add_more_variables(ngx_conf_t *cf);
42 : static ngx_int_t ngx_http_memc_variable_not_found(ngx_http_request_t *r,
43 : ngx_http_variable_value_t *v, uintptr_t data);
44 : static ngx_int_t ngx_http_memc_add_variable(ngx_conf_t *cf, ngx_str_t *name);
45 : static ngx_flag_t ngx_http_memc_in_cmds_allowed(ngx_http_memc_loc_conf_t *mlcf,
46 : ngx_http_memc_cmd_t memc_cmd);
47 : static ngx_int_t ngx_http_memc_reinit_request(ngx_http_request_t *r);
48 : static void ngx_http_memc_abort_request(ngx_http_request_t *r);
49 : static void ngx_http_memc_finalize_request(ngx_http_request_t *r,
50 : ngx_int_t rc);
51 : static ngx_flag_t ngx_http_memc_valid_uint32_str(u_char *data, size_t len);
52 : static ngx_flag_t ngx_http_memc_valid_uint64_str(u_char *data, size_t len);
53 :
54 :
55 : ngx_int_t
56 0 : ngx_http_memc_handler(ngx_http_request_t *r)
57 : {
58 : ngx_int_t rc;
59 : ngx_http_upstream_t *u;
60 : ngx_http_memc_ctx_t *ctx;
61 : ngx_http_memc_loc_conf_t *mlcf;
62 : ngx_http_memc_main_conf_t *mmcf;
63 : ngx_str_t target;
64 : ngx_url_t url;
65 :
66 : ngx_http_variable_value_t *cmd_vv;
67 : ngx_http_variable_value_t *key_vv;
68 : ngx_http_variable_value_t *value_vv;
69 : ngx_http_variable_value_t *flags_vv;
70 : ngx_http_variable_value_t *exptime_vv;
71 :
72 : ngx_http_memc_cmd_t memc_cmd;
73 0 : ngx_flag_t is_storage_cmd = 0;
74 :
75 : dd("memc handler");
76 :
77 0 : mmcf = ngx_http_get_module_main_conf(r, ngx_http_memc_module);
78 :
79 0 : key_vv = ngx_http_get_indexed_variable(r, mmcf->key_index);
80 0 : if (key_vv == NULL) {
81 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
82 : }
83 :
84 0 : cmd_vv = ngx_http_get_indexed_variable(r, mmcf->cmd_index);
85 0 : if (cmd_vv == NULL) {
86 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
87 : }
88 :
89 0 : if (cmd_vv->not_found || cmd_vv->len == 0) {
90 : dd("variable $memc_cmd not found");
91 0 : cmd_vv->not_found = 0;
92 0 : cmd_vv->valid = 1;
93 0 : cmd_vv->no_cacheable = 0;
94 :
95 0 : if (r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD)) {
96 0 : cmd_vv->len = sizeof("get") - 1;
97 0 : cmd_vv->data = (u_char*) "get";
98 0 : memc_cmd = ngx_http_memc_cmd_get;
99 :
100 0 : } else if (r->method == NGX_HTTP_POST) {
101 0 : cmd_vv->len = sizeof("add") - 1;
102 0 : cmd_vv->data = (u_char*) "add";
103 0 : memc_cmd = ngx_http_memc_cmd_add;
104 0 : is_storage_cmd = 1;
105 :
106 0 : } else if (r->method == NGX_HTTP_PUT) {
107 0 : cmd_vv->len = sizeof("set") - 1;
108 0 : cmd_vv->data = (u_char*) "set";
109 0 : memc_cmd = ngx_http_memc_cmd_set;
110 0 : is_storage_cmd = 1;
111 :
112 0 : } else if (r->method == NGX_HTTP_DELETE) {
113 0 : cmd_vv->len = sizeof("delete") - 1;
114 0 : cmd_vv->data = (u_char*) "delete";
115 0 : memc_cmd = ngx_http_memc_cmd_delete;
116 :
117 : } else {
118 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
119 : "ngx_memc: $memc_cmd variable not found for HTTP "
120 : "%V requests", &r->method_name);
121 :
122 0 : return NGX_HTTP_BAD_REQUEST;
123 : }
124 :
125 : } else {
126 :
127 0 : memc_cmd = ngx_http_memc_parse_cmd(cmd_vv->data, cmd_vv->len,
128 : &is_storage_cmd);
129 :
130 0 : if (memc_cmd == ngx_http_memc_cmd_unknown) {
131 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
132 : "ngx_memc: unknown $memc_cmd \"%v\"", cmd_vv);
133 0 : return NGX_HTTP_BAD_REQUEST;
134 : }
135 : }
136 :
137 0 : mlcf = ngx_http_get_module_loc_conf(r, ngx_http_memc_module);
138 :
139 : dd("XXX connect timeout %d", (int) mlcf->upstream.connect_timeout);
140 :
141 0 : if (!ngx_http_memc_in_cmds_allowed(mlcf, memc_cmd)) {
142 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
143 : "ngx_memc: memcached command \"%v\" not allowed",
144 : cmd_vv);
145 :
146 0 : return NGX_HTTP_FORBIDDEN;
147 : }
148 :
149 0 : if (ngx_http_set_content_type(r) != NGX_OK) {
150 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
151 : }
152 :
153 : #if defined(nginx_version) && \
154 : ((nginx_version >= 7063 && nginx_version < 8000) \
155 : || nginx_version >= 8007)
156 :
157 0 : if (ngx_http_upstream_create(r) != NGX_OK) {
158 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
159 : }
160 :
161 0 : u = r->upstream;
162 :
163 : #else /* 0.7.x < 0.7.63, 0.8.x < 0.8.7 */
164 :
165 : u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t));
166 : if (u == NULL) {
167 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
168 : }
169 :
170 : u->peer.log = r->connection->log;
171 : u->peer.log_error = NGX_ERROR_ERR;
172 : # if (NGX_THREADS)
173 : u->peer.lock = &r->connection->lock;
174 : # endif
175 :
176 : r->upstream = u;
177 :
178 : #endif
179 :
180 0 : if (mlcf->complex_target) {
181 : /* variables used in the memc_pass directive */
182 0 : if (ngx_http_complex_value(r, mlcf->complex_target, &target)
183 : != NGX_OK)
184 : {
185 : dd("failed to compile");
186 0 : return NGX_ERROR;
187 : }
188 :
189 0 : if (target.len == 0) {
190 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
191 : "memc: handler: empty \"memc_pass\" target");
192 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
193 : }
194 :
195 0 : url.host = target;
196 0 : url.port = 0;
197 0 : url.no_resolve = 1;
198 :
199 0 : mlcf->upstream.upstream = ngx_http_memc_upstream_add(r, &url);
200 :
201 0 : if (mlcf->upstream.upstream == NULL) {
202 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
203 : "memc: upstream \"%V\" not found", &target);
204 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
205 : }
206 : }
207 :
208 0 : u->schema.len = sizeof("memcached://") - 1;
209 0 : u->schema.data = (u_char *) "memcached://";
210 :
211 0 : u->output.tag = (ngx_buf_tag_t) &ngx_http_memc_module;
212 :
213 0 : u->conf = &mlcf->upstream;
214 :
215 0 : ctx = ngx_palloc(r->pool, sizeof(ngx_http_memc_ctx_t));
216 0 : if (ctx == NULL) {
217 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
218 : }
219 :
220 0 : ctx->body_length = 0;
221 0 : ctx->memc_key_vv = key_vv;
222 0 : ctx->memc_value_vv = NULL;
223 0 : ctx->memc_flags_vv = NULL;
224 :
225 0 : ctx->parser_state = NGX_ERROR;
226 :
227 0 : ctx->rest = NGX_HTTP_MEMC_END;
228 0 : ctx->request = r;
229 :
230 0 : ctx->cmd_str.data = cmd_vv->data;
231 0 : ctx->cmd_str.len = cmd_vv->len;
232 :
233 0 : ctx->cmd = memc_cmd;
234 :
235 0 : ctx->is_storage_cmd = is_storage_cmd;
236 :
237 0 : ngx_http_set_ctx(r, ctx, ngx_http_memc_module);
238 :
239 0 : if (is_storage_cmd) {
240 0 : u->create_request = ngx_http_memc_create_storage_cmd_request;
241 0 : u->process_header = ngx_http_memc_process_simple_header;
242 :
243 0 : u->input_filter_init = ngx_http_memc_empty_filter_init;
244 0 : u->input_filter = ngx_http_memc_empty_filter;
245 :
246 0 : } else if (memc_cmd == ngx_http_memc_cmd_get) {
247 0 : u->create_request = ngx_http_memc_create_get_cmd_request;
248 0 : u->process_header = ngx_http_memc_process_get_cmd_header;
249 :
250 0 : u->input_filter_init = ngx_http_memc_get_cmd_filter_init;
251 0 : u->input_filter = ngx_http_memc_get_cmd_filter;
252 :
253 0 : } else if (memc_cmd == ngx_http_memc_cmd_flush_all) {
254 0 : u->create_request = ngx_http_memc_create_flush_all_cmd_request;
255 0 : u->process_header = ngx_http_memc_process_simple_header;
256 :
257 0 : u->input_filter_init = ngx_http_memc_empty_filter_init;
258 0 : u->input_filter = ngx_http_memc_empty_filter;
259 :
260 0 : } else if (memc_cmd == ngx_http_memc_cmd_version
261 0 : || memc_cmd == ngx_http_memc_cmd_stats)
262 : {
263 0 : u->create_request = ngx_http_memc_create_noarg_cmd_request;
264 0 : u->process_header = ngx_http_memc_process_simple_header;
265 :
266 0 : u->input_filter_init = ngx_http_memc_empty_filter_init;
267 0 : u->input_filter = ngx_http_memc_empty_filter;
268 :
269 0 : } else if (memc_cmd == ngx_http_memc_cmd_delete) {
270 0 : u->create_request = ngx_http_memc_create_delete_cmd_request;
271 0 : u->process_header = ngx_http_memc_process_simple_header;
272 :
273 0 : u->input_filter_init = ngx_http_memc_empty_filter_init;
274 0 : u->input_filter = ngx_http_memc_empty_filter;
275 :
276 0 : } else if (memc_cmd == ngx_http_memc_cmd_incr
277 0 : || memc_cmd == ngx_http_memc_cmd_decr) {
278 0 : u->create_request = ngx_http_memc_create_incr_decr_cmd_request;
279 0 : u->process_header = ngx_http_memc_process_simple_header;
280 :
281 0 : u->input_filter_init = ngx_http_memc_empty_filter_init;
282 0 : u->input_filter = ngx_http_memc_empty_filter;
283 :
284 : } else {
285 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
286 : "assertion failed: command \"%v\" does not have proper "
287 : "handlers.", cmd_vv);
288 :
289 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
290 : }
291 :
292 0 : u->reinit_request = ngx_http_memc_reinit_request;
293 0 : u->abort_request = ngx_http_memc_abort_request;
294 0 : u->finalize_request = ngx_http_memc_finalize_request;
295 :
296 0 : u->input_filter_ctx = ctx;
297 :
298 0 : if (is_storage_cmd
299 0 : || memc_cmd == ngx_http_memc_cmd_flush_all
300 0 : || memc_cmd == ngx_http_memc_cmd_delete)
301 : {
302 0 : exptime_vv = ngx_http_get_indexed_variable(r, mmcf->exptime_index);
303 :
304 0 : if (exptime_vv == NULL) {
305 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
306 : }
307 :
308 0 : ctx->memc_exptime_vv = exptime_vv;
309 :
310 0 : if (!exptime_vv->not_found
311 0 : && exptime_vv->len
312 0 : && !ngx_http_memc_valid_uint32_str(exptime_vv->data,
313 0 : exptime_vv->len))
314 : {
315 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
316 : "variable \"$memc_exptime\" takes invalid value: %v",
317 : exptime_vv);
318 :
319 0 : return NGX_HTTP_BAD_REQUEST;
320 : }
321 : }
322 :
323 0 : if (is_storage_cmd || memc_cmd == ngx_http_memc_cmd_get) {
324 0 : flags_vv = ngx_http_get_indexed_variable(r, mmcf->flags_index);
325 0 : if (flags_vv == NULL) {
326 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
327 : }
328 :
329 0 : ctx->memc_flags_vv = flags_vv;
330 :
331 0 : if (is_storage_cmd
332 0 : && !flags_vv->not_found
333 0 : && flags_vv->len
334 0 : && !ngx_http_memc_valid_uint32_str(flags_vv->data, flags_vv->len))
335 : {
336 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
337 : "variable \"$memc_flags\" takes invalid value: %v",
338 : flags_vv);
339 :
340 0 : return NGX_HTTP_BAD_REQUEST;
341 : }
342 : }
343 :
344 0 : if (is_storage_cmd
345 0 : || memc_cmd == ngx_http_memc_cmd_incr
346 0 : || memc_cmd == ngx_http_memc_cmd_decr)
347 : {
348 0 : value_vv = ngx_http_get_indexed_variable(r, mmcf->value_index);
349 0 : if (value_vv == NULL) {
350 0 : return NGX_HTTP_INTERNAL_SERVER_ERROR;
351 : }
352 :
353 0 : if (memc_cmd == ngx_http_memc_cmd_incr
354 0 : || memc_cmd == ngx_http_memc_cmd_decr)
355 : {
356 0 : if (value_vv->not_found || value_vv->len == 0) {
357 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
358 : "the \"$memc_value\" variable is required for "
359 : "command \"%V\"", &ctx->cmd_str);
360 :
361 0 : return NGX_HTTP_BAD_REQUEST;
362 : }
363 :
364 0 : if (!ngx_http_memc_valid_uint64_str(value_vv->data,
365 0 : value_vv->len))
366 : {
367 0 : ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
368 : "variable \"$memc_value\" is invalid for "
369 : "incr/decr: %v", value_vv);
370 :
371 0 : return NGX_HTTP_BAD_REQUEST;
372 : }
373 : }
374 :
375 0 : ctx->memc_value_vv = value_vv;
376 : }
377 :
378 0 : rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init);
379 :
380 0 : if (rc == NGX_ERROR || rc > NGX_OK) {
381 0 : return rc;
382 : }
383 :
384 0 : return NGX_DONE;
385 : }
386 :
387 :
388 : static ngx_int_t
389 0 : ngx_http_memc_reinit_request(ngx_http_request_t *r)
390 : {
391 0 : return NGX_OK;
392 : }
393 :
394 :
395 : static void
396 0 : ngx_http_memc_abort_request(ngx_http_request_t *r)
397 : {
398 0 : ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
399 : "abort http memcached request");
400 0 : return;
401 : }
402 :
403 :
404 : static void
405 0 : ngx_http_memc_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
406 : {
407 0 : ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
408 : "finalize http memcached request");
409 0 : return;
410 : }
411 :
412 :
413 : static ngx_flag_t
414 0 : ngx_http_memc_in_cmds_allowed(ngx_http_memc_loc_conf_t *mlcf,
415 : ngx_http_memc_cmd_t memc_cmd)
416 : {
417 : ngx_uint_t i;
418 : ngx_http_memc_cmd_t *value;
419 :
420 0 : if (mlcf->cmds_allowed == NULL || mlcf->cmds_allowed->nelts == 0) {
421 : /* by default, all the memcached commands supported are allowed. */
422 0 : return 1;
423 : }
424 :
425 0 : value = mlcf->cmds_allowed->elts;
426 :
427 0 : for (i = 0; i < mlcf->cmds_allowed->nelts; i++) {
428 0 : if (memc_cmd == value[i]) {
429 0 : return 1;
430 : }
431 : }
432 :
433 0 : return 0;
434 : }
435 :
436 :
437 : static ngx_flag_t
438 0 : ngx_http_memc_valid_uint32_str(u_char *data, size_t len)
439 : {
440 : u_char *p, *last;
441 :
442 0 : if (len > NGX_UINT32_LEN) {
443 0 : return 0;
444 : }
445 :
446 0 : last = data + len;
447 0 : for (p = data; p != last; p++) {
448 0 : if (*p < '0' || *p > '9') {
449 0 : return 0;
450 : }
451 : }
452 :
453 0 : return 1;
454 : }
455 :
456 :
457 : static ngx_flag_t
458 0 : ngx_http_memc_valid_uint64_str(u_char *data, size_t len)
459 : {
460 : u_char *p, *last;
461 :
462 0 : if (len > NGX_UINT64_LEN) {
463 0 : return 0;
464 : }
465 :
466 0 : last = data + len;
467 0 : for (p = data; p != last; p++) {
468 0 : if (*p < '0' || *p > '9') {
469 0 : return 0;
470 : }
471 : }
472 :
473 0 : return 1;
474 : }
475 :
476 :
477 : ngx_int_t
478 18 : ngx_http_memc_init(ngx_conf_t *cf)
479 : {
480 : ngx_http_memc_main_conf_t *mmcf;
481 :
482 18 : mmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_memc_module);
483 :
484 18 : if (!mmcf->module_used) {
485 18 : return NGX_OK;
486 : }
487 :
488 0 : mmcf->key_index = ngx_http_memc_add_variable(cf, &ngx_http_memc_key);
489 0 : if (mmcf->key_index == NGX_ERROR) {
490 0 : return NGX_ERROR;
491 : }
492 :
493 0 : mmcf->cmd_index = ngx_http_memc_add_variable(cf, &ngx_http_memc_cmd);
494 0 : if (mmcf->cmd_index == NGX_ERROR) {
495 0 : return NGX_ERROR;
496 : }
497 :
498 0 : mmcf->flags_index = ngx_http_memc_add_variable(cf, &ngx_http_memc_flags);
499 0 : if (mmcf->flags_index == NGX_ERROR) {
500 0 : return NGX_ERROR;
501 : }
502 :
503 0 : mmcf->exptime_index = ngx_http_memc_add_variable(cf,
504 : &ngx_http_memc_exptime);
505 0 : if (mmcf->exptime_index == NGX_ERROR) {
506 0 : return NGX_ERROR;
507 : }
508 :
509 0 : mmcf->value_index = ngx_http_memc_add_variable(cf, &ngx_http_memc_value);
510 0 : if (mmcf->value_index == NGX_ERROR) {
511 0 : return NGX_ERROR;
512 : }
513 :
514 0 : return ngx_http_memc_add_more_variables(cf);
515 : }
516 :
517 :
518 : static ngx_int_t
519 0 : ngx_http_memc_add_variable(ngx_conf_t *cf, ngx_str_t *name)
520 : {
521 : ngx_http_variable_t *v;
522 :
523 0 : v = ngx_http_add_variable(cf, name, NGX_HTTP_VAR_CHANGEABLE);
524 0 : if (v == NULL) {
525 0 : return NGX_ERROR;
526 : }
527 :
528 0 : v->get_handler = ngx_http_memc_variable_not_found;
529 0 : return ngx_http_get_variable_index(cf, name);
530 : }
531 :
532 :
533 : static ngx_int_t
534 0 : ngx_http_memc_variable_not_found(ngx_http_request_t *r,
535 : ngx_http_variable_value_t *v, uintptr_t data)
536 : {
537 0 : v->not_found = 1;
538 0 : return NGX_OK;
539 : }
540 :
541 :
542 : static ngx_int_t
543 0 : ngx_http_memc_add_more_variables(ngx_conf_t *cf)
544 : {
545 : ngx_http_variable_t *var, *v;
546 0 : for (v = ngx_http_memc_variables; v->name.len; v++) {
547 0 : var = ngx_http_add_variable(cf, &v->name, v->flags);
548 0 : if (var == NULL) {
549 0 : return NGX_ERROR;
550 : }
551 0 : var->get_handler = v->get_handler;
552 0 : var->data = v->data;
553 : }
554 0 : return NGX_OK;
555 : }
556 :
557 :
558 : static ngx_int_t
559 0 : ngx_http_memc_flags_as_http_time_variable(
560 : ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data)
561 : {
562 : u_char *p;
563 : size_t len;
564 0 : time_t flags_time = 0;
565 : ngx_http_memc_ctx_t *ctx;
566 :
567 : ngx_http_variable_value_t *flags_vv;
568 :
569 0 : ctx = ngx_http_get_module_ctx(r, ngx_http_memc_module);
570 :
571 0 : flags_vv = ctx->memc_flags_vv;
572 0 : if (flags_vv == NULL) {
573 0 : goto not_found;
574 : }
575 :
576 0 : if (flags_vv->not_found || flags_vv->len == 0) {
577 : goto not_found;
578 : }
579 :
580 0 : flags_time = ngx_atotm(flags_vv->data, flags_vv->len);
581 0 : if (flags_time == NGX_ERROR) {
582 0 : return NGX_ERROR;
583 : }
584 :
585 0 : len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT") - 1;
586 :
587 0 : p = ngx_pnalloc(r->pool, len);
588 0 : if (p == NULL) {
589 0 : return NGX_ERROR;
590 : }
591 :
592 0 : ngx_http_time(p, flags_time);
593 :
594 0 : v->len = len;
595 0 : v->data = p;
596 :
597 0 : v->valid = 1;
598 0 : v->not_found = 0;
599 0 : v->no_cacheable = 0;
600 :
601 0 : return NGX_OK;
602 :
603 0 : not_found:
604 :
605 0 : v->len = 0;
606 0 : v->data = NULL;
607 0 : v->valid = 1;
608 0 : v->not_found = 1;
609 :
610 0 : return NGX_OK;
611 : }
|