Bug #2661
closedredirect to directory should url-encode uri.path
Description
http_response_redirect_to_directory() in src/http-header-glue.c should url-encode con->uri.path when constructing Location response header, i.e. replace
buffer_append_string_buffer(o, con->uri.path);
with
buffer_append_string_encoded(o, CONST_BUF_LEN(con->uri.path), ENCODING_REL_URI);
See http://redmine.lighttpd.net/issues/1827 where mod_redirect and mod_rewrite were modified (subversion r2362) to use con->request.uri instead of con->uri.path and con->uri.query. If using con->request.uri is preferred over url-encoding con->uri.path, then '/' would need to be added after path and before query string (if present). However, using con->request.uri would mean that the original URI would have '/' appended, and any rewrite rules which subsequently modified con->uri.path would be ignored.
This is an issue in lighttpd 1.5, too.
Updated by gstrauss over 9 years ago
Patch would need to take mod_userdir into account for URL aesthetics. The simple substitution above makes some tests fail since the '~' is url-encoded.
response-header failed: expected 'http://www.example.org/~jan/', got 'http://www.example.org/%7ejan/'
Updated by stbuehler about 9 years ago
- Target version changed from 1.4.37 to 1.4.38
Updated by stbuehler about 9 years ago
- Status changed from New to Fixed
- % Done changed from 0 to 100
Applied in changeset r3052.
Also available in: Atom