[ python-Bugs-1190580 ] SimpleHTTPServer sends wrong c-length and locks up client

SourceForge.net noreply at sourceforge.net
Tue May 3 20:07:05 CEST 2005


Bugs item #1190580, was opened at 2005-04-26 23:32
Message generated for change (Comment added) made by alexanderweb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1190580&group_id=5470

Category: None
Group: None
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Alexander Schremmer (alexanderweb)
Assigned to: Nobody/Anonymous (nobody)
Summary: SimpleHTTPServer sends wrong c-length and locks up client

Initial Comment:
On windows, SimpleHTTPServer shows a severe bug: it 
sends a wrong content-length header. In fact, it sends 
the wrong data. It differentiates between the mime types 
"text/" and the remaining ones and decides upon that if it 
should open the file in binary mode.

That is illegal according to the RFCs, any text/ mimetype 
has to be served using \r\n line endings, therefore it may 
not read it in non-binary mode.

My suggestion: remove the disambiguation (that means 
the if block).

Umm, yeah, my initial reason to report this: if the 
content-length value is greater than the actual delivered 
data size, gateways/clients may lock up if they use 
pipelining. (And they do, BTDT). The reason for that 
wrong value: the filesize if determined before line end 
conversion (implicit because of non-binary read file mode)
.

----------------------------------------------------------------------

>Comment By: Alexander Schremmer (alexanderweb)
Date: 2005-05-03 20:07

Message:
Logged In: YES 
user_id=254738

Indeed :-)

----------------------------------------------------------------------

Comment By: Irmen de Jong (irmen)
Date: 2005-05-03 10:33

Message:
Logged In: YES 
user_id=129426

This is a dupe of my patch [ 839496 ] SimpleHTTPServer
reports wrong content-length for text files, which has
already been applied & closed (Python 2.4.1 contains the
patch already, for instance).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1190580&group_id=5470


More information about the Python-bugs-list mailing list