[issue16464] urllib.request: opener not resetting content-length

2014-03-19 Thread STINNER Victor

STINNER Victor added the comment:

changeset:   89857:ad0c75b7bd7d
tag: tip
parent:  89855:9120196b3114
parent:  89856:68335b8afb1f
user:Victor Stinner 
date:Wed Mar 19 17:34:12 2014 +0100
description:
(Merge 3.4) Skip test_urllib2.test_issue16464() is the ssl module is missing


changeset:   89856:68335b8afb1f
branch:  3.4
parent:  89852:c44258b4b7a4
user:Victor Stinner 
date:Wed Mar 19 17:31:20 2014 +0100
files:   Lib/test/test_urllib2.py
description:
Skip test_urllib2.test_issue16464() is the ssl module is missing

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2014-03-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e6d862886e5c by R David Murray in branch 'default':
whatsnew: urllib Request objects are now reusable.
http://hg.python.org/cpython/rev/e6d862886e5c

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2013-03-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b1579eb4e1bc by R David Murray in branch 'default':
#17485: Delete the Content-Length header if the data attribute is deleted.
http://hg.python.org/cpython/rev/b1579eb4e1bc

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2012-11-27 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
assignee:  -> asvetlov
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2012-11-27 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Pushed.
Thanks, Alexey.

--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2012-11-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 618ea5612e83 by Andrew Svetlov in branch 'default':
Issue #16464: reset Request's Content-Length header on .data change.
http://hg.python.org/cpython/rev/618ea5612e83

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2012-11-22 Thread Alexey Kachayev

Alexey Kachayev added the comment:

Fixed patch is attached.
Documentation is updated.

--
Added file: http://bugs.python.org/file28074/issue16464_fixed.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2012-11-22 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Perhaps it's a bit new behavior and should be applied to 3.4 only.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2012-11-22 Thread Andrew Svetlov

Andrew Svetlov added the comment:

I'm agree with solution, see my comments in review for the patch.

--
nosy: +asvetlov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2012-11-17 Thread Alexey Kachayev

Alexey Kachayev added the comment:

This is special case for more "general" problem. When request is executed with 
HTTP client and data is not None, it calculates content length and adds special 
header to request. Then one can change request.data attribute value, but header 
"Content-length" is not changed in this case.

Patch is attached.

I implemented request.data as property and added method "remove_header" to deal 
problem. Test cases are also provided.

--
keywords: +patch
nosy: +kachayev
Added file: http://bugs.python.org/file28015/issue16464.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16464] urllib.request: opener not resetting content-length

2012-11-12 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Code based on python-list post by a do-not-wish-to-register urllib user.

import urllib.request
opener = urllib.request.build_opener()
request = urllib.request.Request("http://example.com/";, headers =
{"Content-Type": "application/x-www-form-urlencoded"})
print(request.data, '\n', request.header_items())

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())
>>> 
None 
 [('Content-type', 'application/x-www-form-urlencoded')]
b'1' 
 [('Content-length', '1'), ('Host', 'example.com'), ('User-agent', 
'Python-urllib/3.3'), ('Content-type', 'application/x-www-form-urlencoded')]
b'123456789' 
 [('Content-length', '1'), ('Host', 'example.com'), ('User-agent', 
'Python-urllib/3.3'), ('Content-type', 'application/x-www-form-urlencoded')]

The first opener.open adds data and several headers to request, including 
content-length. The second changes the data but not the content-length. The 
docs do not say anything about this either way.

--
messages: 175485
nosy: orsenthil, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: urllib.request: opener not resetting content-length
type: behavior
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com