dydra / support

4 stars 1 forks source link

Consider source-quality attribute in HTTP content negotiation #27

Open knoan opened 9 years ago

knoan commented 9 years ago

The source-quality attribute in 'Accept:' HTTP headers is currently ignored when choosing the response format for SPARQL requests.

If the client includes multiple 'Accept:' headers in the request like the following (transcript from an actual request generated from the Sesame 2.8 framework):

Accept: application/x-binary-rdf-results-table;q=0.8
Accept: application/sparql-results+xml
Accept: application/xml
Accept: application/sparql-results+json;q=0.8
Accept: application/json;q=0.8
Accept: text/tab-separated-values;q=0.8
Accept: text/csv;q=0.8

currently the last value (text/csv) is selected regardless of the q parameter, which would imply application/sparql-results+xml

The issue breaks interoperability with the Sesame framework as the text/csv format doesn't include datatype information for returned RDF literals.

lisp commented 9 years ago

does the sesame client prevent the request from specifying the media type which it actually wants?

knoan commented 9 years ago

Unfortunately there's no direct way to control the accepted type at the connection level: accepted types and quality values are centrally controlled by a static type registry.

As a last resort, it's possible to remove all but the required format from the registry, but that could have unintended consequences on other section of the code.

lisp commented 9 years ago

so, the only control is to specify the intent indirectly, through the quality factor?

knoan commented 9 years ago

Probably so and in a global way: 'accept' header generation is hardwired with no apparent way to override the global registry.