couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Newson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1175) Improve content type negotiation for couchdb JSON responses
Date Fri, 17 Jun 2011 16:44:47 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-1175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051185#comment-13051185
] 

Robert Newson commented on COUCHDB-1175:
----------------------------------------

I understand completely, I didn't find any comment harsh.

I should note that I created COUCHDB-1175 with the specific intention of using q-values for
this. Currently we don't use them. Before 1.1 we tested for "text/html" first and "application/json"
second. Whichever you accepted first would be used. The order was inverted in 1.1.

RFC 2616 does *not* require us to return the highest valued type (Section 14.1 says we SHOULD,
not MUST, use the ordering), so neither 1.0 or 1.1 is technically 'not standard compliant'.
Moreover, many browsers add '*/*' to the end of their accept list, which makes proper negotiation
impossible. For example, given;

"Accept: text/html, */*"

Both 'text/html' and 'application/json' have a q-value of 1, they are exactly equally preferred.
What to do?

Firefox sends "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", it's
true, which means we'll send text/html, not application/json, but this doesn't work for all
browsers.




> Improve content type negotiation for couchdb JSON responses
> -----------------------------------------------------------
>
>                 Key: COUCHDB-1175
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1175
>             Project: CouchDB
>          Issue Type: Improvement
>    Affects Versions: 1.0.2
>            Reporter: Robert Newson
>             Fix For: 1.1, 1.2
>
>
> Currently we ignore qvalues when negotiation between 'application/json' and 'text/plain'
when returning JSON responses.
> Specifically, we test directly for 'application/json' or 'text/plain' in the Accept header.
Different branches have different bugs, though. Trunk returns 'application/json' if 'application/json'
is present at all, even if it's less preferred than 'text/plain' when qvalues are accounted
for.
> We should follow the standard.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message