https://issues.apache.org/bugzilla/show_bug.cgi?id=49512

           Summary: PATCH unset environment var with RewriteRule
           Product: Apache httpd-2
           Version: 2.3-HEAD
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: mod_rewrite
        AssignedTo: [email protected]
        ReportedBy: [email protected]


We need to unset environment variables from RewriteRules. Attached is a patch
against -trunk to do this. Example:

Configuration:

RewriteEngine on
LogLevel rewrite:trace5
RewriteRule ^ - [E=pling:plong]
RewriteRule ^ - [E=foo:boo,E=!pling]

Test:

$ GET http://localhost:8000/cgi-bin/printenv | egrep '(foo|pling)'
foo="boo"

Log:

[Mon Jun 28 16:44:43.364112 2010] [trace2] [pid 516:tid 1153177920]
mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - -
[localhost/sid#d5c9af8][rid#d6f4680/initial] init rewrite engine with requested
uri /cgi-bin/printenv\n
[Mon Jun 28 16:44:43.364157 2010] [trace3] [pid 516:tid 1153177920]
mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - -
[localhost/sid#d5c9af8][rid#d6f4680/initial] applying pattern '^' to uri
'/cgi-bin/printenv'\n
[Mon Jun 28 16:44:43.364177 2010] [trace5] [pid 516:tid 1153177920]
mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - -
[localhost/sid#d5c9af8][rid#d6f4680/initial] setting env variable 'pling' to
'plong'\n
[Mon Jun 28 16:44:43.364187 2010] [trace3] [pid 516:tid 1153177920]
mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - -
[localhost/sid#d5c9af8][rid#d6f4680/initial] applying pattern '^' to uri
'/cgi-bin/printenv'\n
[Mon Jun 28 16:44:43.364197 2010] [trace5] [pid 516:tid 1153177920]
mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - -
[localhost/sid#d5c9af8][rid#d6f4680/initial] setting env variable 'foo' to
'boo'\n
[Mon Jun 28 16:44:43.364207 2010] [trace5] [pid 516:tid 1153177920]
mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - -
[localhost/sid#d5c9af8][rid#d6f4680/initial] unsetting env variable 'pling'\n
[Mon Jun 28 16:44:43.364216 2010] [trace1] [pid 516:tid 1153177920]
mod_rewrite.c(447): [client 127.0.0.1:44518] 127.0.0.1 - -
[localhost/sid#d5c9af8][rid#d6f4680/initial] pass through /cgi-bin/printenv\n

Obviously this'll be a problem for anyone who is setting environment variables
with names starting with !. Hopefully this is uncommon.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to