[2.7] bpo-3243: Support iterable bodies in httplib by tzickel · Pull Request #10226 · python/cpython (original) (raw)
I know this is kinda late to the party, but this is not a new functionality API-wise, but a feature parity is required to make HTTP libraries such as requests (and others), be able to send data efficiently.
requests for example uses this piece of code to send the POST data over the HTTP socket if the connection is not chunked. But if the POST data is an iterable object (for example, you want to send the data natively how you stored it, and not split it of read it in 8192 or block chunks), Python 3 works just fine, but Python 2 borks on the sendall(iterable), this fixes this issue...