当前位置: 首页>>代码示例>>Python>>正文


Python Request.process方法代码示例

本文整理汇总了Python中twisted.web.server.Request.process方法的典型用法代码示例。如果您正苦于以下问题:Python Request.process方法的具体用法?Python Request.process怎么用?Python Request.process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.web.server.Request的用法示例。


在下文中一共展示了Request.process方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
    def process(self):
        self.setHeader("Content-Security-Policy", self.HEADER_VALUES)
        self.setHeader("X-Content-Security-Policy", self.HEADER_VALUES)
        self.setHeader("X-Webkit-CSP", self.HEADER_VALUES)

        if self.isSecure():
            self.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains')

        Request.process(self)
开发者ID:phss,项目名称:pixelated-user-agent,代码行数:11,代码来源:site.py

示例2: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
    def process(self):
        connection = self.requestHeaders.getRawHeaders("Connection", [None])[0]
        upgrade = self.requestHeaders.getRawHeaders("Upgrade", [None])[0]

        if not connection or "upgrade" not in connection.lower():
            return Request.process(self)

        if not upgrade or upgrade.lower() != "websocket":
            return Request.process(self)

        return self.processWebSocket()
开发者ID:sociam,项目名称:indx,代码行数:13,代码来源:websocket.py

示例3: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
    def process(self):
        connection = self.requestHeaders.getRawHeaders("Connection", [None])[0]
        upgrade = self.requestHeaders.getRawHeaders("Upgrade", [None])[0]

        if not connection or "Upgrade" not in connection:
            return Request.process(self)

        if upgrade not in ("WebSocket", "websocket"):
            return Request.process(self)

        return self.processWebSocket()
开发者ID:thomasvs,项目名称:txWebSocket,代码行数:13,代码来源:websocket.py

示例4: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
    def process(self):
        upgrade = self.requestHeaders.getRawHeaders("Upgrade")
        if not upgrade or upgrade[0] not in ("WebSocket", "websocket"):
            return Request.process(self)

        connection = self.requestHeaders.getRawHeaders("Connection")
        if not connection or "Upgrade" not in [
                        c.lstrip() for c in connection[0].split(',')]:
            return Request.process(self)

        return self.processWebSocket()
开发者ID:aprilmay,项目名称:txWebSocket,代码行数:13,代码来源:websocket.py

示例5: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
    def process(self):
        self.setHeader('Content-Security-Policy', self.CSP_HEADER_VALUES)
        self.setHeader('X-Content-Security-Policy', self.CSP_HEADER_VALUES)
        self.setHeader('X-Webkit-CSP', self.CSP_HEADER_VALUES)
        self.setHeader('X-Frame-Options', 'SAMEORIGIN')
        self.setHeader('X-XSS-Protection', '1; mode=block')
        self.setHeader('X-Content-Type-Options', 'nosniff')

        if self.isSecure():
            self.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains')

        Request.process(self)
开发者ID:pixelated,项目名称:pixelated-user-agent,代码行数:14,代码来源:site.py

示例6: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
 def process(self):
     if self.requestHeaders.getRawHeaders("Upgrade") == ["WebSocket"] and self.requestHeaders.getRawHeaders(
         "Connection"
     ) == ["Upgrade"]:
         return self.processWebSocket()
     else:
         return Request.process(self)
开发者ID:secretrobotron,项目名称:horizons,代码行数:9,代码来源:websocket.py

示例7: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
 def process(self):
     connection = self.requestHeaders.getRawHeaders("Connection", [None])[0]
     upgrade = self.requestHeaders.getRawHeaders("Upgrade", [None])[0]
     
     if not connection or "Upgrade" not in connection:
         return Request.process(self)
     
     if upgrade not in ("WebSocket", "websocket"):
         return Request.process(self)
     
     origin = self.requestHeaders.getRawHeaders('origin', [None])[0]
     secOrigin = self.requestHeaders.getRawHeaders('Sec-WebSocket-Origin', [None])[0]
     if not origin and not secOrigin:
         log.msg('Refusing connection because no origin is set.')
         return self.channel.transport.loseConnection()
     parsed_origin = urlparse((origin or secOrigin).strip())
     if parsed_origin.hostname and '.'.join(parsed_origin.hostname.split('.')[-2:]) in TRUSTED_DOMAINS:
         log.msg('Accepting connection from [%s]' % origin)
     else:
         log.msg('Refusing connection from [%s]' % origin)
         return self.channel.transport.loseConnection()
     
     return self.processWebSocket()
开发者ID:AlfredArouna,项目名称:jolicloud-daemon,代码行数:25,代码来源:main.py

示例8: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
    def process(self):
        # get upgrade headers and switch them to lower case
        upgrade_headers = self.requestHeaders.getRawHeaders("Upgrade") or []
        upgrade_headers = [h.lower() for h in upgrade_headers]

        connection_headers = self.requestHeaders.getRawHeaders("Connection") or []
        # get all connection_headers, split each at ',',
        # join into a single list and switch them to lower case
        connection_headers = itertools.chain(*[re.split(r',\s*', h) for h in connection_headers])
        connection_headers = [h.lower() for h in connection_headers]

        if ("websocket" in upgrade_headers and "upgrade" in connection_headers):
            return self.processWebSocket()
        else:
            return Request.process(self)
开发者ID:iuridiniz,项目名称:txWebSocket,代码行数:17,代码来源:websocket.py

示例9: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
    def process(self):
        if self._fallbackToBuffered:
            return Request.process(self)

        # streaming mode
        # pause producing on channel until we know what resource
        # we deal with
        self.channel.transport.pauseProducing()
        self.site = self.channel.site

        self.setHeader('server', version)
        self.setHeader('date', datetimeToString())

        self.prepath = []
        self.postpath = map(unquote, string.split(self.path[1:], '/'))

        try:
            self.processResource(self.site.getResourceFor(self))
        except:
            self.processingFailed(failure.Failure())
开发者ID:mensi,项目名称:gitserverglue,代码行数:22,代码来源:streamingweb.py

示例10: _continue_request

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
		def _continue_request():
			CORE.info('Dispatch request ...')
			Request.process(self)
开发者ID:spaceone,项目名称:univention-management-console,代码行数:5,代码来源:request.py

示例11: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
 def process(self):
     self.setHeader("Content-Security-Policy", self.HEADER_VALUES)
     self.setHeader("X-Content-Security-Policy", self.HEADER_VALUES)
     self.setHeader("X-Webkit-CSP", self.HEADER_VALUES)
     Request.process(self)
开发者ID:sw00,项目名称:pixelated-user-agent,代码行数:7,代码来源:site.py

示例12: process

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import process [as 别名]
 def process(self):
     if self.requestHeaders.getRawHeaders('Upgrade') == ['PTTH/1.0'] and self.requestHeaders.getRawHeaders('Connection') == ['Upgrade']:
         return self.processWebSocket()
     else:
         return Request.process(self)
开发者ID:popazerty,项目名称:beyonwiz-4.1,代码行数:7,代码来源:websocket.py


注:本文中的twisted.web.server.Request.process方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。