This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: repr of httplib.IncompleteRead is stupid
Type: resource usage Stage: commit review
Components: Library (Lib) Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: benjamin.peterson, cjw296, loewis, skip.montanaro
Priority: normal Keywords: patch

Created on 2008-11-12 16:41 by cjw296, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
incompleteread.patch cjw296, 2008-11-13 07:19
Messages (10)
msg75789 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2008-11-12 16:41
The repr of httplib.IncompleteRead contains all the data in the read so far.

This is stupid. Consider the download of a 100Mb file which fails after
30Mb. You end up with 90Mb of text in the log entry logged with the
python logging framework 
(eg: logger.error('Something bad happened',exc_info=True) )
msg75796 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-12 21:20
Would you like to work on a patch?
msg75814 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2008-11-13 07:19
Please find attached a patch against the trunk.
I'd really appreciate it if this could get merged to the 2.5 and 2.6
branches too, in case of a future release there.
msg83023 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2009-03-02 16:34
Can't be applied to 2.5 at this point.  I agree it's dumb to
report the entire partial read and that reporting just the
number of bytes read is a much better solution.  Your patch
looks fine to me as well, except you call resp.close() twice
in test_incomplete_read().  Assigning to Benjamin for
application.  (He's going to get the merge stuff right. I
almost certainly will not.)
msg83024 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2009-03-02 16:54
Why can't it be applied to 2.5?

No problem with the 2nd resp.close() being removed...
msg83026 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-03-02 17:53
The Python 2.5 branch is closed for bug fixes; no further bug fix
releases of Python 2.5 will be made. Only security fixes can be accepted
on the 2.5 branch.
msg83030 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2009-03-02 18:34
Chris> Why can't it be applied to 2.5?

Benjamin can correct me if I'm wrong, but I thought the last 2.5 release was
the last full release planned.  Certainly if another full 2.5 release is in
the cards then the patch should go there as well.

Skip
msg83031 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2009-03-02 18:37
Martin> The Python 2.5 branch is closed for bug fixes; no further bug
    Martin> fix releases of Python 2.5 will be made. Only security fixes can
    Martin> be accepted on the 2.5 branch.

So all Chris has to do to get this applied to 2.5 is craft an exploit based
on the current behavior, right? ;-)

S
msg83034 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-03-02 19:53
> So all Chris has to do to get this applied to 2.5 is craft an exploit based
> on the current behavior, right? ;-)

Right :-) Of course, security patches should see a much more careful
review than regular bug fixes.
msg83043 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-03-02 22:42
Applied with a few tweaks in r70107.
History
Date User Action Args
2022-04-11 14:56:41adminsetgithub: 48558
2009-03-02 22:42:00benjamin.petersonsetstatus: open -> closed
resolution: accepted
messages: + msg83043
2009-03-02 19:53:52loewissetmessages: + msg83034
2009-03-02 18:37:08skip.montanarosetmessages: + msg83031
2009-03-02 18:34:44skip.montanarosetmessages: + msg83030
2009-03-02 17:53:12loewissetnosy: + loewis
messages: + msg83026
2009-03-02 16:54:43cjw296setmessages: + msg83024
2009-03-02 16:36:17skip.montanarosetstage: needs patch -> commit review
2009-03-02 16:34:55skip.montanarosetassignee: benjamin.peterson
messages: + msg83023
nosy: + skip.montanaro
versions: + Python 3.0, - Python 2.5
2008-11-13 07:19:27cjw296setfiles: + incompleteread.patch
keywords: + patch
messages: + msg75814
versions: + Python 2.6, Python 2.5
2008-11-12 21:20:46benjamin.petersonsetpriority: normal
nosy: + benjamin.peterson
stage: needs patch
messages: + msg75796
versions: + Python 3.1, Python 2.7, - Python 2.5, Python 2.5.3
2008-11-12 16:41:13cjw296create