When I use this paradigm, everything works:
lxml.etree.fromstring(req.body)
When I use this paradigm, I get timeout errors:
lxml.etree.parse(req.body_file)
It seems to me that the likely source of the bug is in WebOb, perhaps
not returning EOF or some such when sufficient data has been read. Any
ideas?
--
Jon
I have a complete example below.
> Could you be reusing the same body file object twice? For example with
> this setup:
I am definitely not doing that.
Here is a complete example.
It requires a sample xml file, and paste script.
You can create a sample xml file with this:
echo "<empty/>" > t.xml
Yes, one that small is sufficient.
I test with curl, like this:
curl -D - --data-binary @t.xml http://localhost:8080/
When using the cherrypy server (paste.script) it does not work.
When using paste.httpserver it does.
#! /usr/bin/python
import webob
import lxml.etree as etree
from paste.httpserver import serve
from paste.script import wsgiserver
def handle(environ, start_response):
req = webob.Request(environ)
root = etree.parse(req.body_file)
res = webob.Response()
res.body = "looks good"
return res(environ, start_response)
#serve(handle)
server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 8080), handle)
server.start()
--
Jon