W3C home > Mailing lists > Public > public-lod@w3.org > March 2010

Re: A question - use 301 instead of 406?

From: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Date: Wed, 24 Mar 2010 11:31:03 -0400
Cc: Hugh Glaser <hg@ecs.soton.ac.uk>, Linking Open Data <public-lod@w3.org>
Message-Id: <E6DCD072-519E-4C37-9281-1C33CC2B5058@openlinksw.com>
To: Richard Cyganiak <richard@cyganiak.de>

On Mar 24, 2010, at 09:13 AM, Richard Cyganiak wrote:

> Hugh,
> On 23 Mar 2010, at 22:50, Hugh Glaser wrote:
>> Assuming that we are in the usual situation of http://foo/bar doing a 303 to
>> http://foo/bar.rdf when it gets a Accept: application/rdf+xml http://foo/bar
>> what should a server do when it gets a request for
>> Accept: application/rdf+xml http://foo/bar.html ?
>> OK, the answer is 406.
> No. The answer is 200, with the HTML representation. Content negotiation should happen on the “generic” URI, e.g., <http://foo/bar>, but not on the representation format specific URIs.


If I ask for application/rdf+xml representation of http://foo/bar.html,
you *SHOULD NOT* 200 OK and give me text/html *unless* you are also and
simultaneously providing a list of other alternatives (not formatted
here as it would be in an HTTP response).

      {"bar.html" 0.9 {type text/html} {language en}},
      {"bar.rdf" 0.7 {type application/rdf+xml} {language en}},
      {"bar.n3" 0.8 {type text/n3} {language en}}

Please do not presume that the most important element of my request is 
the URI in the request.  The most important element may well be the 
representation, and *I* (my agent) should be given the power to choose.

In fact, let's look at the Transparent Content Negotiation RFC, since
that's really the focus of this question -- not HTTP per se.


   A server may only choose on behalf of a user agent supporting
   transparent content negotiation if the user agent explicitly
   allows the use of a particular remote variant selection algorithm
   in the Negotiate request header.

> The reason for having the representation format specific URIs </bar.html> and </bar.rdf> in the first place is to allow users to override their user agent's Accept header.

No.  Oh so very much, no.

> For example, normal web browsers accept text/html but not application/rdf+xml. There is no way how an average user can change the browser's behaviour in this regard. Thus, if I direct my browser to </bar> I would always get HTML. If, for whatever reason, I want to see the RDF/XML, there's no way how I can do it. But if the </bar.rdf> URI is configured to always returns RDF/XML, no matter what the Accept header says, then the HTML can include a link to </bar.rdf> and say, “go here if you really want RDF/XML.” Problem solved.

No.  Normal web browsers Accept: */*.  

Their failure to *render* or otherwise handle application/rdf+xml 
(beyond prompting the user to ask whether to save or open with 
[pick an app]) is a separate issue.

> Sending 406 (or 301) on the representation format specific URIs like </bar.html> and </bar.rdf> negates the entire purpose of having those URIs in the first place.

Nonsense.  It is arguable that 406 (or 300, which I think is 
a more appropriate code than 301) present performance and 
scalability issues, but their effect (that is, to give the
user/agent a List of Versions) may be preserved in the combined 
Normal + Choice response --

      Server _____ proxy _____ proxy _____ user
      x.org        cache       cache       agent

        < ----------------------------------
        |      GET http://x.org/paper
        |       small Accept- headers
      able to choose on
      behalf of user agent
         ---------------------------------- >    [choice response]
              return of paper.1 and list

If I ask for a specific Representation of Thing, I expect to get
that -- or some information about why I'm not getting it, especially
if you give me something I didn't ask for (another Representation).

You don't have the Representation I've asked for?  OK -- tell me
so.  If you have a Representation which you're quite certain will
be OK, *and I've told you you may*, you can also deliver that 
*with* the advice that you don't have the Representation I asked 
for -- but you MUST NOT deliver anything *without* such advice
and permission.

> A key bit of text from RFC 2616:
>>> Note: HTTP/1.1 servers are allowed to return responses which are not acceptable according to the accept headers sent in the request. In some cases, this may even be preferable to sending a 406 response.
> Amen. 406 is actually counterproductive IMO. It just forces user agents to include something like "*/*;q=0.01" in the Accept header to work around those overeager content negotiation implementations that are just looking for an excuse not to send a representation to the client.
> <snip>
>> That's OK if all that happens is I use the wrong URI straight away.
>> But what happens if I then enter it into a form that requires a LD URI, and
>> then perhaps goes into a DB, and becomes a small part of a later process?
>> Simply put, the process will fail maybe years later, and the possibility and
>> knowledge to fix it will be long gone.
>> Maybe the form validation is substandard, but I can see this as a situation
>> that will recur a lot, because the root cause is that the address bar URI
>> changes from the NIR URI. And most html pages do not have links to the NIR
>> of the page you are on - I am even told that it is bad practice to make the
>> main label of the page a link to itself - wikipedia certainly doesn't,
>> although it is available as the "article" tab, which is not the normal thing
>> of a page. SO in a world where wikipedia itself became LD, it would not be
>> clear to someone who wanted the NIR URI where to find it.
> This is a serious problem. It is a UI problem and should be solved on the UI level, not on the transfer protocol level. We have lots of protocol people here and few UI people, so everyone tries to fix everything in the protocols.

