Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33986

Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive
Date 2012-11-27 18:24 -0500
References <50a12949$0$6566$9b4e6d93@newsspool3.arcor-online.net> <k7rq3f$d6e$1@ger.gmane.org> <k7s9h3$7tg$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.324.1354058687.29569.python-list@python.org> (permalink)

Show all headers | View raw


On 11/12/2012 8:58 PM, Terry Reedy wrote:
> On 11/12/2012 4:35 PM, Terry Reedy wrote:
>
>> import urllib.request
>> opener = urllib.request.build_opener()
>> request = urllib.request.Request("http://example.com/", headers =
>>          {"Content-Type": "application/x-www-form-urlencoded"})
>>
>> opener.open(request, "1".encode("us-ascii"))
>> print(request.data, '\n', request.header_items())
>>
>> opener.open(request, "123456789".encode("us-ascii"))
>> print(request.data, '\n', request.header_items())
>>
>> exhibits the same behavior in 3.3.0 of printing ('Content-length', '1')
>> in the last output. I agree that that looks wrong, but I do not know if
>> such re-use is supposed to be supported.
>
> I opened http://bugs.python.org/issue16464

A patch has been written by Alexey Kachayev and pushed by Andrew Svetlov 
and the behavior will change in 3.4.0 to allow reuse.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive Johannes Kleese <j.kleese@arcor.de> - 2012-11-12 16:52 +0100
  Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive Terry Reedy <tjreedy@udel.edu> - 2012-11-12 16:35 -0500
    Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive Johannes Kleese <j.kleese@arcor.de> - 2012-11-13 08:24 +0100
  Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive Terry Reedy <tjreedy@udel.edu> - 2012-11-12 20:58 -0500
  Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive Terry Reedy <tjreedy@udel.edu> - 2012-11-27 18:24 -0500

csiph-web