adulau/cve-search

JSONP doesn't work

mvollmer opened this issue · 1 comments

Looking at the code, it seems that you try to support JSONP (great!) but it doesn't work:

$ curl 'https://cve.circl.lu/api/cve/CVE-2017-9366?callback=xxx'
HTTP/1.1 0 (Content-Type: application/json
Server: TornadoServer/4.4.2
Content-Length: 1

x

Note that only the first character of the callback is returned, and that the headers appear unexpectedly in the body.

Looking at the code again, this seems to happen because the api function in web/api.py executes

return Response(data[0], mimetype=returnType), data[1]

while data is a string, not the usual (json, code) tuple.

Stale issue message