[issue405845] Fix for #405427: raise BadStatusLine

2022-04-10 Thread admin


Change by admin :


--
github: None -> 34057

___
Python tracker 

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



[issue8450] httplib: false BadStatusLine() raised

2018-09-14 Thread miss-islington


miss-islington  added the comment:


New changeset ee78ba2c819b0cd7671a575e584d8fe1b7adb3e4 by Miss Islington (bot) 
(Shoham Peller) in branch '2.7':
[2.7] closes bpo-8450: a better error message when http status line isn't 
received (GH-2825)
https://github.com/python/cpython/commit/ee78ba2c819b0cd7671a575e584d8fe1b7adb3e4


--
nosy: +miss-islington
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue8450] httplib: false BadStatusLine() raised

2017-07-23 Thread Shoham Peller

Changes by Shoham Peller :


--
pull_requests: +2877

___
Python tracker 

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



[issue8450] httplib: false BadStatusLine() raised

2017-05-18 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1748

___
Python tracker 

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



[issue8450] httplib: false BadStatusLine() raised

2017-05-04 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1551

___
Python tracker 

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



[issue8450] httplib: false BadStatusLine() raised

2017-03-12 Thread Martin Panter

Martin Panter added the comment:

I don’t think so. It is best to avoid a new exception type (even a subclass) in 
a bug fix. That would break code which checks “type(exc) == BadStatusLine” or 
similar.

Specific exception messages are supposed to be implementation details, and the 
current message is already quirky due to the change from Issue 7427 (released 
in 2.7a4). That is why I thought it might be reasonable to just change the 
exception message in a bug fix.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8450>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7427] BadStatusLine is hell to debug

2017-03-12 Thread Martin Panter

Martin Panter added the comment:

This change was only made in 2.7a4, not 2.6

--
versions: +Python 2.7 -Python 2.6

___
Python tracker 

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



[issue8450] httplib: false BadStatusLine() raised

2017-03-12 Thread Shoham Peller

Shoham Peller added the comment:

How about back-porting the v3.5 fix, and the new "RemoteDisconnected" 
exception? Is that reasonable?

--
nosy: +Shoham Peller

___
Python tracker 

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



[issue8450] httplib: false BadStatusLine() raised

2016-05-14 Thread Martin Panter

Changes by Martin Panter :


--
stage:  -> needs patch
versions:  -Python 2.6, Python 3.1, Python 3.2

___
Python tracker 

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2015-07-18 Thread Chris Mattmann

Chris Mattmann added the comment:

Hi there, we are experiencing this in tika-python too, see:

https://github.com/chrismattmann/tika-python/issues/44

--
nosy: +chrismattmann

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



[issue8450] httplib: false BadStatusLine() raised

2015-07-18 Thread Martin Panter

Martin Panter added the comment:

Issue 3566 has added a new exception subclass, RemoteDisconnected, in 3.5. 
People are still complaining about the old BadStatusLine exception in Python 2 
though. See Issue 23054.

Python 2 could still get better documentation of the BadStatusLine exception. 
Currently it gives the impression that it only happens when the “strict” 
parameter is True, and a status line was received that was not understood.

The exception message could also be improved. Due to Issue 7427, there is a 
special case to make the message literally two quote signs (''), representing 
an empty string. Perhaps messages like “End of stream signalled”, “No status 
line”, or “Empty status line” would be clearer.

--

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2015-07-18 Thread Martin Panter

Martin Panter added the comment:

There is hopefully a better RemoteDisconnected exception and documentation in 
3.5, thanks to Issue 3566. In Python 2, I think this is the same as Issue 8450.

--
resolution:  - duplicate
status: open - closed
superseder:  - httplib: false BadStatusLine() raised

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



[issue8450] httplib: false BadStatusLine() raised

2015-07-18 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
components: +Documentation

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



[issue8450] httplib: false BadStatusLine() raised

2015-01-15 Thread Demian Brecht

Demian Brecht added the comment:

This should likely be closed as a duplicate of #3566, which has additional 
detail.

--

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



