def _CheckForNewRequest(self):
    """Check the buffer for a new request."""
    if self._blocked:
      return
    if '\r\n\r\n' in self._buffer:
      request, new_buffer = self._buffer.split('\r\n\r\n', 1)
      # TODO(flamingcow): Support requests with body contents.
      self._buffer = new_buffer
      response = Response(self)
      try:
        request = Request(request, self._remote_addr)
      except (KeyError, ValueError):
        response.headers.add_header('Content-Type', 'text/plain')
        response.start_response(400)
        response.out.write('Failed to parse request.')
        response.end_response()
        return

      if request.path != '/favicon.ico':
        logging.info('[%s] %s %s', self._remote_addr, request.method,
                     request.path)
      self._blocked = True
      self._callback(request, response)
dataset/ETHPy150Open google/mysql-tools/pylib/http_server.py/Connection._CheckForNewRequest/original