Github user olafura commented on the pull request:
https://github.com/apache/couchdb/pull/284#issuecomment-63244440
kxepal, when I look at the old code then I see that the initial commit sort
of worked. Then people added more to it so it broke completely. Mochi's
accepts_content_type does everything correct but the problem is that the json
check is before the html check and all web browsers promise to support
basically everything with the q argument, so we get json when we should be
getting a redirect. So yes it's a rollback but not just of one commit but many
commits, that have tried to get the initial state back.
One thing to look at is maybe the default behaviour when not having accept
should be json, but we would have to change that in both places.
I have a patch where I do this, instead of accepts_content_type:
check_header(MochiReq:get_header_value("Accept"), "application/json")
check_header(MochiReq:get_header_value("Accept"), "text/html")
check_header(undefined,_) ->
false;
check_header(Header, Value) ->
case string:str(Header, Value) of
0 ->
false;
_ ->
true
end.
But the problem might be the xhtml browsers. The most important thing is
that it's consistent in both couch_httpd and couch_chttpd
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---