Your message dated Sun, 3 Jul 2016 11:22:15 +0200
with message-id <[email protected]>
and subject line closing bugs reported against ancient python versions
has caused the Debian Bug report #540391,
regarding [urllib2] BadStatusLine exception from httplib not handle
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
540391: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=540391
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python2.5
Version: 2.5.4-1
Severity: normal

Hi,

A bug has been posted against urlwatch:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=529740

It looks like there is a problem in urllib2.

To reproduce it, you can run the following HTTP server

[quote = http_server]
import BaseHTTPServer
class BrokenRequestHandler (BaseHTTPServer.BaseHTTPRequestHandler):
    def do_GET (self):
        self.wfile.write("")
if __name__ == '__main__':
    handler_class=BrokenRequestHandler
    server_address = ('', 80)
    httpd = BaseHTTPServer.HTTPServer(server_address, handler_class)
    httpd.serve_forever()
[/quote]

With this script on the client side:

[quote = client]
req = urllib2.Request("http://192.168.2.2/index.html";,)
try:
    urllib2.urlopen(req)
except (urllib2.URLError), err:
    print err
else:
    print "OK"
[/quote]

We get:

[quote=error]
Traceback (most recent call last):
  File "./bug_529740.py", line 8, in <module>
    urllib2.urlopen(req)
  File "/usr/lib/python2.5/urllib2.py", line 124, in urlopen
    return _opener.open(url, data)
  File "/usr/lib/python2.5/urllib2.py", line 381, in open
    response = self._open(req, data)
  File "/usr/lib/python2.5/urllib2.py", line 399, in _open
    '_open', req)
  File "/usr/lib/python2.5/urllib2.py", line 360, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.5/urllib2.py", line 1107, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.5/urllib2.py", line 1080, in do_open
    r = h.getresponse()
  File "/usr/lib/python2.5/httplib.py", line 928, in getresponse
    response.begin()
  File "/usr/lib/python2.5/httplib.py", line 385, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.5/httplib.py", line 349, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine
[/quote]

If we catch httplib.HTTPException:

 except (urllib2.URLError, httplib.HTTPException), err:

then, it is fine.

I think this error should be caught by urllib2.URLError.
Any thoughts ?

Regards,

-- 
Franck Joncourt
http://debian.org - http://smhteam.info/wiki/

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
This bug has been reported against an ancient version of
python (2.5/3.1), that was last released with Debian 6.0 (squeeze). But
even squeeze-lts has now reached end-of-life and is no longer supported.
The bug is assumed to be fixed (or no longer relevant) in newer python
releases and therefore I'm closing this report now. If the problem is
still reproducible in the currently supported versions (python2.7,
python3.5/python3.6), feel free to provide more information, reopen
and reassign this bug report.


Andreas

--- End Message ---

Reply via email to