I'm quite surprised at reading this from you, one of the dominant 
Voices of the Pedantic Web.  You negate much of those efforts with 
this post.

The fix is *already in* the protocols, if they're used as designed.

Be seeing you,


> A similar problem has plagued RSS in its early years. The solution was the feed autodiscovery convention for the HTML header, and the universal feed icon. Linked data needs something similar.
> Best,
> Richard
>> So that is some of the context and motivation.
>> If we were to decide to be more forgiving, what might be done?
>> How about using 301?
>> <<Ducks>>
>> To save you looking it up, I have appended the RFC2616 section to this
>> email.
>> That is
>> Accept: application/rdf+xml http://foo/bar.html
>> Should 301 to http://foo/bar
>> It seems to me that it is basically doing what is required - it gives the
>> client the expected access, while telling it (if it wants to hear) that it
>> should correct the mistake.
>> One worry (as Danius Michaelides pointed out to me) is that the caching may
>> need careful consideration - should the response indicate that it is not
>> cacheable, or is that not necessary?
>> So that's about it.
>> I am unhappy that users doing the obvious thing might get frustrated trying
>> to find the URIs for heir Things, so really want a solution that is not just
>> 406.
>> Are there other ways of being nice to users, without putting a serious
>> burden on the client software?
>> I look forward to the usual helpful and thoughtful responses!
>> By the way, I see no need to 301 to http:/foo/bar if you get a
>> Accept: text/html http://foo/bar.rdf as the steps to that might lead to this
>> would require someone looking at an rdf document to decide to use it as a
>> NIR, which is much less likely. And the likelihood is that there is an
>> eyeball there to see the problem.
>> But maybe it should?
>> Best
>> Hugh
>> 10.3.2 301 Moved Permanently
>>  The requested resource has been assigned a new permanent URI and any
>>  future references to this resource SHOULD use one of the returned
>>  URIs.  Clients with link editing capabilities ought to automatically
>>  re-link references to the Request-URI to one or more of the new
>>  references returned by the server, where possible. This response is
>>  cacheable unless indicated otherwise.
>>  The new permanent URI SHOULD be given by the Location field in the
>>  response. Unless the request method was HEAD, the entity of the
>>  response SHOULD contain a short hypertext note with a hyperlink to
>>  the new URI(s).
>>  If the 301 status code is received in response to a request other
>>  than GET or HEAD, the user agent MUST NOT automatically redirect the
>>  request unless it can be confirmed by the user, since this might
>>  change the conditions under which the request was issued.
>>     Note: When automatically redirecting a POST request after
>>     receiving a 301 status code, some existing HTTP/1.0 user agents
>>     will erroneously change it into a GET request.

A: Yes.                      http://www.guckes.net/faq/attribution.html
| Q: Are you sure?
| | A: Because it reverses the logical flow of conversation.
| | | Q: Why is top posting frowned upon?

Ted Thibodeau, Jr.           //               voice +1-781-273-0900 x32
Evangelism & Support         //        mailto:tthibodeau@openlinksw.com
                             //              http://twitter.com/TallTed
OpenLink Software, Inc.      //              http://www.openlinksw.com/
        10 Burlington Mall Road, Suite 265, Burlington MA 01803
OpenLink Blogs              http://www.openlinksw.com/weblogs/virtuoso/
    Universal Data Access and Virtual Database Technology Providers
Received on Wednesday, 24 March 2010 15:31:47 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:16:03 UTC