httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Stosberg <m...@summersault.com>
Subject Re: bug? Inconsistent handling of query string
Date Fri, 15 Feb 2013 20:04:26 GMT
On 02/15/2013 01:49 PM, Eric Covener wrote:
> On Fri, Feb 15, 2013 at 12:57 PM, Mark Stosberg <mark@summersault.com> wrote:
>>
>> Thanks for the response, William --
>>
>> On 02/15/2013 11:49 AM, William A. Rowe Jr. wrote:
>>> On Fri, 15 Feb 2013 10:38:40 -0500
>>> Mark Stosberg <mark@summersault.com> wrote:
>>>
>>>>
>>>> I'd like feedback on whether the following behavior is a bug, or
>>>> intentionally inconsistent.
>>>>
>>>> I was looking at the environment variables generated by this case:
>>>>
>>>>    Browser URL: /file%3Fa=b?c=d
> 
>>   # Otherwise, pass everything through to the dispatcher
>>   RewriteRule ^home/project/www/(.*)$ /cgi-bin/dispatch.cgi/$1
>> [last,qsappend]
> 
> Here you'll match the decoded version and copy it into the path as a
> literal ? -- maybe you need [B] here to be safe, or capture
> %{THE_REQUEST} in a condition which has the still-encoded request.

Eric,

You were correct. Here's the result after adding [B] to my RewriteRule:

  'QUERY_STRING' => 'c=d',
  'SCRIPT_URL' => '/file?a=b',
  'SCRIPT_URI' => 'http://www.mark.net.adoptapet.com/file?a=b',
  'REQUEST_URI' => '/file%3Fa=b?c=d',

In summary, all variables look consistent and correct. The bug was on my
end!

Thanks for the feedback,

Unfortunately, this a subtle detail of how rewriting works that is
commonly overlooked.

A quick search on Github shows shows nearly 5,000 projects that use this
pattern, and none of them in the random sampling I looked at had
included [B] in their flags:

https://github.com/search?q=+RewriteCond+%25%7BREQUEST_FILENAME%7D+%21-f++%241&type=Code&ref=searchresults



   Mark




Mime
View raw message