[Twisted-Python] web client FileBodyProducer - transfer encoding

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Jan 30 15:39:36 MST 2017


> On Jan 30, 2017, at 13:47, Kevin Mcintyre <kebin70 at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20170130/703c9242/attachment-0002.html>


More information about the Twisted-Python mailing list