[issue8450] httplib: false BadStatusLine() raised

2015-01-14 Thread Jakub Wilk

Changes by Jakub Wilk jw...@jwilk.net:


--
nosy: +jwilk

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



[issue8450] httplib: false BadStatusLine() raised

2015-01-12 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


--
nosy: +demian.brecht

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2014-12-16 Thread Joe Cabrera

Joe Cabrera added the comment:

This is an error wrapping coming from requests.

https://github.com/kennethreitz/requests/issues/2364

The Requests team has concluded they can do nothing about this error, I believe 
the next step up is the python httplib library.

--

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2014-12-16 Thread R. David Murray

R. David Murray added the comment:

I wonder the actual error reported in that issue has any relationship to issue 
15082?

In any case, the error being presented to requests is *accurate*: httplib tried 
to read the status line and got nothing (the actual text in the linked issue is 
BadStatusLine('')).  (Note that issue 7427 was where we fixed the repr, if 
you are curious).

I see that requests would like a better error message.  Is there a concrete 
suggestion for what that better error message would look like?

--

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2014-12-16 Thread Martin Panter

Martin Panter added the comment:

Not exactly sure what do you want the Python library to do, but perhaps this is 
a duplicate of Issue 8450, about making the error less misleading when the 
connection is closed before _any_ status line is sent. See also Issue 7427.

--
nosy: +vadmium

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2014-12-16 Thread R. David Murray

R. David Murray added the comment:

