Are the built-in HTTP servers production quality?

David Fraser davidf at
Mon Jul 19 21:57:34 CEST 2004

Irmen de Jong wrote:
> Grant Edwards wrote:
>> Why do you have to buffer the entire file?  You couldm ake two
>> almost-identical conversion passes through the file: the first
>> time, just count the "output" bytes.  Finish sending the HTTP
>> headers out, then make the second pass actually writing the
>> output bytes.  
> That would slow things down quite a bit, because you now
> have to do the same CPU-intensive task twice.
> But it saves memory.
> Oh, the choices...
> --Irmen

Or to improve it slightly you could do a find loop on the characters you 
have to convert [LF for Unix], work out how many characters you're going 
to have to add, give the contentlength, send the headers, and then use 
the cached list of LF positions to send strings + inserted characters

Now that would have been easier to say in Python...


More information about the Python-list mailing list