RDFLib/rdflib — Issue #97: Bad HTTP content-negotation
Author: gjhiggins
Created: 2012-02-20 08:32:39+00:00
State: open

pierre.a...@gmail.com, 2010-01-27T12:17:42.000Z

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...

Comment 1 by eik...@gmail.com

Comment 2 by eik...@gmail.com

Comment 3 by gromgull

Comment 4 by gromgull
Screwed up the commit msg syntax, comments here: r1780