Mercurial > hg > nginx-quic
comparison src/http/ngx_http_core_module.c @ 623:0216fd1471f3 release-0.3.33
nginx-0.3.33-RELEASE import
*) Feature: the "http_503" parameter of the "proxy_next_upstream" or
"fastcgi_next_upstream" directives.
*) Bugfix: ngx_http_perl_module did not work with inlined in the
configuration code, if it was not started with the "sub" word.
*) Bugfix: in the "post_action" directive.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 15 Mar 2006 09:53:04 +0000 |
parents | 7a16e281c01f |
children | fbed40ce7cb4 |
comparison
equal
deleted
inserted
replaced
622:b088081fe8c3 | 623:0216fd1471f3 |
---|---|
1001 | 1001 |
1002 u_char * | 1002 u_char * |
1003 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, | 1003 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, |
1004 size_t reserved) | 1004 size_t reserved) |
1005 { | 1005 { |
1006 u_char *last; | 1006 u_char *last; |
1007 size_t alias, len; | 1007 size_t alias; |
1008 ngx_http_script_code_pt code; | 1008 ngx_http_core_loc_conf_t *clcf; |
1009 ngx_http_script_engine_t e; | |
1010 ngx_http_core_loc_conf_t *clcf; | |
1011 ngx_http_script_len_code_pt lcode; | |
1012 | 1009 |
1013 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 1010 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
1014 | 1011 |
1015 alias = clcf->alias ? clcf->name.len : 0; | 1012 alias = clcf->alias ? clcf->name.len : 0; |
1016 | 1013 |
1019 "\"alias\" could not be used in location \"%V\" " | 1016 "\"alias\" could not be used in location \"%V\" " |
1020 "where URI was rewritten", &clcf->name); | 1017 "where URI was rewritten", &clcf->name); |
1021 return NULL; | 1018 return NULL; |
1022 } | 1019 } |
1023 | 1020 |
1021 reserved += r->uri.len - alias + 1; | |
1022 | |
1024 if (clcf->root_lengths == NULL) { | 1023 if (clcf->root_lengths == NULL) { |
1025 | 1024 |
1026 r->root_length = clcf->root.len; | 1025 r->root_length = clcf->root.len; |
1027 | 1026 |
1028 path->len = clcf->root.len + r->uri.len - alias + 1 + reserved; | 1027 path->len = clcf->root.len + reserved; |
1029 | 1028 |
1030 path->data = ngx_palloc(r->pool, path->len); | 1029 path->data = ngx_palloc(r->pool, path->len); |
1031 if (path->data == NULL) { | 1030 if (path->data == NULL) { |
1032 return NULL; | 1031 return NULL; |
1033 } | 1032 } |
1034 | 1033 |
1035 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); | 1034 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); |
1036 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); | 1035 |
1037 | 1036 } else { |
1038 return last; | 1037 last = ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, |
1039 } | 1038 clcf->root_values->elts); |
1040 | 1039 if (last == NULL) { |
1041 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); | 1040 return NULL; |
1042 | 1041 } |
1043 e.ip = clcf->root_lengths->elts; | 1042 |
1044 e.request = r; | 1043 r->root_length = path->len - reserved; |
1045 e.flushed = 1; | 1044 } |
1046 | 1045 |
1047 len = 0; | 1046 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); |
1048 | |
1049 while (*(uintptr_t *) e.ip) { | |
1050 lcode = *(ngx_http_script_len_code_pt *) e.ip; | |
1051 len += lcode(&e); | |
1052 } | |
1053 | |
1054 r->root_length = len; | |
1055 | |
1056 len += r->uri.len - alias + 1 + reserved; | |
1057 | |
1058 path->len = len; | |
1059 path->data = ngx_palloc(r->pool, len); | |
1060 if (path->data == NULL) { | |
1061 return NULL; | |
1062 } | |
1063 | |
1064 e.ip = clcf->root_values->elts; | |
1065 e.pos = path->data; | |
1066 | |
1067 while (*(uintptr_t *) e.ip) { | |
1068 code = *(ngx_http_script_code_pt *) e.ip; | |
1069 code((ngx_http_script_engine_t *) &e); | |
1070 } | |
1071 | |
1072 last = ngx_cpystrn(e.pos, r->uri.data + alias, r->uri.len - alias + 1); | |
1073 | 1047 |
1074 return last; | 1048 return last; |
1075 } | 1049 } |
1076 | 1050 |
1077 | 1051 |