[Python-Dev] http.client: Determining Content-Length

Demian Brecht demianbrecht at gmail.com
Tue Mar 31 18:55:32 CEST 2015


Hi all,

I'm not sure whether this should be python-list or here, but given it's a premature code review for http.client, I figured I'd post here first.

I'm in the process of adding support for chunked transfer encoding to http.client (issue #12319). One of the bits of functionality that I'm working on in is ironing out some of the kinks out in determining the content length of the request bodies. Given the number of data types allowed as bodies it does get a little messy, so I wanted to get some feedback here and see if anyone can shoot holes through it prior to updating the current patch. The tests are passing, but there may be use cases not accounted for in the new implementation.

https://gist.github.com/demianbrecht/f94be5a51e32bb9c81e1

The above is intended to replace _set_content_length (current state of the patch can be seen here: http://bugs.python.org/review/12319/diff/14331/Lib/http/client.py). There is a comprehensive list of data types currently supported can be found here: http://bugs.python.org/issue23740. Comments and feedback are much appreciated.

Thanks,
Demian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150331/b6ebe22e/attachment.sig>


More information about the Python-Dev mailing list