def __init__(self, request, remote_addr):
    self.remote_addr = remote_addr
    lines = request.split('\r\n')
    verb_line = lines.pop(0)
    method, path, unused_protocol = verb_line.split(' ', 2)

    self.headers = CaseInsensitiveDict()
    for line in lines:
      key, value = line.split(': ', 1)
      self.headers[key] = value

    self.url = 'http://%s/%s' % (self.headers['host'], path.lstrip('/'))

    self.method = method.upper()
    self.path = path
    self.query_string = ''
    if '?' in self.path:
      self.path, self.query_string = self.path.split('?', 1)

    self._qs = urlparse.parse_qs(self.query_string)
    # TODO(flamingcow): Cookies.
dataset/ETHPy150Open google/mysql-tools/pylib/http_server.py/Request.__init__/original