Re: Browsers breaking content negotiation

> On 2017-02 -09, at 18:32, Martynas Jusevičius <martynas@graphity.org> wrote:
> 
> Hey,
> 
> say I have such RDF data:
> 
> <http://some.com/img/abc.jpg> dct:format "image/jpeg" .
> 
> The URI also maps to an abc.jpg image file. This allows my Linked Data
> platform to respond in at least 3 different ways to a request to such
> URI, depending on the Accept request header:
> 1. the JPEG image for image/*
> 2. the RDF metadata for any RDF syntax
> 3. HTML rendering of the metadata for text/html

I don’t think this is good practice.
Are they representations of the same thing? Not really.
You can argue that the metadata is a subset of the information in the image file, as the image file does contain metadata, but that is not very useful I think.
You should do conneg on the metadata, giving Turtle, rdf/xml and if necessary HTML,
and do possibly conneg on the image itself, giving JPEG and PNG maybe
and then link them together between the two URIs, for image and for metadata.


> 
> Yet recently I noticed that some browsers started sending Accept: */*
> instead of image-specific media types:
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation/List_of_default_Accept_values#Values_for_an_image
> https://bugzilla.mozilla.org/show_bug.cgi?id=1249474
> 
> This provides no information for the content negotiation algorithm and
> leading to a random response format. For example, the server would be
> correct to return HTML, which is obviously not what the browser
> expects.

No. The server must serve the highest quality option, typically the original format.
So for metadata Turtle, for the image the original.
Only give something else if it is because the client has asked for it as  a preference.


> 
> Anyone else thinks such behavior breaks WWW architecture? Browser
> vendors apparently have decided that conneg is bad:
> https://wiki.whatwg.org/wiki/Why_not_conneg

The browser vendors, in posts like that, typically ignore anything which is not massively done already
on the main public web and anything which  uses the web but is not a browser, and design for
the lowest common denominator,  accepting worse and worse syntax errors etc .
This the path they feel the market has forced them down, you do not have to go down that path
with new systems.   You can design new systems to use things like conneg in a logical way.
We can build system which do not sniff data or go to huge lengths to tolerate bad syntax.

tim


> 
> 
> Martynas
> atomgraph.com
> 
> 

Received on Monday, 13 February 2017 08:20:28 UTC