[issue1491] BaseHTTPServer incorrectly implements response code 100
samwyse
report at bugs.python.org
Fri Nov 23 13:52:40 CET 2007
New submission from samwyse:
RFC 2616 sec 8.2.3 states, "An origin server that sends a 100 (Continue)
response MUST ultimately send a final status code, once the request body
is received and processed, unless it terminates the transport connection
prematurely." The obvious way to do this is to invoke the
'send_response' method twice, once with a code of 100, then with the
final code. However, BaseHTTPServer will always send two headers
('Server' and 'Date') when it send a response. One possible fix is to
add an option to the method to suppress sending headers; another is to
add the following code to the 'send_response' method, immediately prior
to the calls to 'self.send_header':
if code == 100:
return
The more paranoid among us may wish to use this code instead:
if code == 100:
expectation = self.headers.get('Expect', "")
if expectation.lower() == '100-continue':
return
----------
components: Library (Lib)
messages: 57783
nosy: samwyse
severity: normal
status: open
title: BaseHTTPServer incorrectly implements response code 100
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 3.0
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1491>
__________________________________
More information about the Python-bugs-list
mailing list