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

Diego, Sergio

Excellent job! I think this is worth discussing it at the next telecon. If it is not too much hassle from a W3C perspective, I think a new version of the Note should be published. Now that you have fixed the issue, it would be a waste :-)

Best,

Antoine


> Antoine, Alistair,
> 
> Sorry for the belated response. We've been making some tests to analyse 
> the problem with Recipe 3 in order to trace the issue found by Antoine. 
> We discovered that it is due to the precedence of the User Agent check 
> over the Accept header check. In other words, when the User Agent is 
> Mozilla (or Mozilla-compatible), Recipe 3 --as it is now-- always 
> returns RDF, regardless of the Accept header.
> 
> We have found this formula to fix this issue without breaking the other 
> cases (see my messages from August'08: [1] and [2]):
> 
> ====
> RewriteCond %{HTTP_ACCEPT} 
> !application/rdf\+xml.*(text/html|application/xhtml\+xml)
> RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
> RewriteCond %{HTTP_ACCEPT} text/html
> RewriteRule ^example3$ example3-content/2005-10-31.html [R=303]
> 
> RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml
> RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
> RewriteRule ^example3$ example3-content/2005-10-31.html [R=303]
> 
> RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
> RewriteRule ^example3$ example3-content/2005-10-31.rdf [R=303]
> 
> RewriteRule ^example3$ example3-content/2005-10-31.rdf [R=303]
> ====
> 
> If you compare these rules and the ones in the published Note [3], the 
> difference is that we split the first RewriteRule into two new ones. The 
> purpose is to serve HTML to Mozilla-compatible user agents *only* if the 
> do not explicitly ask for RDF. Take into account that we do not master 
> Apache rewrite rules, consequently there may be a more optimal solution 
> to the same problem.
> 
> At the same time, we have introduced a few changes and bugfixes in 
> Vapour. The most remarkable one is the ability to customize the value of 
> the User-Agent header sent by Vapour. With this new feature, you can 
> easily debug which result will be returned to Mozilla-compatible 
> browsers. For instance, you can test the current example of Recipe 3 
> with a non-Mozilla [4] and a Mozilla-compatible User Agent [5]. These 
> results confirm the issue spotted by Antoine.
> 
> In our next telecon, we can discuss this issue and whether we should 
> change the Recipes (3 to 6) and publish a new version of the Note.
> 
> Best,
> 
> Diego and Sergio.
> 
> [1] http://lists.w3.org/Archives/Public/public-swd-wg/2007Jul/0130.html
> [2] http://lists.w3.org/Archives/Public/public-swd-wg/2007Aug/0008.html
> [3] http://www.w3.org/TR/swbp-vocab-pub/#recipe3example
> [4] 
> http://validator.linkeddata.org/vapour?vocabUri=http%3A%2F%2Fwww.w3.org%2F2006%2F07%2FSWD%2Frecipes%2Fexamples-20080421%2Fexample3&classUri=http%3A%2F%2F&propertyUri=http%3A%2F%2F&instanceUri=http%3A%2F%2F&htmlVersions=1&defaultResponse=dontmind&userAgent=vapour.sourceforge.net 
> 
> [5] 
> http://validator.linkeddata.org/vapour?vocabUri=http%3A%2F%2Fwww.w3.org%2F2006%2F07%2FSWD%2Frecipes%2Fexamples-20080421%2Fexample3&classUri=http%3A%2F%2F&propertyUri=http%3A%2F%2F&instanceUri=http%3A%2F%2F&htmlVersions=1&defaultResponse=dontmind&userAgent=Mozilla%2F5.0 
> 
> 
> Alistair Miles escribió:
>> Hi Antoine,
>>
>> It may be that the User-Agent header is causing the Accept header to
>> be overridden.
>> I don't have access to the config for the 2008/05 namespace, but it's
>> probably using some variant of [recipe 3]. There have been some minor
>> changes to this recipe since I worked on it, so I'm not sure exactly
>> how it will behave with both an Accept: application/rdf+xml header and
>> a User-Agent: Mozilla/... header, you'd have to ask diego. Ralph can
>> confirm the .htaccess rules that are in place.
>>
>> Cheers,
>>
>> Alistair
>>
>> [recipe 3] http://www.w3.org/TR/swbp-vocab-pub/#recipe3
>> On Thu, Feb 12, 2009 at 04:39:02PM +0100, Antoine Isaac wrote:
>>> Hi everyone,
>>>
>>> Related to getting the SKOS RDF file by it default URI (or at least 
>>> to test that ability), I wanted to change my browser's headers so 
>>> that it asks for RDF data and not HTML anymore.
>>> Following Sean's advice, I have installed the ModifyHeader plug-in 
>>> for Firefox (I'm still at version 2.0).
>>>
>>> I now have the following problem.
>>> I have changed the Accept header sent by my Firefox to 
>>> application/rdf+xml (only)
>>> On dbPedia, when it queries [1] , Firefox gets redirected to the RDF 
>>> file [2]. Perfect!
>>> 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?
>>>
>>> Thanks for any feedback,
>>>
>>> Antoine
>>>
>>>
>>> [1] http://dbpedia.org/resource/William_Shakespeare
>>> [2] http://dbpedia.org/data/William_Shakespeare.rdf
>>> [3] http://www.w3.org/2008/05/skos
>>> [4] http://www.w3.org/TR/2008/WD-skos-reference-20080829/skos.html
>>> [5] http://www.w3.org/TR/2008/WD-skos-reference-20080829/skos.rdf
>>> [6] http://validator.linkeddata.org/
>>>
>>> ========================
>>>
>>> http://www.w3.org/2008/05/skos
>>>
>>> GET /2008/05/skos HTTP/1.1
>>> Host: www.w3.org
>>> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.20) 
>>> Gecko/20081217 Firefox/2.0.0.20
>>> Accept: application/rdf+xml
>>> Accept-Language: fr,en-us;q=0.8,fr-fr;q=0.5,en;q=0.3
>>> Accept-Encoding: gzip,deflate
>>> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>>> Keep-Alive: 300
>>> Connection: keep-alive
>>>
>>> HTTP/1.x 303 See Other
>>> Date: Thu, 12 Feb 2009 15:13:21 GMT
>>> Server: Apache/2
>>> Location: http://www.w3.org/TR/2008/WD-skos-reference-20080829/skos.html
>>> Cache-Control: max-age=21600
>>> Expires: Thu, 12 Feb 2009 21:13:21 GMT
>>> Content-Length: 269
>>> Connection: close
>>> Content-Type: text/html; charset=iso-8859-1
>>>
>>>
>>>
>>
> 
> 
> 

Received on Thursday, 26 February 2009 13:34:38 UTC