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: Exception when handling http response
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, rkasperski
Priority: normal Keywords:

Created on 2006-04-12 20:49 by rkasperski, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg28206 - (view) Author: Richard Kasperski (rkasperski) Date: 2006-04-12 20:49
When handling the return from a web server that dooes
not return the content length(one I wrote) httplib
takes an exception at line 478.

The line of code in question is 
if self.length is not None:

and should probably read
if self.length is not None and self.length != _UNKNOWN:

The problem is that self.length is no longer
initialized to None
msg28207 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-04-12 21:31
Logged In: YES 
user_id=849994

On which version of Python does this occur?

In HEAD, all code paths in begin() lead to self.length being
set to some value or None.
msg28208 - (view) Author: Richard Kasperski (rkasperski) Date: 2006-04-12 21:43
Logged In: YES 
user_id=520350

Here is the version header from running python at the
command line.
Python 2.4 (#1, Feb  3 2005, 08:52:54

In my httplib.py length is initialized to _UNKNOWN which has
the value "UNKNOWN"
msg28209 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-04-12 21:50
Logged In: YES 
user_id=849994

It looks like you're getting a HTTP 0.9 response. In Python
2.4.0, self.length wasn't set in this case, but this bug was
fixed in version 2.4.2.

Closing this as Fixed, if the problem persists with Python
2.4.3 please reopen.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43194
2006-04-12 20:49:37rkasperskicreate