On Jan 30, 2017, at 18:16, Kevin Mcintyre <kebin70@gmail.com> wrote:Dealing with older apache, ruby, passenger setup. Hoping to mimic behavior and show OPS that chunked encoding isn't working correctly.With python requests (http://docs.python-requests.org/en/master/) all POST calls work correctly, but twisted requests are failing.I'm thinking (and hoping) it's failing because twisted is chunking the post body. When I send the requests to a twisted endpoint like below the requests are successful and the response is identical.from twisted.web import server, resource
from twisted.internet import reactor
class Simple(resource.Resource):
isLeaf = True
def render_POST(self, request):
print request.content.getvalue()
return request.content.getvalue()
site = server.Site(Simple())
reactor.listenTCP(8080, site)
reactor.run()_______________________________________________On Mon, Jan 30, 2017 at 2:39 PM, Glyph Lefkowitz <glyph@twistedmatrix.com> wrote:On Jan 30, 2017, at 13:47, Kevin Mcintyre <kebin70@gmail.com> wrote:hey all - quick question. Trying to understand FileBodyProducer as it pertains to POST.json_body = FileBodyProducer(StringIO(json.dumps({'key': 'value'}))) agent.request("POST", ~uri, Headers({'User-Agent': ['AkamaiTest']}), json_body)Does the agent chunk the POST body?Maybe!Is this controllable?Not really. The current implementation will certainly use chunked encoding sometimes, but there isn't a strong API guarantee of this anywhere.Any insight appreciated!You probably don't want to try to control this. I believe that proxies are within their rights to mess around with chunk boundaries and re-buffer things, so you don't have any strong guarantees that chunk sizes will be preserved.Why is it that you want to control chunking in the first place?-glyph
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted- python
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python