classification
Title: BaseHTTPRequestHandler innefficient when sending HTTP header
Type: performance Stage:
Components: Library (Lib) Versions: Python 2.6, Python 2.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: gregory.p.smith, yangman
Priority: normal Keywords:

Created on 2008-08-27 23:43 by yangman, last changed 2008-09-22 01:20 by gregory.p.smith.

Messages
msg72051 (view) Author: Yang Zhao (yangman) Date: 2008-08-27 23:43
send_header() in BaseHTTPRequestHandler currently does a write to socket
every time send_header() is called. This results in excessive number of
TCP packets being regenerated. Ideally, as much of the HTTP packet is
buffered as possible, but, at minimum, the header should be sent with a
single write as there is a convenient end_header() functional available.

Behaviour is observed under python 2.5, but the related code looks
identical in SVN trunk.

Will contribute patch if request is deemed reasonable but no one is
available to work on it; I just need a few days.
msg73551 (view) Author: Gregory P. Smith (gregory.p.smith) Date: 2008-09-22 01:20
Buffering up header IO and sending it all at once is always a good thing
to do.  A patch and unit test would be greatly appreciated.
History
Date User Action Args
2008-09-22 01:20:48gregory.p.smithsetpriority: normal
assignee: gregory.p.smith
messages: + msg73551
nosy: + gregory.p.smith
versions: + Python 2.6
2008-08-27 23:43:46yangmancreate