We're updating the issue view to help you get more done. 

HTTP Sparql endpoint should use GET instead of POST requests when query not too long

Description

As noted in the SPARQL RDF protocol spec :

The queryHttpGet binding should be used except in cases where the URL-encoded query exceeds practical limits, in which case the queryHttpPost binding should be used.

I believe this means that the org.openrdf.http.client.HTTPClient class is non-conforming, since it unconditionally uses POST for querying (in the getQueryMethod method). I can see why this was done in practical terms, since a conforming server has to accept POST queries in any case, so why not just use POST? Unfortunately, in the wild, not all servers accept POST (such as the adhoc server I'm dealing with now), and it would make sense for a library such as Sesame to follow the best practice.

I think that a simple conditional, based on query length, around this line in getQueryMethod would do the trick.

1 PostMethod method = new PostMethod(getQueryURL());

If it's of interest and likely to be accepted, I can create a patch and test it.

Environment

None

Status

Assignee

Peter Ansell

Reporter

andymackinlay

Components

Fix versions

Affects versions

2.7.10

Priority

Minor