Author demian.brecht
Recipients demian.brecht, martin.panter, orsenthil
Date 2015-01-31.00:45:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <54CC2593.3040508@gmail.com>
In-reply-to <1422597080.87.0.0588867536102.issue23350@psf.upfronthosting.co.za>
Content
On 2015-01-29 9:51 PM, Martin Panter wrote:
> The documentation currently says “Content-Length header should be explicitly provided when the body is an iterable”. See Lib/urllib/request.py:1133 for how it is done for urlopen(), using memoryview(), which is probabaly more correct.

Sure, entirely disabling computing the content length if the body is an
iterable is one way to address it, but I'm not convinced that it's
better. If the ability is there to compute the content length, why not
do so?

The current implementation /should/ be correct whether elements are
bytes or strings (the default encoding doesn't allow for multi-byte
chars, so len(raw_string) should equal len(encoded_string)) when encoded
using the new block of encoding code I added in the patch.

Is there something that I'm missing? I could possibly see an argument
for performance as you're iterating over each element in the list, but
that would be entirely circumvented if the user defines the content
length up front.
History
Date User Action Args
2015-01-31 00:45:11demian.brechtsetrecipients: + demian.brecht, orsenthil, martin.panter
2015-01-31 00:45:11demian.brechtlinkissue23350 messages
2015-01-31 00:45:11demian.brechtcreate