本文整理汇总了Python中SimpleXMLRPCServer.SimpleXMLRPCRequestHandler.is_rpc_path_valid方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleXMLRPCRequestHandler.is_rpc_path_valid方法的具体用法?Python SimpleXMLRPCRequestHandler.is_rpc_path_valid怎么用?Python SimpleXMLRPCRequestHandler.is_rpc_path_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleXMLRPCServer.SimpleXMLRPCRequestHandler
的用法示例。
在下文中一共展示了SimpleXMLRPCRequestHandler.is_rpc_path_valid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCRequestHandler import is_rpc_path_valid [as 别名]
def handle(self):
self.raw_requestline = self.rfile.readline()
if not self.parse_request(): # An error code has been sent, just exit
return
if SimpleXMLRPCRequestHandler.is_rpc_path_valid(self):
# @CTB hack hack hack, I should be ashamed of myself.
global client_ip
client_ip = self.client_address[0]
return SimpleXMLRPCRequestHandler.do_POST(self)
handler = ServerHandler(
self.rfile, self.wfile, self.get_stderr(), self.get_environ(),
multithread=False, multiprocess=False
)
handler.request_handler = self # backpointer for logging
handler.run(self.server.get_app())
示例2: _handle
# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCRequestHandler import is_rpc_path_valid [as 别名]
def _handle(self):
"""
Handle:
/xmlrpc => SimpleXMLRPCServer
/upload => self._handle_upload
all else => WSGI app for Web UI
"""
self.raw_requestline = self.rfile.readline()
if not self.parse_request(): # An error code has been sent, just exit
return
print "SERVER HANDLE: path is '%s'" % self.path
content_length = self.headers.getheader('content-length')
if not content_length:
content_length = 0
content_length = int(content_length)
print 'content length is:', content_length
if content_length > self.MAX_CONTENT_LENGTH:
message = "403 FORBIDDEN: You're trying to upload %d bytes; we only allow %d per request." % (content_length, self.MAX_CONTENT_LENGTH)
self._send_html_response(403, message)
return
if SimpleXMLRPCRequestHandler.is_rpc_path_valid(self):
# @CTB hack hack hack, I should be ashamed of myself.
global client_ip
client_ip = self.client_address[0]
return SimpleXMLRPCRequestHandler.do_POST(self)
elif self.path.startswith('/upload?'):
return self._handle_upload()
elif self.path.startswith('/notify'):
return self._handle_notify()
## else:
handler = ServerHandler(
self.rfile, self.wfile, self.get_stderr(), self.get_environ(),
multithread=False, multiprocess=False
)
handler.request_handler = self # backpointer for logging
handler.run(self.server.get_app())
示例3: handle
# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCRequestHandler import is_rpc_path_valid [as 别名]
def handle(self):
"""
Handle:
/xmlrpc => SimpleXMLRPCServer
/upload => self._handle_upload
/notify => self._handle_notify
all else => WSGI app for Web UI
"""
self.raw_requestline = self.rfile.readline()
if not self.parse_request(): # An error code has been sent, just exit
return
content_length = self.headers.getheader('content-length')
if not content_length:
content_length = 0
content_length = int(content_length)
print 'content length is:', content_length
if content_length > self.MAX_CONTENT_LENGTH:
message = too_big_message % (content_length,
self.MAX_CONTENT_LENGTH)
self._send_html_response(403, message)
return
if SimpleXMLRPCRequestHandler.is_rpc_path_valid(self):
return SimpleXMLRPCRequestHandler.do_POST(self)
elif self.path.startswith('/upload?'):
return self._handle_upload()
elif self.path.startswith('/notify'):
return self._handle_notify()
## else:
handler = ServerHandler(
self.rfile, self.wfile, self.get_stderr(), self.get_environ(),
multithread=False, multiprocess=False
)
handler.request_handler = self # backpointer for logging
handler.run(self.server.get_app())