SWI-Prolog / packages-pengines

Pengines: Prolog engines
11 stars 13 forks source link

HTTP-header stuff inside of HTTP-body when retrieving JSON data #25

Open axettone opened 7 years ago

axettone commented 7 years ago

I was testing the pengine/create interface using cURL and I noticed that the raw response in composed by multiple JSON items interleaved by this:

Access-Control-Allow-Origin: * Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache Expires: 0 Content-type: application/json; charset=UTF-8

Isn't that an HTTP response header? So.. why is it in the body? The problem is that it breaks JSON parsing.

How to replicate (from bash):

$ curl -s -d format=json -d "template=prolog(A)" -d "ask=actor(, A, ), director(_, A)" -d solutions=all -d "src_text=:-include('movies.pl')." -d application=swish -d chunk=10 http://swish.swi-prolog.org/pengine/create

Temporary fix: using -d chunk=1000000 without solutions=all

Anniepoo commented 7 years ago

Hmm... that's interesting. Explains issues I had with chunking