當前位置: 首頁>>代碼示例>>Python>>正文


Python CGIHTTPServer.CGIHTTPRequestHandler方法代碼示例

本文整理匯總了Python中CGIHTTPServer.CGIHTTPRequestHandler方法的典型用法代碼示例。如果您正苦於以下問題:Python CGIHTTPServer.CGIHTTPRequestHandler方法的具體用法?Python CGIHTTPServer.CGIHTTPRequestHandler怎麽用?Python CGIHTTPServer.CGIHTTPRequestHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CGIHTTPServer的用法示例。


在下文中一共展示了CGIHTTPServer.CGIHTTPRequestHandler方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setup

# 需要導入模塊: import CGIHTTPServer [as 別名]
# 或者: from CGIHTTPServer import CGIHTTPRequestHandler [as 別名]
def setup(self):
        """Override SocketServer.StreamRequestHandler.setup to wrap rfile
        with MemorizingFile.

        This method will be called by BaseRequestHandler's constructor
        before calling BaseHTTPRequestHandler.handle.
        BaseHTTPRequestHandler.handle will call
        BaseHTTPRequestHandler.handle_one_request and it will call
        WebSocketRequestHandler.parse_request.
        """

        # Call superclass's setup to prepare rfile, wfile, etc. See setup
        # definition on the root class SocketServer.StreamRequestHandler to
        # understand what this does.
        CGIHTTPServer.CGIHTTPRequestHandler.setup(self)

        self.rfile = memorizingfile.MemorizingFile(
            self.rfile,
            max_memorized_lines=_MAX_MEMORIZED_LINES) 
開發者ID:googlearchive,項目名稱:pywebsocket,代碼行數:21,代碼來源:standalone.py

示例2: is_cgi

# 需要導入模塊: import CGIHTTPServer [as 別名]
# 或者: from CGIHTTPServer import CGIHTTPRequestHandler [as 別名]
def is_cgi(self):
        """Test whether self.path corresponds to a CGI script.

        Add extra check that self.path doesn't contains ..
        Also check if the file is a executable file or not.
        If the file is not executable, it is handled as static file or dir
        rather than a CGI script.
        """

        if CGIHTTPServer.CGIHTTPRequestHandler.is_cgi(self):
            if '..' in self.path:
                return False
            # strip query parameter from request path
            resource_name = self.path.split('?', 2)[0]
            # convert resource_name into real path name in filesystem.
            scriptfile = self.translate_path(resource_name)
            if not os.path.isfile(scriptfile):
                return False
            if not self.is_executable(scriptfile):
                return False
            return True
        return False 
開發者ID:googlearchive,項目名稱:pywebsocket,代碼行數:24,代碼來源:standalone.py

示例3: end_headers

# 需要導入模塊: import CGIHTTPServer [as 別名]
# 或者: from CGIHTTPServer import CGIHTTPRequestHandler [as 別名]
def end_headers(self):
        self.send_header("Pragma", "no-cache")
        self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
        self.send_header("Pragma", "no-cache")
        CGIHTTPServer.CGIHTTPRequestHandler.end_headers(self) 
開發者ID:feliam,項目名稱:CVE-2014-4377,代碼行數:7,代碼來源:run.py

示例4: __init__

# 需要導入模塊: import CGIHTTPServer [as 別名]
# 或者: from CGIHTTPServer import CGIHTTPRequestHandler [as 別名]
def __init__(self, request, client_address, server):
        self._logger = util.get_class_logger(self)

        self._options = server.websocket_server_options

        # Overrides CGIHTTPServerRequestHandler.cgi_directories.
        self.cgi_directories = self._options.cgi_directories
        # Replace CGIHTTPRequestHandler.is_executable method.
        if self._options.is_executable_method is not None:
            self.is_executable = self._options.is_executable_method

        # This actually calls BaseRequestHandler.__init__.
        CGIHTTPServer.CGIHTTPRequestHandler.__init__(
            self, request, client_address, server) 
開發者ID:googlearchive,項目名稱:pywebsocket,代碼行數:16,代碼來源:standalone.py

示例5: __init__

# 需要導入模塊: import CGIHTTPServer [as 別名]
# 或者: from CGIHTTPServer import CGIHTTPRequestHandler [as 別名]
def __init__(self, req, client_addr, server):
    CGIHTTPServer.CGIHTTPRequestHandler.__init__(self, req, client_addr, server) 
開發者ID:jerryli27,項目名稱:TwinGAN,代碼行數:4,代碼來源:server.py


注:本文中的CGIHTTPServer.CGIHTTPRequestHandler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。