Mercurial > hg > nginx-vendor-1-0
comparison src/http/modules/ngx_http_memcached_module.c @ 430:dac47e9ef0d5 NGINX_0_7_27
nginx 0.7.27
*) Feature: the "try_files" directive.
*) Feature: variables support in the "fastcgi_pass" directive.
*) Feature: now the $geo variable may get an address from a
variable.
Thanks to Andrei Nigmatulin.
*) Feature: now a location's modifier may be used without space before
name.
*) Feature: the $upstream_response_length variable.
*) Bugfix: now a "add_header" directive does not add an empty value.
*) Bugfix: if zero length static file was requested, then nginx just
closed connection; the bug had appeared in 0.7.25.
*) Bugfix: a MOVE method could not move file in non-existent directory.
*) Bugfix: a segmentation fault occurred in worker process, if no one
named location was defined in server, but some one was used in an
error_page directive.
Thanks to Sergey Bochenkov.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 15 Dec 2008 00:00:00 +0300 |
parents | 79c5df00501e |
children | f39b9e29530d |
comparison
equal
deleted
inserted
replaced
429:3b8e9d1bc9bb | 430:dac47e9ef0d5 |
---|---|
181 u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); | 181 u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); |
182 if (u == NULL) { | 182 if (u == NULL) { |
183 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 183 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
184 } | 184 } |
185 | 185 |
186 u->schema = mlcf->upstream.schema; | 186 u->schema.len = sizeof("memcached://") - 1; |
187 u->schema.data = (u_char *) "memcached://"; | |
187 | 188 |
188 u->peer.log = r->connection->log; | 189 u->peer.log = r->connection->log; |
189 u->peer.log_error = NGX_ERROR_ERR; | 190 u->peer.log_error = NGX_ERROR_ERR; |
190 #if (NGX_THREADS) | 191 #if (NGX_THREADS) |
191 u->peer.lock = &r->connection->lock; | 192 u->peer.lock = &r->connection->lock; |
519 * set by ngx_pcalloc(): | 520 * set by ngx_pcalloc(): |
520 * | 521 * |
521 * conf->upstream.bufs.num = 0; | 522 * conf->upstream.bufs.num = 0; |
522 * conf->upstream.next_upstream = 0; | 523 * conf->upstream.next_upstream = 0; |
523 * conf->upstream.temp_path = NULL; | 524 * conf->upstream.temp_path = NULL; |
524 * conf->upstream.schema = { 0, NULL }; | |
525 * conf->upstream.uri = { 0, NULL }; | 525 * conf->upstream.uri = { 0, NULL }; |
526 * conf->upstream.location = NULL; | 526 * conf->upstream.location = NULL; |
527 */ | 527 */ |
528 | 528 |
529 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; | 529 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; |
582 |NGX_HTTP_UPSTREAM_FT_OFF; | 582 |NGX_HTTP_UPSTREAM_FT_OFF; |
583 } | 583 } |
584 | 584 |
585 if (conf->upstream.upstream == NULL) { | 585 if (conf->upstream.upstream == NULL) { |
586 conf->upstream.upstream = prev->upstream.upstream; | 586 conf->upstream.upstream = prev->upstream.upstream; |
587 conf->upstream.schema = prev->upstream.schema; | |
588 } | 587 } |
589 | 588 |
590 if (conf->index == NGX_CONF_UNSET) { | 589 if (conf->index == NGX_CONF_UNSET) { |
591 conf->index = prev->index; | 590 conf->index = prev->index; |
592 } | 591 } |
596 | 595 |
597 | 596 |
598 static char * | 597 static char * |
599 ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 598 ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
600 { | 599 { |
601 ngx_http_memcached_loc_conf_t *lcf = conf; | 600 ngx_http_memcached_loc_conf_t *mlcf = conf; |
602 | 601 |
603 ngx_str_t *value; | 602 ngx_str_t *value; |
604 ngx_url_t u; | 603 ngx_url_t u; |
605 ngx_http_core_loc_conf_t *clcf; | 604 ngx_http_core_loc_conf_t *clcf; |
606 | 605 |
607 if (lcf->upstream.schema.len) { | 606 if (mlcf->upstream.upstream) { |
608 return "is duplicate"; | 607 return "is duplicate"; |
609 } | 608 } |
610 | 609 |
611 value = cf->args->elts; | 610 value = cf->args->elts; |
612 | 611 |
613 ngx_memzero(&u, sizeof(ngx_url_t)); | 612 ngx_memzero(&u, sizeof(ngx_url_t)); |
614 | 613 |
615 u.url = value[1]; | 614 u.url = value[1]; |
616 u.no_resolve = 1; | 615 u.no_resolve = 1; |
617 | 616 |
618 lcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0); | 617 mlcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0); |
619 if (lcf->upstream.upstream == NULL) { | 618 if (mlcf->upstream.upstream == NULL) { |
620 return NGX_CONF_ERROR; | 619 return NGX_CONF_ERROR; |
621 } | 620 } |
622 | |
623 lcf->upstream.schema.len = sizeof("memcached://") - 1; | |
624 lcf->upstream.schema.data = (u_char *) "memcached://"; | |
625 | 621 |
626 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); | 622 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
627 | 623 |
628 clcf->handler = ngx_http_memcached_handler; | 624 clcf->handler = ngx_http_memcached_handler; |
629 | 625 |
630 if (clcf->name.data[clcf->name.len - 1] == '/') { | 626 if (clcf->name.data[clcf->name.len - 1] == '/') { |
631 clcf->auto_redirect = 1; | 627 clcf->auto_redirect = 1; |
632 } | 628 } |
633 | 629 |
634 lcf->index = ngx_http_get_variable_index(cf, &ngx_http_memcached_key); | 630 mlcf->index = ngx_http_get_variable_index(cf, &ngx_http_memcached_key); |
635 | 631 |
636 if (lcf->index == NGX_ERROR) { | 632 if (mlcf->index == NGX_ERROR) { |
637 return NGX_CONF_ERROR; | 633 return NGX_CONF_ERROR; |
638 } | 634 } |
639 | 635 |
640 return NGX_CONF_OK; | 636 return NGX_CONF_OK; |
641 } | 637 } |