Author orsenthil
Recipients hfuru, jerith, orsenthil, vstinner
Date 2010-11-21.08:37:36
SpamBayes Score 7.31908e-11
Marked as misclassified No
Message-id <20101121083727.GA1443@rubuntu>
In-reply-to <>
On Sat, Nov 20, 2010 at 07:09:58PM +0000, Jeremy Thurgood wrote:
> There are two separate things here: the URL and the filesystem path. 
> The bug is that the fragment and query parameters are stripped in
> translate_path(), but are *not* stripped when manipulating the URL
> for the redirect.

Thanks for the explanation. My understanding of the bug (and the
patch) is same as yours.

> This means that when the URL is "/something?foo" and the cwd is

Now, lets stop here for a moment to reflect the meaning of this URL.

Here is the Query string article from Wikipedia:

It gives a generic definition:

    A typical URL containing a query string is as follows:


    When a server receives a request for such a page, it runs a
    program (if configured to do so), passing the query_string
    unchanged to the program. The question mark is used as a separator
    and is not part of the query string.

Given this, in the URL /something?foo , can 'something' be a directory
in the filesystem? To which program will query string be sent? ( You
can say that a program by name index{.py,cgi,pl) inside the something
directory *can* handle it, but I don't see such a practical scenario
or CGI server configuration)

- Same argument a #fragment_identifier. This is  portion of webpage
  (anchor tag), a file. It cannot start immediately after a
  file-system directory path.

In the http.server code, you will see that 301 redirection part is
entered only when the last part is directory, but in cases where a?q
and a#f, ('a' wont be a directory, so that redirection part is not
entered at all).

Let's come to some real world scenarios.

Now, what happens when you type "" [1] in
your browser? According to this bug report, the server should 301
redirect it to "". If you try this, this
does not happen. The browser (client) is in fact, changing it to the
corrected URL (because the original is invalid) and the server is just
ignoring the so called query portion). 

If you use, urllib2 to request the above [1], you will find that it
will fail with 401 error.

These are the reasons, why I consider this report is not really a bug.
Any suggestions or thoughts on the explanation?

In your attached patch, I think we should still be able to use some
tests without any change in the http.server code.
Date User Action Args
2010-11-21 08:37:38orsenthilsetrecipients: + orsenthil, hfuru, vstinner, jerith
2010-11-21 08:37:37orsenthillinkissue10231 messages
2010-11-21 08:37:36orsenthilcreate