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/03/21 11:09:00 UTC

[jira] [Assigned] (OAK-8135) Oak http service may not select correct mime type if multiple are specified in Accept header

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

Julian Reschke reassigned OAK-8135:
-----------------------------------

    Assignee: Julian Reschke

> Oak http service may not select correct mime type if multiple are specified in Accept header
> --------------------------------------------------------------------------------------------
>
>                 Key: OAK-8135
>                 URL: https://issues.apache.org/jira/browse/OAK-8135
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>            Reporter: Henry Saginor
>            Assignee: Julian Reschke
>            Priority: Major
>         Attachments: MediaRange.patch
>
>
> 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)