glastopf/conpot — pull request #78 by katkad (2013-08-30 15:27:11+00:00)
Title: Fix no headers error in http command_responder when sending error

parse_request in BaseHTTPServer sends error before self.headers and self.path are filled

when i am sending:
GET / HTTP/1.0 tralla

i get in the log:
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 638, in __init__
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 320, in handle_one_request
if not self.parse_request():
File "/usr/lib/python2.7/BaseHTTPServer.py", line 286, in parse_request
self.send_error(400, "Bad request syntax (%r)" % requestline)
File "/usr/local/lib/python2.7/dist-packages/Conpot-0.2.2-py2.7.egg/conpot/http/command_responder.py", line 354, in send_error
trace_data_length = self.headers.getheader('content-length')
AttributeError: HTTPServer instance has no attribute 'headers'

also logging message is usefull:
Bad request syntax ('GET / HTTP/1.0 tralla')

++ status page for error code 400 (Bad request)