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

urllib.py: AttributeError on BadStatusLine #42892

Closed
kxroberto mannequin opened this issue Feb 11, 2006 · 4 comments
Closed

urllib.py: AttributeError on BadStatusLine #42892

kxroberto mannequin opened this issue Feb 11, 2006 · 4 comments

Comments

@kxroberto
Copy link
Mannequin

kxroberto mannequin commented Feb 11, 2006

BPO 1429783
Nosy @birkenfeld

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 2007-03-14.08:29:28.000>
created_at = <Date 2006-02-11.18:15:44.000>
labels = []
title = 'urllib.py: AttributeError on BadStatusLine'
updated_at = <Date 2007-03-14.08:29:28.000>
user = 'https://bugs.python.org/kxroberto'

bugs.python.org fields:

activity = <Date 2007-03-14.08:29:28.000>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['None']
creation = <Date 2006-02-11.18:15:44.000>
creator = 'kxroberto'
dependencies = []
files = []
hgrepos = []
issue_num = 1429783
keywords = []
message_count = 4.0
messages = ['27494', '27495', '27496', '27497']
nosy_count = 3.0
nosy_names = ['nnorwitz', 'georg.brandl', 'kxroberto']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1429783'
versions = []

@kxroberto
Copy link
Mannequin Author

kxroberto mannequin commented Feb 11, 2006

PythonWin 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC
v.1200 32 bit (Intel)] on win32.

in httplib errcode -1 &
file=self._conn.sock.makefile('rb', 0) is returned on
Badstatusline:

        except BadStatusLine, e:
            ### hmm. if getresponse() ever closes the
socket on a bad request,
            ### then we are going to have problems with
self.sock
        \### should we keep this behavior? do people

use it?
# keep the socket open (as a file), and
return it
self.file = self._conn.sock.makefile('rb', 0)

        \# close our socket -- we want to restart

after any protocol error
self.close()

            self.headers = None
            return -1, e.line, None



fp = h.getfile()

delivers None in urllib.URLopener.open_http

and this is traceback leading to an AttributeError

Traceback (most recent call last):

File "<interactive input>", line 1, in ?
File "C:\Python23\lib\urllib.py", line 181, in open
return getattr(self, name)(url)
File "C:\Python23\lib\urllib.py", line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
File "C:\Python23\lib\urllib.py", line 319, in http_error
result = method(url, fp, errcode, errmsg, headers)
File "C:\Python23\lib\urllib.py", line 584, in
http_error_301
return self.http_error_302(url, fp, errcode,
errmsg, headers, data)
File "C:\Python23\lib\urllib.py", line 565, in
http_error_302
data)
File "C:\Python23\lib\urllib.py", line 580, in
redirect_internal
return self.open(newurl)
File "C:\Python23\lib\urllib.py", line 181, in open
return getattr(self, name)(url)
File "C:\Python23\lib\urllib.py", line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
File "C:\Python23\lib\urllib.py", line 323, in http_error
return self.http_error_default(url, fp, errcode,
errmsg, headers)
File "C:\Python23\lib\urllib.py", line 327, in
http_error_default
void = fp.read()
AttributeError: 'NoneType' object has no attribute 'read'

As I get this error rarely I cannot reproduce exactly how

self._conn.sock.makefile('rb', 0)

delivers None in that case.

@kxroberto kxroberto mannequin closed this as completed Feb 11, 2006
@kxroberto kxroberto mannequin closed this as completed Feb 11, 2006
@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Feb 12, 2006

Logged In: YES
user_id=33168

This may be a duplicate of a bug submitted by Bram Cohen.
It was a couple of years ago and I don't remember any other
details.

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Feb 12, 2006

Logged In: YES
user_id=33168

I should add that the other bug is still open.

@birkenfeld
Copy link
Member

Fixed that bug finally in rev. 54376, 54377 (2.5).

@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
None yet
Projects
None yet
Development

No branches or pull requests

1 participant