当前位置: 首页>>代码示例>>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;未经允许,请勿转载。