from BaseHTTPServer import BaseHTTPRequestHandler
from StringIO import StringIO


class HTTPRequest(BaseHTTPRequestHandler):
    """
    Code from
    http://stackoverflow.com/questions/2115410/does-python-have-a-module-for-parsing-http-requests-and-responses
    """

    def __init__(self, request_text):
        self.rfile = StringIO(request_text)
        self.raw_requestline = self.rfile.readline()
        self.error_code = self.error_message = None
        self.parse_request()

    def send_error(self, code, message):
        self.error_code = code
        self.error_message = message

@@ -252,16 +252,336 @@
 esponses
+%0A%0A    print request.command          # %22GET%22%0A    print request.path             # %22/who/ken/trust.html%22%0A    print request.request_version  # %22HTTP/1.1%22%0A    print len(request.headers)     # 3%0A    print request.headers.keys()   # %5B'accept-charset', 'host', 'accept'%5D%0A    print request.headers%5B'host'%5D  # %22cm.bell-labs.com%22
 %0A    %22%22%22

Add documentation for httphandler