diff src/http/ngx_http_parse.c @ 2578:c7bdd722532f

ngx_http_split_args()
author Igor Sysoev <igor@sysoev.ru>
date Thu, 19 Mar 2009 13:41:29 +0000
parents d311b7f6a403
children c65755e03084
line wrap: on
line diff
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -1523,3 +1523,37 @@ ngx_http_arg(ngx_http_request_t *r, u_ch
 
     return NGX_DECLINED;
 }
+
+
+void
+ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args)
+{
+    u_char  ch, *p, *last;
+
+    p = uri->data;
+
+    last = p + uri->len;
+
+    while (p < last) {
+
+	ch = *p++;
+
+	if (ch == '?') {
+	    args->len = last - p;
+	    args->data = p;
+
+	    uri->len = p - 1 - uri->data;
+
+	    if (ngx_strlchr(p, last, '\0') != NULL) {
+		r->zero_in_uri = 1;
+	    }
+
+	    return;
+	}
+
+	if (ch == '\0') {
+	    r->zero_in_uri = 1;
+	    continue;
+	}
+    }
+}