Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'supported.': 0.09; 'terry': 0.09; 'wrong,': 0.09; 'subject:not': 0.11; 'pushed': 0.13; '4:35': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:case': 0.16; 'url:example': 0.16; 'wrote:': 0.17; 'headers': 0.17; 'jan': 0.18; 'skip:" 30': 0.20; 'written': 0.20; 'import': 0.21; 'supposed': 0.21; 'patch': 0.24; 'url:bugs': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'looks': 0.26; 'skip:" 20': 0.26; 'andrew': 0.27; 'header:X-Complaints-To:1': 0.28; 'url:python': 0.32; 'to:addr :python-list': 0.33; 'agree': 0.34; 'pm,': 0.35; 'received:org': 0.36; 'skip:u 20': 0.36; 'but': 0.36; 'url:org': 0.36; 'skip:{ 10': 0.36; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; 'skip:u 10': 0.60; 'behavior': 0.64; 'opener': 0.84; 'received:fios.verizon.net': 0.84; 'subject:updated': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive Date: Tue, 27 Nov 2012 18:24:12 -0500 References: <50a12949$0$6566$9b4e6d93@newsspool3.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1354058687 news.xs4all.nl 6944 [2001:888:2000:d::a6]:45988 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33986 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