[ckan-dev] CKAN is mis-handling Accept header

Timothy Lebo lebot at rpi.edu
Tue Aug 28 20:33:05 UTC 2012


ckan / Ross,

I'm still finding trouble with the conneg mime handling on CKAN. As far as I can tell from http://docs.ckan.org/en/latest/linked-data-and-rdf.html, this should work.


curl -sH "Accept: application/rdf+xml" -L http://thedatahub.org/dataset/farmers-markets-geographic-data-united-states | head -5
  
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--[if IE 8 ]>    <html class="no-js ie8" lang="en"> <![endif]--><!--[if (gte IE 9)|!(IE)]><!--><html xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dc="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns="http://www.w3.org/1999/xhtml" class="no-js" lang="en"> <!--<![endif]-->


curl -sH 'Accept: text/turtle,application/turtle,application/rdf+xml;q=0.8,text/plain;q=0.7,*/*;q=0.5' http://thedatahub.org/dataset/farmers-markets-geographic-data-united-states | head -5
 
  
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--[if IE 8 ]>    <html class="no-js ie8" lang="en"> <![endif]--><!--[if (gte IE 9)|!(IE)]><!--><html xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dc="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns="http://www.w3.org/1999/xhtml" class="no-js" lang="en"> <!--<![endif]-->


Am I doing something wrong?

Thanks,
Tim Lebo




On May 23, 2012, at 8:09 AM, Timothy Lebo wrote:

> Ross,
> 
> On May 23, 2012, at 6:51 AM, Ross Jones wrote:
> 
>> 
>> I realise that discussing 2616 is a bit of a mine field .. but ...
>> 
>> On 21 May 2012, at 19:21, Timothy Lebo wrote:
>> 
>>> The following returns HTML:
>>> 
>>> curl -H "Accept: text/turtle,application/turtle,application/rdf+xml;q=0.8,text/plain;q=0.9,*/*;q=.5" http://thedatahub.org/dataset/farmers-markets-geographic-data-united-states
>>> 
>> 
>> From my (probably rusty) understanding of Accept this actually says ….
>> 
>> I would prefer text/turtle, or application/turtle. If you can't do that then I'll take text/plain(0.9), failing that send me application/rdf+xml(0.8) and if you still can't do that I'll take whatever you've got.
> 
> Yes, that is how I would interpret the Accept example.
> 
> 
>> In our case whilst we don't have a turtle serialisation of the RDF and your client expressed a preference for text.
> 
> Sorry, text/plain is the mime for the NTRIPLES format. I could see how that could be confused with html.
> I'll swap my scores for text/plain and application/rdf+xml so that there is no confusion.
> 
>> 
>> Having said all of that, I am fixing accept handling at present so will ensure it is doing the right thing,
> 
> Thanks!
> 
>> but I expect even with the correction to the qval it may still not work right now.
> 
> Acknowledged. After your fixes, I can try my tools out again, and tweak my Accept to suit.
> 
> Regards,
> Tim
> 
>> 
>> Ross.
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>> 
> 
> 
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> 





More information about the ckan-dev mailing list