Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib2 (and urllib) should raise error for incomplete response #51694

Closed
gotgenes mannequin opened this issue Dec 5, 2009 · 3 comments
Closed

urllib2 (and urllib) should raise error for incomplete response #51694

gotgenes mannequin opened this issue Dec 5, 2009 · 3 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@gotgenes
Copy link
Mannequin

gotgenes mannequin commented Dec 5, 2009

BPO 7445
Nosy @orsenthil

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-12-15.13:36:37.204>
created_at = <Date 2009-12-05.16:58:43.465>
labels = ['type-bug', 'library']
title = 'urllib2 (and urllib) should raise error for incomplete response'
updated_at = <Date 2009-12-15.13:36:37.202>
user = 'https://bugs.python.org/gotgenes'

bugs.python.org fields:

activity = <Date 2009-12-15.13:36:37.202>
actor = 'orsenthil'
assignee = 'none'
closed = True
closed_date = <Date 2009-12-15.13:36:37.204>
closer = 'orsenthil'
components = ['Library (Lib)']
creation = <Date 2009-12-05.16:58:43.465>
creator = 'gotgenes'
dependencies = []
files = []
hgrepos = []
issue_num = 7445
keywords = []
message_count = 3.0
messages = ['95995', '95997', '96438']
nosy_count = 2.0
nosy_names = ['orsenthil', 'gotgenes']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue7445'
versions = []

@gotgenes
Copy link
Mannequin Author

gotgenes mannequin commented Dec 5, 2009

This question is motivated by a question on Stack Overflow:
http://stackoverflow.com/questions/1824069/urllib2-not-retrieving-entire-http-response

In the event the user receives an incomplete response when using urllib2
(and urllib), the library should raise an error to indicate the response
is incomplete. This is a matter of checking if the Content-Length
defined in the header matches the size of the retrieved response. While
this can be done by the user, an exception will help alert the more
unwitting, such as myself, by failing early.

@gotgenes gotgenes mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Dec 5, 2009
@orsenthil
Copy link
Member

urllib and urllib2, by definition, returns a file-like object which
provides a variety of facilities, most common one being a reading the
object to get the content.

What you are asking for is, to read the content, verify if it matches
the Content-Length header, and raise an exception, if the there is a
mis-match. This facility may not be good idea to implement in library,
while it can be (and should be) taken care by the client which is
using the obj.

I am -1 on this request and would like to close this as 'wont-fix'.

@orsenthil
Copy link
Member

This is working as designed.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant