mirror of https://github.com/MISP/misp-modules
fix: [main] Disable duplicate JSON decoding
parent
095fbfd75f
commit
d0115e8b36
|
@ -183,10 +183,9 @@ class QueryModule(tornado.web.RequestHandler):
|
||||||
executor = ThreadPoolExecutor(nb_threads)
|
executor = ThreadPoolExecutor(nb_threads)
|
||||||
|
|
||||||
@run_on_executor
|
@run_on_executor
|
||||||
def run_request(self, jsonpayload):
|
def run_request(self, module, jsonpayload):
|
||||||
x = json.loads(jsonpayload)
|
|
||||||
log.debug('MISP QueryModule request {0}'.format(jsonpayload))
|
log.debug('MISP QueryModule request {0}'.format(jsonpayload))
|
||||||
response = mhandlers[x['module']].handler(q=jsonpayload)
|
response = mhandlers[module].handler(q=jsonpayload)
|
||||||
return json.dumps(response)
|
return json.dumps(response)
|
||||||
|
|
||||||
@tornado.gen.coroutine
|
@tornado.gen.coroutine
|
||||||
|
@ -198,7 +197,7 @@ class QueryModule(tornado.web.RequestHandler):
|
||||||
timeout = datetime.timedelta(seconds=int(dict_payload.get('timeout')))
|
timeout = datetime.timedelta(seconds=int(dict_payload.get('timeout')))
|
||||||
else:
|
else:
|
||||||
timeout = datetime.timedelta(seconds=300)
|
timeout = datetime.timedelta(seconds=300)
|
||||||
response = yield tornado.gen.with_timeout(timeout, self.run_request(jsonpayload))
|
response = yield tornado.gen.with_timeout(timeout, self.run_request(dict_payload['module'], jsonpayload))
|
||||||
self.write(response)
|
self.write(response)
|
||||||
except tornado.gen.TimeoutError:
|
except tornado.gen.TimeoutError:
|
||||||
log.warning('Timeout on {} '.format(dict_payload['module']))
|
log.warning('Timeout on {} '.format(dict_payload['module']))
|
||||||
|
|
Loading…
Reference in New Issue