Jim Gallacher
jpg at jgassociates.ca
Mon Aug 14 07:07:28 EDT 2006
It's my understanding that PUT is used for uploading binary objects such as files, without creating the MIME message usually associated with POST. FieldStorage really doesn't make sense in that context. I might be wrong though. Jim Nic James Ferrier wrote: > My version of mod_python (Debian package 3.1.3-3) says this in > util.py: > > # always process GET-style parameters > if req.args: > pairs = parse_qsl(req.args, keep_blank_values) > for pair in pairs: > file = cStringIO.StringIO(pair[1]) > self.list.append(Field(pair[0], file, "text/plain", {}, > None, {})) > > if req.method == "POST" or req.method == "PUT": > > try: > clen = int(req.headers_in["content-length"]) > except (KeyError, ValueError): > # absent content-length is not acceptable > raise apache.SERVER_RETURN, apache.HTTP_LENGTH_REQUIRED > > The current version says something similar. > > This is wrong. Or at least restictive. > > I noticed this because I am PUTting the representation of a resource > as application/x-www-form-urlencoded and I wasn't allowed to do that > using FieldStorage. > > Here's a patch: > > --- /usr/lib/python2.3/site-packages/mod_python/util.py~ > +++ /usr/lib/python2.3/site-packages/mod_python/util.py > @@ -96,7 +96,7 @@ > self.list.append(Field(pair[0], file, "text/plain", {}, > None, {})) > > - if req.method == "POST": > + if req.method == "POST" or req.method == "PUT": > > try: > clen = int(req.headers_in["content-length"]) > > >
|