durusmail: quixote-users: Re: query string handling
Call for applications
2002-08-30
2002-08-30
2002-09-04
2002-09-04
2002-09-04
2002-09-05
2002-09-04
2002-09-04
2002-09-04
2002-09-04
2002-09-04
2002-09-04
2002-09-04
Adding access control code (was Re: Call for applications)
2002-09-04
Re: query string handling
2002-09-04
Re: query string handling
Andrew Kuchling
2002-09-04
On Wed, Sep 04, 2002 at 09:20:16AM -0600, Jonathan Corbet wrote:
>> I'm aware of one minor issue: HTTPRequest doesn't parse form values in
>> the query string.
>I'm confused - are you thinking of something in addition to
>request.get_form_var()?  In the few cases where I've still wanted to use
>query strings (usually "display N news items starting at OFFSET"),
>get_form_var has been all I've really needed.

Hmmm... I thought I recently noticed that HTTPRequest.process_inputs()
never looks at the query string.  
Ah, OK:

1        if method != 'GET':
2            # Avoid consuming the contents of stdin unless we're sure
3            # there's actually form data.
4            content_type = self.environ.get("CONTENT_TYPE", "").split(";")[0]
5            if content_type not in FORM_CONTENT_TYPES:
6                return
7            fp = self.stdin
8        else:
9            fp = None

If the HTTP method != GET, and Quixote doesn't think it's a form
submission, the code reaches the 'return' in line 6, and therefore
never creates a FieldStorage.  So this affects POST or PUT to a URL
with a FieldStorage.

My fix was to set 'fp=None' and continue instead of returning.  The
purpose was to use 'PUT /data/akuchlin/file?auth-ticket' to change a
file's content.  Maybe that's an abuse of HTTP, and the client should
be doing full cookie handling instead of including an authorization
ticket as the query string.

--amk



reply