Bug 24155 - URLs containing a ? are assumed to be query strings
Summary: URLs containing a ? are assumed to be query strings
Status: RESOLVED WONTFIX
Alias: None
Product: Apache httpd-1.3
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 1.3.27
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL: http://bugs.debian.org/cgi-bin/bugrep...
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-27 17:20 UTC by Matthew Wilcox
Modified: 2007-08-02 16:33 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Wilcox 2003-10-27 17:20:50 UTC
It's legitimate for Unix filenames to contain a literal "?".
The original submitter of this bug has a patch to add a configuration
option to not split on a "?".  Could you consider the patch in the
URL for application?
Comment 1 André Malo 2003-10-27 17:25:57 UTC
Thom May and /me talked about this one a while ago on IRC and came to the
conclusion that there's no issue to fix. One can easily use %3F in conclusion
with NE option to treat the question mark as part of the name. That is what NE
is intended for -- and how URIs *have to* be written.
Comment 2 Matthew Wilcox 2003-10-27 19:05:30 UTC
Hi Andre.  I received feedback from this user suggesting that your
conclusion is incorrect.  Here is the mail he sent me:

From: Jade Nicoletti <nicoletti@nns.ch>

Hi Matthew

It is _not_ possible to use NE and %3F, at least not if I don't want to
do a redirect. In the mod_rewrite reference manual, there's an example:
        RewriteRule /foo/(.*) /bar?arg=P1\%3d$1 [R,NE]
This produces a redirect, which leads to a new request, where the new uri
is parsed again by apache (core probably, not mod_rewrite) and the %3F
is translated to a '?'. But that is not what I am looking for. I don't
want a redirect, I don't want a second request to be made.

I have something like the following:

AddEncoding gzip .gz
RewriteEngine On
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule ^/static/(.+).html$ /static/$1.html.gz [L,nosplit]

Where $1 does contain a "%3F", like in
        http://olwm2003.ch/static/page.php%3Fid=30&lang=en.html

I've tried very hard to get a configuration for this without the patch.
I've carefully studied the manual and the guide. I've read the source.
But I really cound't get it set up without "nosplit". The subject is
somewhat complex, but i am very sure that it's not possible without
the patch. If I'm wrong, please explain me how it is done the right way.

Thank you

Jade Nicoletti

PS: mod_gzip is slow like a dog. mod_rewrite flies. That's why I'm
        using it and not mod_gzip.
Comment 3 André Malo 2003-10-28 07:25:01 UTC
> RewriteRule /foo/(.*) /bar?arg=P1\%3d$1 [R,NE]

Sure it produces a new redirect. Because of the [R] option. What happens without it?
Comment 4 Matthew Wilcox 2003-10-28 17:48:59 UTC
Submitter got back to me with some more information:

My working config (using phaethon.ch/static/ for testing purposes):

AddEncoding gzip .gz
RewriteEngine On
RewriteLog "/tmp/rewrite.log"
RewriteLogLevel 3
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule ^/static/(.+).html$ /static/$1.html.gz [L,nosplit]

gives:

[phaethon.ch/sid#817517c][rid#818e454/initial] (2) init rewrite engine with
requested uri /static/page.php?id=3.html
[phaethon.ch/sid#817517c][rid#818e454/initial] (3) applying pattern
'^/static/(.+).html$' to uri '/static/page.php?id=3.html'
[phaethon.ch/sid#817517c][rid#818e454/initial] (2) rewrite
/static/page.php?id=3.html -> /static/page.php?id=3.html.gz
[phaethon.ch/sid#817517c][rid#818e454/initial] (2) local path result:
/static/page.php?id=3.html.gz
[phaethon.ch/sid#817517c][rid#818e454/initial] (2) prefixed with document_root
to /home/project/web-site/phaethon/web-files/static/page.php?id=3.html.gz
[phaethon.ch/sid#817517c][rid#818e454/initial] (1) go-ahead with
/home/project/web-site/phaethon/web-files/static/page.php?id=3.html.gz [OK]


your suggested config:
RewriteRule ^/static/(.+).html$ /static/$1.html.gz [L,NE]

gives (the nonworking result):

[phaethon.ch/sid#81aae9c][rid#8187ec4/initial] (2) init rewrite engine with
requested uri /static/page.php?id=4.html
[phaethon.ch/sid#81aae9c][rid#8187ec4/initial] (3) applying pattern
'^/static/(.+).html$' to uri '/static/page.php?id=4.html'
[phaethon.ch/sid#81aae9c][rid#8187ec4/initial] (2) rewrite
/static/page.php?id=4.html -> /static/page.php?id=4.html.gz
[phaethon.ch/sid#81aae9c][rid#8187ec4/initial] (3) split
uri=/static/page.php?id=4.html.gz -> uri=/static/page.php, args=id=4.html.gz
[phaethon.ch/sid#81aae9c][rid#8187ec4/initial] (2) local path result:
/static/page.php
[phaethon.ch/sid#81aae9c][rid#8187ec4/initial] (2) prefixed with document_root
to /home/project/web-site/phaethon/web-files/static/page.php
[phaethon.ch/sid#81aae9c][rid#8187ec4/initial] (1) go-ahead with
/home/project/web-site/phaethon/web-files/static/page.php [OK]


or did you mean (which works neither):
RewriteRule ^/static/(.+)\?(.+).html$ /static/$1\%3F$2.html.gz [L,NE]

gives:

[phaethon.ch/sid#81ff69c][rid#816dd24/initial] (2) init rewrite engine with
requested uri /static/page.php?id=8.html
[phaethon.ch/sid#81ff69c][rid#816dd24/initial] (3) applying pattern
'^/static/(.+)\?(.+).html$' to uri '/static/page.php?id=8.html'
[phaethon.ch/sid#81ff69c][rid#816dd24/initial] (2) rewrite
/static/page.php?id=8.html -> /static/page.php%3Fid=8.html.gz
[phaethon.ch/sid#81ff69c][rid#816dd24/initial] (2) local path result:
/static/page.php%3Fid=8.html.gz
[phaethon.ch/sid#81ff69c][rid#816dd24/initial] (2) prefixed with document_root
to /home/project/web-site/phaethon/web-files/static/page.php%3Fid=8.html.gz
[phaethon.ch/sid#81ff69c][rid#816dd24/initial] (1) go-ahead with
/home/project/web-site/phaethon/web-files/static/page.php%3Fid=8.html.gz [OK]
Comment 5 André Malo 2003-10-28 18:02:45 UTC
Ok, I'm conviced. It's on my todo. Thanks for your patience with me :)
Comment 6 Matthew Wilcox 2007-08-02 12:57:11 UTC
Has Andre Malo disappeared?  The last comment on this bug indicates he accepts
this to be a legitimate bug and is working on it.  Is this fixed in Apache 2.2?
Some form of reason would be helpful, so I can close the Debian bug gracefully.
Comment 7 Joshua Slive 2007-08-02 16:33:40 UTC
Please don't add other peoples' addresses to the cc list.

This is a minor bug in an obsolete version, so there is no developer time to fix
it. If it still exists in 2.2, feel free to refile (or reopen and change the
version). You can pass that exact message downstream if you wish.

Sorry, but our limited developer resources are much better spent working on bugs
known to exist in current versions.