Ticket #443 (assigned enhancement)

Opened 3 years ago

Last modified 4 weeks ago

[PATCH] mod_redirect: Add support for url-encoding backreferences, map %%n->%n, $$n->$n

Reported by: will@… Owned by: moo
Priority: normal Milestone: 1.5.0
Component: mod_redirect Version: 1.4.x-svn
Severity: normal Keywords: urlencode backreference
Cc: Blocked By:
Need User Feedback: no Blocking:

Description

Attached is a simple user-contributed (e.g. no guarantees) patch to expand the capabilities of mod_redirect for lighttpd 1.4.8.

It adds two features:

* optional url-encoding for backreferences

* allow backreference character usage without substituting a backref.

Here is an example of the first case:

Let's say that you want to map the specified URL into a CGI argument, but you want it to be escaped properly --

 url.redirect = ( "^(.*)$" =>
                  "/view?path=$!1"

If a user requests "http://example.com/special/documents?foo=bar", they will be redirected to "http://example.com/view?path=%2Fspecial%2Fdocuments%3Ffoo%3Dbar".

Now let's say you want to include an absolute address so that the user is redirected to a different site, http://2.example.com. You would want the redirection to result in the following URL: "http://example.com/view?path=http%3A%2F%2F2.example.com%2Fspecial%2Fdocuments%3Ffoo%3Dbar".

The second change allows you to do this with mod_redirect:

 url.redirect = ( "^(.*)$" =>
                  "http%%3A%%2F%%2F2.example.com/view?path=$!1"

Using double percents, mod_redirect will no longer assume that the %3 in %%3A is a poor backreference and it will print out the desired single %.

--

Doh - it looks like I need to attach after I file the ticket. If I have a problem with it, I will put it on the wiki as an attachment.

Attachments

mod_redirect_expansion-1.4.8.patch (2.6 kB) - added by will@… 3 years ago.
mod_redirect url-encode and %%/$$ patch
ticket-443.patch (11.2 kB) - added by moo 2 years ago.

Change History

Changed 3 years ago by will@…

mod_redirect url-encode and %%/$$ patch

Changed 2 years ago by moo

  • keywords urlencode backreference added
  • owner changed from jan to moo
  • status changed from new to assigned
  • milestone set to lighttpd-1.4.x

assign to me. applies to mod_rewrite too. anyone else have another character against the '!' ?

Changed 2 years ago by moo

patch pending

Changed 2 years ago by moo

Changed 12 months ago by moo

  • pending unset
  • milestone changed from 1.4.18 to 1.5.0

Changed 12 months ago by moo

cannot be done in 1.4.x unless [1094] is merged back to branches/1.4.x, need discussion for 1.5

Changed 7 months ago by anonymous

  • cc http://bestfindingout.com removed
  • component changed from mod_rewrite to mod_redirect
  • summary changed from what wrong? to [PATCH] mod_redirect: Add support for url-encoding backreferences, map %%n->%n, $$n->$n
  • priority changed from lowest to normal
  • keywords urlencode backreference added
  • type changed from defect to enhancement

This site could really benefit from some, any, spam prevention.

Changed 6 months ago by raja@…

  • keywords urlencode backreference added; MESSAGE removed
  • summary changed from [PATCH] mod_redirect: Add support for url-encoding backreferences, map %%n->%n, $$n->$n to [PATCH] mod_redirect: Add support for url-encoding backreferences, map %%n->%n, $$n->$n

Fixed spam changes

Add/Change #443 ([PATCH] mod_redirect: Add support for url-encoding backreferences, map %%n->%n, $$n->$n)

Author



Change Properties
<Author field>
Action
as assigned
 
Note: See TracTickets for help on using tickets.