redirect to directory should url-encode uri.path
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_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 8 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/'
Also available in: Atom