[mod_python] query_vars and form_vars

Byron Ellacott bje at apnic.net
Tue Jul 6 16:43:38 EDT 2004


Jorey Bump wrote:
> I don't know what causes this behaviour. Since only a POST request is 
> sent, not a GET, I would expect any arguments in the URL to be ignored 
> and only variables in the message body to be recognized.

The specification makes a distinction between URL encoded arguments (a 
query fragment) and POST data (just plain old data).  The URL arguments 
form part of the resource request, and should be treated as effectively 
the same as a path fragment, that is, only used to specify which 
resource it is the user is requesting.  POST data is misdefined in 
RFC2616 as "a new subordinate of" the requested resource, and corrected 
in http://purl.org/NET/http-errata to be "data processed by" the 
requested resource.

So, in essence, the protocol definition makes a clear distinction 
between the roles of query fragments and POST data, but that distinction 
is lost when dealing with the vast bulk of web programming libraries out 
there, including mod_python's FieldStorage class.  The correct 
(as-per-specification) behaviour would be to distinguish between query 
arguments and POST data values.

It is quite easy to argue that long convention makes the specification's 
differentiation irrelevant, however.  But in neither world should part 
of the URL be /ignored/. :)

-- 
bje


More information about the Mod_python mailing list