Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 773:c3ebeee31026
remove r->root_length
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 12 Oct 2006 13:36:54 +0000 |
parents | 843412b22ba2 |
children | 4ab852b691f5 |
comparison
equal
deleted
inserted
replaced
772:843412b22ba2 | 773:c3ebeee31026 |
---|---|
792 | 792 |
793 ngx_int_t | 793 ngx_int_t |
794 ngx_http_core_content_phase(ngx_http_request_t *r, | 794 ngx_http_core_content_phase(ngx_http_request_t *r, |
795 ngx_http_phase_handler_t *ph) | 795 ngx_http_phase_handler_t *ph) |
796 { | 796 { |
797 size_t root; | |
797 ngx_int_t rc; | 798 ngx_int_t rc; |
798 ngx_str_t path; | 799 ngx_str_t path; |
799 | 800 |
800 if (r->content_handler) { | 801 if (r->content_handler) { |
801 r->write_event_handler = ngx_http_request_empty_handler; | 802 r->write_event_handler = ngx_http_request_empty_handler; |
828 | 829 |
829 /* no content handler was found */ | 830 /* no content handler was found */ |
830 | 831 |
831 if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) { | 832 if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) { |
832 | 833 |
833 if (ngx_http_map_uri_to_path(r, &path, 0) != NULL) { | 834 if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) { |
834 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 835 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
835 "directory index of \"%V\" is forbidden", &path); | 836 "directory index of \"%V\" is forbidden", &path); |
836 } | 837 } |
837 | 838 |
838 ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN); | 839 ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN); |
1155 } | 1156 } |
1156 | 1157 |
1157 | 1158 |
1158 u_char * | 1159 u_char * |
1159 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, | 1160 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, |
1160 size_t reserved) | 1161 size_t *root_length, size_t reserved) |
1161 { | 1162 { |
1162 u_char *last; | 1163 u_char *last; |
1163 size_t alias; | 1164 size_t alias; |
1164 ngx_http_core_loc_conf_t *clcf; | 1165 ngx_http_core_loc_conf_t *clcf; |
1165 | 1166 |
1176 | 1177 |
1177 reserved += r->uri.len - alias + 1; | 1178 reserved += r->uri.len - alias + 1; |
1178 | 1179 |
1179 if (clcf->root_lengths == NULL) { | 1180 if (clcf->root_lengths == NULL) { |
1180 | 1181 |
1181 r->root_length = clcf->root.len; | 1182 *root_length = clcf->root.len; |
1182 | 1183 |
1183 path->len = clcf->root.len + reserved; | 1184 path->len = clcf->root.len + reserved; |
1184 | 1185 |
1185 path->data = ngx_palloc(r->pool, path->len); | 1186 path->data = ngx_palloc(r->pool, path->len); |
1186 if (path->data == NULL) { | 1187 if (path->data == NULL) { |
1199 | 1200 |
1200 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path) == NGX_ERROR) { | 1201 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path) == NGX_ERROR) { |
1201 return NULL; | 1202 return NULL; |
1202 } | 1203 } |
1203 | 1204 |
1204 r->root_length = path->len - reserved; | 1205 *root_length = path->len - reserved; |
1205 last = path->data + r->root_length; | 1206 last = path->data + *root_length; |
1206 } | 1207 } |
1207 | 1208 |
1208 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); | 1209 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); |
1209 | 1210 |
1210 return last; | 1211 return last; |