Exemplo n.º 1
0
 def __init__(self):
     self.__reader = reader.reader()
     self.header_ok = False
     self.__is_chunked = False
     self.__content_length = 0
     self.__responsed_length = 0
     self.__is_start = False
     self.__data = []
     self.__cookies = []
Exemplo n.º 2
0
    def __init__(self, boundary):
        self.__byte_begin_boundary = ("--%s\r\n" %
                                      boundary).encode("iso-8859-1")
        self.__byte_end_boundary = ("--%s--\r\n" %
                                    boundary).encode("iso-8859-1")
        self.__reader = reader.reader()
        self.__all_finish = False
        self.__begin_line_size = len(self.__byte_begin_boundary)
        self.__end_line_size = self.__begin_line_size + 2
        self.__data_list = []

        self.reset()
Exemplo n.º 3
0
 def __init__(self, env, *args, **kwargs):
     self.__qs_params = {}
     self.__stream_params = {}
     self.__env = env
     self.__files = {}
     self.__allow_request_methods = [
         "GET",
         "POST",
     ]
     self.__reader = reader.reader()
     self.__args = args
     self.__kwargs = kwargs
     self.__cookie = None
     self.__multipart = None
Exemplo n.º 4
0
 def __init__(self, host, ssl_on=False, is_ipv6=False):
     self.__sent_ok = False
     self.headers = []
     self.__is_ipv6 = is_ipv6
     self.__reader = reader.reader()
     self.__writer = writer.writer()
     self.__connect_ok = False
     self.__request_ok = False
     self.__is_http2 = False
     self.__alpn_on = False
     self.__write_ok = False
     self.__ssl_ok = False
     self.__ssl_on = ssl_on
     self.__host = host
     self.__is_closed = False
Exemplo n.º 5
0
    def __init__(self,
                 application,
                 cgi_env,
                 output_hdr_func,
                 output_body_func,
                 finish_func,
                 udata=None,
                 debug=False):
        """
        :param application:
        :param caddr: client address
        :param cgi_env: cgi env
        :param output_hdr_func :hdr function
        :param output_body_func: body function
        :param finish_func : finish function
        :param udata:自定义数据
        """
        self.__app = application
        self.__reader = reader.reader()
        self.__output_hdr_func = output_hdr_func
        self.__output_body_func = output_body_func
        self.__finish_func = finish_func
        self.__resp_content_length = 0
        self.__udata = udata
        self.__responsed_content_length = 0
        self.__debug = debug

        wsgi_env = self.__convert2wsgi_env(cgi_env)

        self.__recv_length = int(wsgi_env["CONTENT_LENGTH"])
        try:
            self.__app = application(wsgi_env, self.__start_response)
        except:
            self.__handle_error("500 Internal Server Error", [],
                                traceback.format_exc())
        return
Exemplo n.º 6
0
 def __init__(self):
     self.__reader = reader.reader()
     self.__results = []
Exemplo n.º 7
0
 def __init__(self):
     self.__reader = reader.reader()
     self.__header_ok = False
     self.__results = []
Exemplo n.º 8
0
#!/usr/bin/env python3