Ouch.  I assumed the change was made to the repr, not the contents of line (I 
wasn't involved in that fix).  Not that that would actually affect this issue, 
I think, since Requests doesn't want to introspect exception objects.

--

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2014-12-15 Thread Joe Cabrera

New submission from Joe Cabrera:

ConnectionError: ('Connection aborted.', BadStatusLine())

This error can also occur on Linux and Windows, a more descriptive error 
messages would be useful for people trying to debug their code.

--
assignee: docs@python
components: Documentation
messages: 232664
nosy: docs@python, joecabrera
priority: normal
severity: normal
status: open
title: ConnectionError: ('Connection aborted.', BadStatusLine())
type: behavior
versions: Python 2.7

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2014-12-15 Thread R. David Murray

R. David Murray added the comment:

I think you made a mistake in your copy and paste or retyping of that line, 
since it is not valid python syntax.

What is not explicit about it?  It is telling you there was a bad status line, 
and what the bad status line contents was.  (Used to be you couldn't tell, when 
the badness of the status line was that it was empty, that that was what the 
error message was saying, but I'm pretty sure we fixed that so that it shows an 
empty status line as an empty string in the message).

--
nosy: +r.david.murray

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



[issue23054] ConnectionError: ('Connection aborted.', BadStatusLine(''''))

2014-12-15 Thread R. David Murray

R. David Murray added the comment:

Perhaps part of your problem is that you are not getting the string 
representation of the error message.  Is that because of your code, or is this 
representation something the stdlib is generating?

--

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



[issue7427] BadStatusLine is hell to debug

2014-11-19 Thread Martin Panter

Martin Panter added the comment:

As far as I can tell, the “line” attribute isn’t documented anyway. But Issue 
8450 is opened about improving the exception when the connection is closed.

--
nosy: +vadmium

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



[issue8450] httplib: false BadStatusLine() raised

2014-11-19 Thread Martin Panter

Martin Panter added the comment:

See also Issue 3566, which also brings up the false BadStatusLine exception, 
and suggests some kind of retry logic.

Whatever exception it is, it could be documented better. In Issue 66621, the 
poster thought it should be an IncompleteRead exception.

--
nosy: +vadmium

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



[issue8450] httplib: false BadStatusLine() raised

2014-11-19 Thread Martin Panter

Martin Panter added the comment:

Sorry the IncompleteRead reference was meant to be Issue 666219

--

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



[issue8450] httplib: false BadStatusLine() raised

2013-03-05 Thread karl

karl added the comment:

Hmm no code.
I wonder if it's about this part.
http://hg.python.org/cpython/file/3.3/Lib/http/client.py#l321

--
nosy: +karlcow

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



[issue7427] BadStatusLine is hell to debug

2012-09-25 Thread Andrew Swan

Andrew Swan added the comment:

I just got tripped up by this change, I wanted to catch the specific case of an 
http server closing a connection and assumed that the following would work:

try:
  resp = conn.getresponse()
except httplib.BadStatusLine, e:
  if len(e.line) == 0:
# server closed...
  else:
raise

That doesn't work since e.line holds the representation of the empty string 
instead of just holding the empty string.  I think the fragment above would be 
a much better way to write this test, the current alterntative of:
  if e.line == '':
is hopelessly obscure.

Seems like the original fix should have been to add __repr__ to BadStatusLine 
rather than changing its contents.  Can this be revisited?

--
nosy: +aswan

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



urllib2.urlopen+BadStatusLine+https

2011-05-12 Thread up2date.cyborg

Hi,
I am new to this list, I don't really know if I should post here my request.
Anyway.

The following code is raising httplib.BadStatusLine on urllib2.urlopen(url)

url = 
'https://stat.netaffiliation.com/requete.php?login=xxxmdp=yyydebut=2011-05-01fin=2011-05-12'

response = urllib2.urlopen(url)
content = response.read()
response.close()

if the url is http, it doesn't fail, if it's https://www.gmail.com, it 
doesn't fail neither!

someone could help me to make it work.
When going to the url using a browser, there is no error.
The only thing is that the certificate is signed for another domain.

of course, on my real test I replace xxx and yyy, but anyway the error 
is the same with or without the parameters, even 
https://stat.netaffiliation.com raises the exception...


Thanks!
--
http://mail.python.org/mailman/listinfo/python-list


[issue8450] httplib: false BadStatusLine() raised

2011-03-17 Thread Senthil Kumaran

Changes by Senthil Kumaran orsent...@gmail.com:


--
assignee:  - orsenthil

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



[issue8450] httplib: false BadStatusLine() raised

2010-08-03 Thread Dirkjan Ochtman

Changes by Dirkjan Ochtman dirk...@ochtman.nl:


--
nosy: +djc

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



[issue8450] httplib: false BadStatusLine() raised

2010-04-19 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +orsenthil
priority:  - normal
versions: +Python 2.7, Python 3.1, Python 3.2

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



[issue8450] httplib: false BadStatusLine() raised

2010-04-18 Thread mschu

New submission from mschu mschu@gmail.com:

Independent from HTTP strict, an invalid BadStatusLine() exception is raised 
when a keep-alive connection exceeds its timeout:

client-server request
s-c answer
connection timeout passing
s-c: FIN/ACK
c-s: ACK
c-s: get request/FIN
s-c: RST (without data)

which raises the exception.

An easy workaround is to either poll information often enough for the server to 
not close the connection or close and reopen the connection. However, the 
exception is misleading.

--
components: Library (Lib)
messages: 103545
nosy: mschu
severity: normal
status: open
title: httplib: false BadStatusLine() raised
type: behavior
versions: Python 2.6

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



[issue7427] BadStatusLine is hell to debug

2009-12-04 Thread Jake McGuire

Jake McGuire j...@youtube.com added the comment:

I think what's happening is that your connection is being closed due to 
inactivity, so the status line that comes back is empty.  Printing 
repr(line) would probably make the emptiness clear, but maybe the httplib 
code should put in a more specific message in this case...

--
nosy: +jakemcguire

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



[issue7427] BadStatusLine is hell to debug

2009-12-03 Thread djc

New submission from djc dirk...@ochtman.nl:

For whatever reason, BadStatusLine tracebacks often don't show the line
passed into them. Given the errr, heavy architecture of httplib, this
makes it pretty bad to debug. It's not clear to me why this is:

Traceback (most recent call last):
  File /home/djc/src/couchdb-python/couchdb/tests/client.py, line 138,
in test_attachment_crud_with_files
doc = self.db['foo']
  File /home/djc/src/couchdb-python/couchdb/client.py, line 293, in
__getitem__
_, _, data = self.resource.get(id)
  File /home/djc/src/couchdb-python/couchdb/http.py, line 333, in get
return self._request('GET', path, headers=headers, **params)
  File /home/djc/src/couchdb-python/couchdb/http.py, line 350, in _request
credentials=self.credentials)
  File /home/djc/src/couchdb-python/couchdb/http.py, line 179, in request
resp = _try_request()
  File /home/djc/src/couchdb-python/couchdb/http.py, line 167, in
_try_request
return conn.getresponse()
  File /usr/lib/python2.6/httplib.py, line 950, in getresponse
  File /usr/lib/python2.6/httplib.py, line 390, in begin
  File /usr/lib/python2.6/httplib.py, line 354, in _read_status
BadStatusLine

However, some interactive testing shows that this should work:

d...@enrai couchdb-python $ python
Python 2.6.2 (r262:71600, Oct  5 2009, 12:18:48)
[GCC 4.3.2] on linux2
Type help, copyright, credits or license for more information.
 class CrapShoot(Exception):
... def __init__(self, a):
... self.args = a,
...
 raise CrapShoot('a')
Traceback (most recent call last):
  File stdin, line 1, in module
__main__.CrapShoot: a
 class ParentExc(Exception):
... pass
...
 class CrapShoot(ParentExc):
... def __init__(self, a):
... self.args = a,
...
 raise CrapShoot('a')
Traceback (most recent call last):
  File stdin, line 1, in module
__main__.CrapShoot: a


Definition of BadStatusLine:

class BadStatusLine(HTTPException):
def __init__(self, line):
self.args = line,
self.line = line

class HTTPException(Exception):
# Subclasses that define an __init__ must call Exception.__init__
# or define self.args.  Otherwise, str() will fail.
pass

The note here seems like a cautionary but insufficient tale...

--
components: Library (Lib)
messages: 95934
nosy: djc
severity: normal
status: open
title: BadStatusLine is hell to debug
versions: Python 2.6

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



[issue7427] BadStatusLine is hell to debug

2009-12-03 Thread djc

djc dirk...@ochtman.nl added the comment:

Also, it might be useful here if it showed repr(line) instead of just
line, but that'd just be icing on the cake.

--

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



[issue5007] urllib2 HTTPS connection failure (BadStatusLine Exception)

2009-11-22 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

This bug is not reproducible in trunk, py3k and is not reproducible in
py26 releases too. I tried to hunt down if any changes in the code-line
from py2.5 to py2.6 had effect on the behavior mention (BadStatusLine) ,
but don't see any. 

I am closing this as works for me.

--
resolution:  - works for me
status: open - closed

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



[issue5007] urllib2 HTTPS connection failure (BadStatusLine Exception)

2009-08-22 Thread Shashank

Shashank shashank.sunny.si...@gmail.com added the comment:

Works fine for me in 2.6 but fails as said by OP on 2.5.
(I came across this in the course of my work and am submitting a change
in a bug for the first time, pardon me if something is inappropriate :)

I used this modified codeblock:

--
import cookielib
import urllib2

cookiejar = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))
url = 'https://www.orange.sk/'
req = urllib2.Request(url, None)
s=opener.open(req)
print s.read();

---

2.6 gives a complete HTML page but 2.5 raises httplib.BadStatusLine
exception.

--
nosy: +shashank

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



[issue5007] urllib2 HTTPS connection failure (BadStatusLine Exception)

2009-08-22 Thread Senthil

Changes by Senthil orsent...@gmail.com:


--
assignee:  - orsenthil

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



[issue5007] urllib2 HTTPS connection failure (BadStatusLine Exception)

2009-04-22 Thread Daniel Diniz

Daniel Diniz aja...@gmail.com added the comment:

Confirmed in 2.5, cannot confirm on trunk. Needs confirmation on 2.6 and
3.x.

--
keywords: +easy
nosy: +ajaksu2
priority:  - normal
versions: +Python 3.0

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



[issue5007] urllib2 HTTPS connection failure (BadStatusLine Exception)

2009-02-12 Thread Daniel Diniz

Changes by Daniel Diniz aja...@gmail.com:


--
nosy: +jjlee, orsenthil
stage:  - test needed
versions: +Python 2.6 -Python 2.5

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



[issue5007] urllib2 HTTPS connection failure (BadStatusLine Exception)

2009-01-19 Thread ak

New submission from ak akte...@gmail.com:

https://www.orange.sk/ is served by an Oracle HTTPS server, and works
with firefox or opera but not urllib2.

code snippet:


import cookiejar
import urllib2

cookiejar = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))
url = 'https://www.orange.sk/'
req = urllib2.Request(url, None)
s=opener.open(req)
 

Here's some output with debuglevel=1 :

 opener.open(urllib2.Request('http://www.orange.sk/', None, headers))

reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Mon, 19 Jan 2009 21:44:03 GMT
header: Server: Oracle-Application-Server-10g/10.1.3.1.0 Oracle-HTTP-
Server
header: Set-Cookie:
JSESSIONID=0a19055a30d630c427bda71d4e26a37ca604b9f590dc.e3eNaNiRah4Pe3aSch8Sc3yOc40;
path=/web
header: Expires: Mon, 19 Jan 2009 21:44:13 GMT
header: Surrogate-Control: max-age=10
header: Content-Type: text/html; charset=ISO-8859-2
header: X-Cache: MISS from www.orange.sk
header: Connection: close
header: Transfer-Encoding: chunked
addinfourl at 137417292 whose fp = socket._fileobject object at
0x831348c

 opener.open(urllib2.Request('https://www.orange.sk/', None, headers))

reply: ''
Traceback (most recent call last):
  File stdin, line 1, in module
  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 1115, in https_open
return self.do_open(httplib.HTTPSConnection, 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 

As you can see the reply from the server seems empty (which results in
the BadStatusLine exception)

--
components: Library (Lib)
messages: 80224
nosy: ak
severity: normal
status: open
title: urllib2 HTTPS connection failure (BadStatusLine Exception)
type: behavior
versions: Python 2.5

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



Re: BadStatusLine:

2008-09-22 Thread Bruno Desthuilliers

noelob a écrit :

Hi All,

During performance testing of my web application, I occasionally get a
BadStatusLine exception from httplib. Reading
http://docs.python.org/lib/module-httplib.html#l2h-4021 tells me that
it's Raised if a server responds with a HTTP status code that we
don't understand. Is there a way to find what the actual status code
returned was? I.e. the value that caused the exception to be thrown?
Under what circumstances is a BadStatusLine normally thrown? (e.g.
data corruption?)


httplib is a pure-python module, so nothing prevents you from reading 
the source code to get more accurate informations. It appears that this 
exception is raised when:


- the status line is empty
- the 'strict' flag is on and the status line didn't start with 'HTTP/'
- the 'status' part of the status line is not convertible to an int
- the status code ('status' part of the status line, converted to an 
int) is lower than 100 or higher than 999


NB: I may have missed something...

In all cases, the offending status line is accessible as either .line 
and .args attribute of the exception.



I'm quite new to python, but not to programming. Apologies if this is
a silly question ;)


Well... Not a silly question IMHO, but surely one you could have solved 
by yourself. It only requires two commands on an average posix system:

- cd /your/python/install/lib/
- grep -A5 -B5 BadStatusLine httplib.py

HTH
--
http://mail.python.org/mailman/listinfo/python-list


Re: BadStatusLine:

2008-09-22 Thread Diez B. Roggisch
noelob wrote:

 Hi All,
 
 During performance testing of my web application, I occasionally get a
 BadStatusLine exception from httplib. Reading
 http://docs.python.org/lib/module-httplib.html#l2h-4021 tells me that
 it's Raised if a server responds with a HTTP status code that we
 don't understand. Is there a way to find what the actual status code
 returned was? I.e. the value that caused the exception to be thrown?
 Under what circumstances is a BadStatusLine normally thrown? (e.g.
 data corruption?)
 
 I'm quite new to python, but not to programming. Apologies if this is
 a silly question ;)

Bruno gave some advice already. I can only add that for the general task of
inspecting HTTP-traffic, tools such as axis-tcpmon or wireshark are useful.
There you can see what happens on the protocol level.

Diez
--
http://mail.python.org/mailman/listinfo/python-list


Re: BadStatusLine error

2008-05-29 Thread Jim
On May 28, 11:24 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:
 Jim wrote:
  Hi

  I get a BadStatusLine error (indicated below). Can anyone help with
  how to
  catch error in code before abort?

 http://docs.python.org/tut/node10.html

 Diez

Thanks Diez docs help. Jim

--
http://mail.python.org/mailman/listinfo/python-list


BadStatusLine error

2008-05-28 Thread Jim
Hi

I get a BadStatusLine error (indicated below). Can anyone help with
how to
catch error in code before abort?

Thanks
Jim

Traceback (most recent call last):

  File
C:\Python25\Lib\site-packages\pythonwin\pywin\framework
\scriptutils.py,
line 310, in RunScript
exec codeObject in __main__.__dict__
  File C:Lookup.py, line 103, in module
contents = urllib2.urlopen(url).read()
  File C:\Python25\lib\urllib2.py, line 121, in urlopen
return _opener.open(url, data)
  File C:\Python25\lib\urllib2.py, line 374, in open
response = self._open(req, data)
  File C:\Python25\lib\urllib2.py, line 392, in _open
'_open', req)
  File C:\Python25\lib\urllib2.py, line 353, in _call_chain
result = func(*args)
  File C:\Python25\lib\urllib2.py, line 1100, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File C:\Python25\lib\urllib2.py, line 1073, in do_open
r = h.getresponse()
  File C:\Python25\lib\httplib.py, line 924, in getresponse
response.begin()
  File C:\Python25\lib\httplib.py, line 385, in begin
version, status, reason = self._read_status()
  File C:\Python25\lib\httplib.py, line 349, in _read_status
raise BadStatusLine(line)
BadStatusLine

--
http://mail.python.org/mailman/listinfo/python-list


Re: BadStatusLine error

2008-05-28 Thread Diez B. Roggisch
Jim wrote:

 Hi
 
 I get a BadStatusLine error (indicated below). Can anyone help with
 how to
 catch error in code before abort?

http://docs.python.org/tut/node10.html

Diez
--
http://mail.python.org/mailman/listinfo/python-list


[ python-Bugs-1429783 ] urllib.py: AttributeError on BadStatusLine

2007-03-14 Thread SourceForge.net
Bugs item #1429783, was opened at 2006-02-11 18:15
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: kxroberto (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.py: AttributeError on BadStatusLine

Initial Comment:
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.



--

Comment By: Georg Brandl (gbrandl)
Date: 2007-03-14 08:29

Message:
Logged In: YES 
user_id=849994
Originator: NO

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

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-12 06:56

Message:
Logged In: YES 
user_id=33168

I should add that the other bug is still open.

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-12 06:55

Message:
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.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1429783 ] urllib.py: AttributeError on BadStatusLine

2006-02-11 Thread SourceForge.net
Bugs item #1429783, was opened at 2006-02-11 19:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.py: AttributeError on BadStatusLine

Initial Comment:
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.



--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1429783 ] urllib.py: AttributeError on BadStatusLine

2006-02-11 Thread SourceForge.net
Bugs item #1429783, was opened at 2006-02-11 10:15
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.py: AttributeError on BadStatusLine

Initial Comment:
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.



--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:55

Message:
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.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1429783 ] urllib.py: AttributeError on BadStatusLine

2006-02-11 Thread SourceForge.net
Bugs item #1429783, was opened at 2006-02-11 10:15
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.py: AttributeError on BadStatusLine

Initial Comment:
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.



--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:56

Message:
Logged In: YES 
user_id=33168

I should add that the other bug is still open.

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-11 22:55

Message:
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.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1429783group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com