Mercurial > hg > nginx-vendor-0-5
comparison src/http/ngx_http_variables.c @ 106:45f7329b4bd0 NGINX_0_3_0
nginx 0.3.0
*) Change: the 10-days live time limit of worker process was
eliminated. The limit was introduced because of millisecond timers
overflow.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 07 Oct 2005 00:00:00 +0400 |
parents | f63280c59dd5 |
children | dad2fe8ecf08 |
comparison
equal
deleted
inserted
replaced
105:531d62c2a28d | 106:45f7329b4bd0 |
---|---|
617 | 617 |
618 | 618 |
619 static ngx_http_variable_value_t * | 619 static ngx_http_variable_value_t * |
620 ngx_http_variable_request_filename(ngx_http_request_t *r, uintptr_t data) | 620 ngx_http_variable_request_filename(ngx_http_request_t *r, uintptr_t data) |
621 { | 621 { |
622 u_char *p; | 622 ngx_http_variable_value_t *vv; |
623 ngx_http_core_loc_conf_t *clcf; | 623 |
624 ngx_http_variable_value_t *vv; | 624 vv = ngx_palloc(r->pool, sizeof(ngx_http_variable_value_t)); |
625 | 625 if (vv == NULL) { |
626 vv = ngx_palloc(r->pool, sizeof(ngx_http_variable_value_t)); | 626 return NULL; |
627 if (vv == NULL) { | 627 } |
628 return NULL; | 628 |
629 } | 629 vv->value = 0; |
630 | 630 |
631 vv->value = 0; | 631 if (ngx_http_map_uri_to_path(r, &vv->text, 0) == NULL) { |
632 | 632 return NULL; |
633 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 633 } |
634 | 634 |
635 if (!clcf->alias) { | 635 /* ngx_http_map_uri_to_path() allocates memory for terminating '\0' */ |
636 vv->text.len = clcf->root.len + r->uri.len; | 636 |
637 vv->text.data = ngx_palloc(r->pool, vv->text.len); | 637 vv->text.len--; |
638 if (vv->text.data == NULL) { | |
639 return NULL; | |
640 } | |
641 | |
642 p = ngx_cpymem(vv->text.data, clcf->root.data, clcf->root.len); | |
643 ngx_memcpy(p, r->uri.data, r->uri.len + 1); | |
644 | |
645 } else { | |
646 vv->text.len = clcf->root.len + r->uri.len + 2 - clcf->name.len; | |
647 vv->text.data = ngx_palloc(r->pool, vv->text.len); | |
648 if (vv->text.data == NULL) { | |
649 return NULL; | |
650 } | |
651 | |
652 p = ngx_cpymem(vv->text.data, clcf->root.data, clcf->root.len); | |
653 ngx_memcpy(p, r->uri.data + clcf->name.len, | |
654 r->uri.len + 1 - clcf->name.len); | |
655 } | |
656 | 638 |
657 return vv; | 639 return vv; |
658 } | 640 } |
659 | 641 |
660 | 642 |