Re: [Recipes] Puzzle with HTTP Accept, Firefox header plug-in and RDF

Hi Diego,

> Antoine,
> 
> El jue, 12-02-2009 a las 16:39 +0100, Antoine Isaac escribió:
>> But when it queries for the SKOS 2008 file [3], Firefox gets redirected to [4] and not to [5].
>>
>> How come? What is puzzling is that Vapour [6] reports that everything is ok with both URIs [1] and [3], even though the behaviours differ when there is no content negociation. Interestingly, Vapour itself recognizes my Accept headers: when I activate the application/rdf+xml only, it sends its reports in RDF, while it sends the HTML if I do nothing.
>>
>> Is there something more than Accept header involved? Has my plug-in bugs, or am I just too dumb to think of myself playing with that kind of stuff?
> 
> This problem is a nice example of the risks of using the User-Agent
> header for content negotiation. The server is issuing a redirect to the
> HTML document when you use Firefox/IE, regardless of the content of the
> Accept header. Compare these two requests:
> 
> $ curl -I -H "Accept: application/rdf+xml"
> http://www.w3.org/2008/05/skos
> 
> HTTP/1.1 303 See Other
> ...
> Location: http://www.w3.org/TR/2008/WD-skos-reference-20080829/skos.rdf
> ...
> 
> 
> $ curl -I -H "Accept: application/rdf+xml" -H "User-agent: Mozilla/5.0
> (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009020409 Iceweasel/3.0.6
> (Debian-3.0.6-1)" http://www.w3.org/2008/05/skos
> 
> HTTP/1.1 303 See Other
> ...
> Location: http://www.w3.org/TR/2008/WD-skos-reference-20080829/skos.html
> ...
> 
> 
> Best,
> 
> (Thanks to Sergio, in CC, for the HTTP traces)

Thanks! That indeed explains everything.

I'd be curious, though, why such a rule has been set up in the Recipes. Once this document acknowledges that:
> It is accepted as a principle of good practice that HTTP clients SHOULD include an 'Accept:' field in a request header,
then the rewrite rules could have been specified based on the Accept header only, couldn't they?
Of course you can say rightfully that this assumes that some tricky minds will use Mozilla to get RDF. But I would then reply that having such a flaw in the approach is likely to encourage people to adapt variants of the recipes.
As an example I guess neither Vapour nor dbPedia follow strictly one of the Recipes, as the ones that do involve serving RDF or HMTL seem to include the User-Agent header in the rewriting.

Cheers,

Antoine

Received on Friday, 13 February 2009 09:23:04 UTC