Skip to content

Commit

Permalink
add 'raw_uri' built-in variable for original request URI but without …
Browse files Browse the repository at this point in the history
…arguments
  • Loading branch information
flygoast committed Sep 18, 2013
1 parent bd5601d commit 1584a3f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/http/ngx_http_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,15 @@ ngx_http_process_request_line(ngx_event_t *rev)
}


if (r->args_start) {
r->raw_uri.len = r->args_start - 1 - r->uri_start;

} else {
r->raw_uri.len = r->uri_end - r->uri_start;
}
r->raw_uri.data = r->uri_start;


r->unparsed_uri.len = r->uri_end - r->uri_start;
r->unparsed_uri.data = r->uri_start;

Expand Down
1 change: 1 addition & 0 deletions src/http/ngx_http_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ struct ngx_http_request_s {
ngx_uint_t http_version;

ngx_str_t request_line;
ngx_str_t raw_uri;
ngx_str_t uri;
ngx_str_t args;
ngx_str_t exten;
Expand Down
4 changes: 4 additions & 0 deletions src/http/ngx_http_variables.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
{ ngx_string("request_uri"), NULL, ngx_http_variable_request,
offsetof(ngx_http_request_t, unparsed_uri), 0, 0 },

{ ngx_string("raw_uri"), NULL, ngx_http_variable_request,
offsetof(ngx_http_request_t, raw_uri),
NGX_HTTP_VAR_NOCACHEABLE, 0 },

{ ngx_string("uri"), NULL, ngx_http_variable_request,
offsetof(ngx_http_request_t, uri),
NGX_HTTP_VAR_NOCACHEABLE, 0 },
Expand Down

0 comments on commit 1584a3f

Please sign in to comment.