diff src/http/ngx_http_parse.c @ 201:267ea1d98683

nginx-0.0.1-2003-11-30-23:03:18 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 30 Nov 2003 20:03:18 +0000
parents abeaebe0a33c
children e0bcfb77d6c7
line wrap: on
line diff
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -642,6 +642,7 @@ int ngx_http_parse_complex_uri(ngx_http_
     state = sw_usual;
     p = r->uri_start;
     u = r->uri.data;
+    r->uri_ext = NULL;
 
     ch = *p++;
 
@@ -654,6 +655,7 @@ ngx_log_debug(r->connection->log, "S: %d
         case sw_usual:
             switch(ch) {
             case '/':
+                r->uri_ext = NULL;
                 state = sw_slash;
                 *u++ = ch;
                 break;
@@ -661,6 +663,8 @@ ngx_log_debug(r->connection->log, "S: %d
                 quoted_state = state;
                 state = sw_quoted;
                 break;
+            case '.':
+                r->uri_ext = u + 1;
             default:
                 *u++ = ch;
                 break;
@@ -811,5 +815,17 @@ ngx_log_debug(r->connection->log, "S: %d
     r->uri.len = u - r->uri.data;
     r->uri.data[r->uri.len] = '\0';
 
+    if (r->uri_ext) {
+        r->exten.len = u - r->uri_ext;
+
+        if (!(r->exten.data = ngx_palloc(r->pool, r->exten.len + 1))) {
+            return NGX_HTTP_INTERNAL_SERVER_ERROR;
+        }
+
+        ngx_cpystrn(r->exten.data, r->uri_ext, r->exten.len + 1);
+    }
+
+    r->uri_ext = NULL;
+
     return NGX_OK;
 }