Beispiel #1
0
    def origin_is_accept(self):
        origin = utf8(self.request.get_header('Origin', ''))
        if not origin:
            return False

        origin_host = urlsplit(origin).netloc
        origin_host = ':' in origin_host and origin_host or (origin_host + ':80')
        if origin_host != self.request.host + ':' + self.request.port:
            return False

        return True
Beispiel #2
0
 def __init__(self, method, uri, version, headers, body, connection, real_ip = True):
     self.method = native_str(method)
     self.uri = native_str(uri)
     self.version = native_str(version)
     self.version_num = self.__version_num() 
     self.headers = headers
     self.body = body
     _urlparse = urlsplit(self.uri)
     self.path = _urlparse.path
     self.host = headers.get('Host', '').strip()
     self.host, self.port = (self.host.split(':') + ['80'])[:2]
     self.query = _urlparse.query
     self.connection = connection
     self._start_time = time()
     self.real_ip = real_ip
     self.cookies = self.__get_cookies()
     self.files = {}
     self._body_arguments = {}
     self.client_ip = self.__remote_ip()