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: SimpleHTTPServer sends wrong c-length and locks up client
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: alexanderweb, irmen
Priority: normal Keywords:

Created on 2005-04-26 21:32 by alexanderweb, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg25141 - (view) Author: Alexander Schremmer (alexanderweb) Date: 2005-04-26 21:32
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)
.
msg25142 - (view) Author: Irmen de Jong (irmen) (Python triager) Date: 2005-05-03 08:33
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).
msg25143 - (view) Author: Alexander Schremmer (alexanderweb) Date: 2005-05-03 18:07
Logged In: YES 
user_id=254738

Indeed :-)
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41907
2005-04-26 21:32:59alexanderwebcreate