Project

General

Profile

Bug #2661

redirect to directory should url-encode uri.path

Added by gstrauss over 3 years ago. Updated about 3 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
2015-08-14
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:
Yes

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.

Associated revisions

Revision 3052 (diff)
Added by stbuehler about 3 years ago

[core] encode path with ENCODING_REL_URI in redirect to directory (fixes #2661, thx gstrauss)

From: Stefan Bühler <>

Revision 85d8a175 (diff)
Added by stbuehler about 3 years ago

[core] encode path with ENCODING_REL_URI in redirect to directory (fixes #2661, thx gstrauss)

From: Stefan Bühler <>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3052 152afb58-edef-0310-8abb-c4023f1b3aa9

History

#1

Updated by gstrauss over 3 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/'
#2

Updated by stbuehler over 3 years ago

  • Target version changed from 1.4.37 to 1.4.38
#3

Updated by stbuehler about 3 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r3052.

Also available in: Atom