Klaus Demo nginx / 2c7cb55
ngx_http_split_args() Igor Sysoev 13 years ago
2 changed file(s) with 36 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
7777 ngx_str_t *name, ngx_str_t *value);
7878 ngx_int_t ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len,
7979 ngx_str_t *value);
80 void ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri,
81 ngx_str_t *args);
8082
8183
8284 ngx_int_t ngx_http_find_server_conf(ngx_http_request_t *r);
15221522
15231523 return NGX_DECLINED;
15241524 }
1525
1526
1527 void
1528 ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args)
1529 {
1530 u_char ch, *p, *last;
1531
1532 p = uri->data;
1533
1534 last = p + uri->len;
1535
1536 while (p < last) {
1537
1538 ch = *p++;
1539
1540 if (ch == '?') {
1541 args->len = last - p;
1542 args->data = p;
1543
1544 uri->len = p - 1 - uri->data;
1545
1546 if (ngx_strlchr(p, last, '\0') != NULL) {
1547 r->zero_in_uri = 1;
1548 }
1549
1550 return;
1551 }
1552
1553 if (ch == '\0') {
1554 r->zero_in_uri = 1;
1555 continue;
1556 }
1557 }
1558 }