Skip to content

Commit eb108f0

Browse files
authored
Merge pull request #14 from sugitach/feature/10416/fix_re-parsed_uri
ref #10416 fix re-parsed uri
2 parents 5a16bcb + f3393b2 commit eb108f0

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

ngx_http_pta_module.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,17 +858,26 @@ ngx_http_pta_handler (ngx_http_request_t * r)
858858

859859
ngx_log_error (NGX_LOG_DEBUG, r->connection->log, 0, "successful");
860860

861+
ngx_str_t unparsed_uri;
862+
unparsed_uri.len = 2 * r->uri.len;
863+
unparsed_uri.data = ngx_pnalloc(r->pool, unparsed_uri.len);
864+
if (unparsed_uri.data == NULL) {
865+
return NGX_ERROR;
866+
}
867+
u_char *p = (u_char *)ngx_escape_uri(unparsed_uri.data, r->uri.data, r->uri.len, NGX_ESCAPE_URI);
868+
unparsed_uri.len = p - unparsed_uri.data;
869+
861870
ngx_str_t *qs;
862871
qs = ngx_http_pta_delete_arg (r, "pta", sizeof ("pta") - 1);
863872
if (qs)
864873
{
865874
ngx_str_t *uri;
866-
uri = ngx_http_pta_qparam_cat (r, &r->uri, qs, "?");
875+
uri = ngx_http_pta_qparam_cat (r, &unparsed_uri, qs, "?");
867876
r->unparsed_uri = *uri;
868877
}
869878
else
870879
{
871-
r->unparsed_uri = r->uri;
880+
r->unparsed_uri = unparsed_uri;
872881
}
873882

874883
return NGX_DECLINED;

0 commit comments

Comments
 (0)