gjhiggins/rdflib — Issue #102: Bad HTTP content-negotation
Author: gjhiggins
Created: 2011-10-19 01:21:37+00:00
State: open

Originally filed by pierre.a...@gmail.com on 2010-01-27T12:17:42

When executing the following code:

from rdflib import ConjunctiveGraph
g = ConjunctiveGraph()
g.parse("http://localhost:12345/foo", format="n3")

my localhost HTTP server receives the following request

GET /foo HTTP/1.1
Accept-Encoding: identity
Host: localhost:12345
Connection: close
Accept: application/rdf+xml,application/xhtml+xml;q=0.5
User-Agent: rdflib-2.4.0 (http://rdflib.net/; eikeon@eikeon.com)

The Accept: field is wrong: the agent should request 'text/n3'.

Even worse, since it does not even state that it accepts */*, the server is
not supposed to reply with *anything* else than rdf+xml or xhtml, even if
N3 was available for that resource.

And assuming that only N3 is available, "then the server SHOULD send a 406
(not acceptable) response" (per RFC2616), although many servers fail to do
so and reply with whatever content they have, regardless of the Accept field...