| Nicolas Lehuen (JIRA) 2005-04-30, 2:45 am |
| [ http://issues.apache.org/jira/brows...HON-29?page=all ]
Nicolas Lehuen reassigned MODPYTHON-29:
---------------------------------------
Assign To: Nicolas Lehuen
> mod_python.publisher and inbound content_type
> ---------------------------------------------
>
> Key: MODPYTHON-29
> URL: http://issues.apache.org/jira/browse/MODPYTHON-29
> Project: mod_python
> Type: Improvement
> Components: publisher
> Versions: 3.1.4
> Reporter: Graham Dumpleton
> Assignee: Nicolas Lehuen
>
> The mod_python.publisher implementation always decodes form parameters
> regardless of whether the method being called can accept any and also ignores
> whether the content type is even of a type where form parameters can be
> decoded in the first place. This means that it is not possible using the
> mod_python.publisher module to implement a method which accepts POST
> requests with a inbound content type such as "text/xml". Attempting to do
> so yields an error such as:
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>501 Method Not Implemented</title>
> </head><body>
> <h1>Method Not Implemented</h1>
> <p>POST to /xmlrpc/service not supported.<br />
> </p>
> <hr />
> <address>Apache/2.0.51 (Unix) mod_python/3.1.4 Python/2.3 Server at localhost Port 8080</address>
> </body></html>
> The "Method Not Implemented" error in this case is due to FieldStorage
> rejecting the content type of "text/xml".
> A check could be added to ensure that FieldStorage is only used to decode
> form parameters if the content type is appropriate. Ie.,
> if not req.headers_in.has_key("content-type"):
> content_type = "application/x-www-form-urlencoded"
> else:
> content_type = req.headers_in["content-type"]
> if content_type == "application/x-www-form-urlencoded" or \
> content_type[:10] == "multipart/":
> req.form = util.FieldStorage(req,keep_blank_values=1)
> Because req.form is passed to util.apply_fs_data(), code where it is called
> would need to be changed to pass None instead and util.apply_fs_data()
> would need to be modified to see that the argument is None and not do
> the field conversion process of stuff in the form etc etc.
|