You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Julian Reschke (JIRA)" <ji...@apache.org> on 2019/04/26 07:12:00 UTC

[jira] [Issue Comment Deleted] (OAK-8135) HTTP service may not select correct media type if multiple are specified in Accept header field

     [ https://issues.apache.org/jira/browse/OAK-8135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke updated OAK-8135:
--------------------------------
    Comment: was deleted

(was: trunk: [r1855993|http://svn.apache.org/r1855993])

> HTTP service may not select correct media type if multiple are specified in Accept header field
> -----------------------------------------------------------------------------------------------
>
>                 Key: OAK-8135
>                 URL: https://issues.apache.org/jira/browse/OAK-8135
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: oak-http
>            Reporter: Henry Saginor
>            Assignee: Julian Reschke
>            Priority: Minor
>              Labels: candidate_oak_1_8
>             Fix For: 1.12.0, 1.10.3
>
>         Attachments: MediaRange.patch, OAK-8135.diff
>
>
> Steps to reproduce:
>  With HTTPie
> {code:java}
> > http -j -b -a admin:admin localhost:8080{code}
> or with cUrl
> {code:java}
> > curl -u admin:admin http://localhost:8080 --header "Accept: application/json, */*"{code}
> In both of the above cases http service selects the first available representation (aka HTML) based on "**/**" instead of more specific JSON.
> I think one possible fix is to by default assign higher weight to more specific mime types when Accept header is parsed in org.apache.jackrabbit.oak.http.MediaRange.parse
> For example replacing return statement in above method with the following fixed this bug in my testing:
> {code:java}
> double defaultQ = 3.0;
> if("*/*".equals(type.getType())) {
>     defaultQ = 1.0;
> } else if("*".equals(type.getSubtype())) {
>     defaultQ = 2.0;
> }
>         
> return new MediaRange(type, defaultQ);
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)