aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-10-07 13:30:52 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-10-07 13:30:52 +0000
commit208eed22101e987a370036fa3851ce81c088c599 (patch)
tree40f2aa55bb0415eef08415373d380577eb18561f /src/http/ngx_http_core_module.c
parent12b7a12a2d2cbf4a98a23c2d6c0c06ff588d2d70 (diff)
downloadnginx-release-0.3.0.tar.gz
nginx-release-0.3.0.zip
nginx-0.3.0-RELEASE importrelease-0.3.0
*) Change: the 10-days live time limit of worker process was eliminated. The limit was introduced because of millisecond timers overflow.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c74
1 files changed, 50 insertions, 24 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 0643a87fd..4c6cfc073 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -911,6 +911,41 @@ ngx_http_set_content_type(ngx_http_request_t *r)
ngx_int_t
+ngx_http_set_exten(ngx_http_request_t *r)
+{
+ ngx_int_t i;
+
+ r->exten.len = 0;
+ r->exten.data = NULL;
+
+ for (i = r->uri.len - 1; i > 1; i--) {
+ if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
+ r->exten.len = r->uri.len - i - 1;
+
+ if (r->exten.len > 0) {
+ r->exten.data = ngx_palloc(r->pool, r->exten.len + 1);
+ if (r->exten.data == NULL) {
+ return NGX_ERROR;
+ }
+
+ ngx_cpystrn(r->exten.data, &r->uri.data[i + 1],
+ r->exten.len + 1);
+ }
+
+ break;
+
+ } else if (r->uri.data[i] == '/') {
+ break;
+ }
+ }
+
+ r->low_case_exten = 0;
+
+ return NGX_OK;
+}
+
+
+ngx_int_t
ngx_http_send_header(ngx_http_request_t *r)
{
if (r->err_status) {
@@ -941,38 +976,29 @@ ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *in)
}
-ngx_int_t
-ngx_http_set_exten(ngx_http_request_t *r)
+u_char *
+ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
+ size_t reserved)
{
- ngx_int_t i;
-
- r->exten.len = 0;
- r->exten.data = NULL;
-
- for (i = r->uri.len - 1; i > 1; i--) {
- if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
- r->exten.len = r->uri.len - i - 1;
+ u_char *last;
+ size_t alias;
+ ngx_http_core_loc_conf_t *clcf;
- if (r->exten.len > 0) {
- r->exten.data = ngx_palloc(r->pool, r->exten.len + 1);
- if (r->exten.data == NULL) {
- return NGX_ERROR;
- }
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
- ngx_cpystrn(r->exten.data, &r->uri.data[i + 1],
- r->exten.len + 1);
- }
+ alias = clcf->alias ? clcf->name.len : 0;
- break;
+ path->len = clcf->root.len + r->uri.len - alias + 1 + reserved;
- } else if (r->uri.data[i] == '/') {
- break;
- }
+ path->data = ngx_palloc(r->pool, path->len);
+ if (path->data == NULL) {
+ return NULL;
}
- r->low_case_exten = 0;
+ last = ngx_cpymem(path->data, clcf->root.data, clcf->root.len);
+ last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1);
- return NGX_OK;
+ return last;
}