SWI-Prolog / packages-pengines

Pengines: Prolog engines
11 stars 13 forks source link

pengines GET, Url length, and idempotency #20

Closed Anniepoo closed 8 years ago

Anniepoo commented 8 years ago

pengine ASK is using HTTP GET as the underlying HTTP mechanism under PLTP.

This has a couple consequences for us:

  1. GET is assumed idempotic. Prolog queries are not.

We're concerned about seeing duplicate queries from the client.

  1. GET query parameters have a maximum length, in practice. We're running into it. We're passing a 14K XML document back and forth.

http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers

rla commented 8 years ago

+1

JanWielemaker commented 8 years ago

I fully agree. Will add a POST version. We can keep the GET version, so compatibility need not be affected.

JanWielemaker commented 8 years ago

Added. Not sure this is really the ideal yet. Now encodes the format and id in the URL and the event as POST payload using Content-type: application/x-prolog. Might be better to access /pengines/send/ and use the HTTP Accept header to specify the result format. The old GET is still supported.

Anyway, this is mostly internal. Updated pengines.js and pengines.pl client to use the POST.

Anniepoo commented 8 years ago

What do we need to do on an application level, other than update our SWI-Prolog version?

JanWielemaker commented 8 years ago

Nothing. Just update Prolog and make sure you get pengines.js from the Pengine server or make a new copy (but I advice to always get it from the server you are talking to).