Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@dogstatsd.timed('xmlrpc.call')
@metricmethod
def __call__(self, webui_obj):
webui_obj.handler.send_response(200, 'OK')
webui_obj.handler.send_header('Content-type', 'text/xml')
webui_obj.handler.send_header('charset', 'UTF-8' )
webui_obj.handler.end_headers()
try:
length = int(webui_obj.env['CONTENT_LENGTH'])
assert length < 10*1024*1024, 'request content way too big'
data = webui_obj.handler.rfile.read(length)
# This should be thread-safe, as the store is really a singleton
self.store = webui_obj.store
except Exception, e:
# report as a fault to caller rather than propogating up to generic
# exception handler
response = xmlrpclib.dumps(
xmlrpclib.Fault(1, repr(e)),
@dogstatsd.timed('xmlrpc.dispatch')
@metricmethod
def _dispatch(self, method, params):
if not method.startswith('system.'):
# Add store to all of our own methods
params = (self.store,)+tuple(params)
return SimpleXMLRPCDispatcher._dispatch(self, method, params)
@dogstatsd.timed('xmlrpc.multicall')
@metricmethod
def system_multicall(self, call_list):
if len(call_list) > 100:
raise Fault, "multicall too large"
return SimpleXMLRPCDispatcher.system_multicall(self, call_list)