[
https://issues.apache.org/jira/browse/COUCHDB-472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896556#action_12896556
]
Filipe Manana commented on COUCHDB-472:
---------------------------------------
Hi Benoit,
Shouldn't the web page be served only if the client accepts text/html? The
patch seems to send the page when the client doesn't explicitely list
"application/json" as acceptable.
Also, there's something missing when parsing the Accept header.
You grab its value and then split it based on commas. But the Accept header can
be a Q values list.
If you have "Accept: application/json; q = 0.5, *; q = 0.3", your code will
serve the html page anyway, ignoring the q = 0.5.
Look at http://github.com/mochi/mochiweb/blob/master/src/mochiweb_util.erl#L416
for parsing a Q values list.
> handle custom CouchdDB welcome page
> -----------------------------------
>
> Key: COUCHDB-472
> URL: https://issues.apache.org/jira/browse/COUCHDB-472
> Project: CouchDB
> Issue Type: Improvement
> Affects Versions: 0.10
> Reporter: Benoit Chesneau
> Assignee: Benoit Chesneau
> Fix For: 0.12
>
> Attachments: COUCHDB-472-2.patch, COUCHDB-472.patch,
> couchdb_welcome.patch, couchdb_welcome2.patch, couchdb_welcome3.patch,
> screenshot.png, Welcome page screenshot.jpg
>
>
> This change modify behaviour of Welcome handler by allowing admin to
> customize the welcome page. If content is "application/json" it will send
> current json object, if not, it will send an html page or redirect to another
> path.
> This patch change the confugration string to a tupple {WelcomeMsg,
> WelcomePage}. WelcomePage could be a string for DocumentRoot where it will
> find welcome.html page or a tupple {redirect, Url}
> Ex if in config you have:
> / = {couch_httpd_misc_handlers, handle_welcome_req, {<<"Welcome">>,
> "/usr/local/share/couchdb/www"}}
> If Accept content is application/json Couchdb will send :
> "couchdb":"Welcome","version":"0.10.0a"}
> If other it will send welcome.html.
> if you replace "/usr/local/share/couchdb/www" by {redirect,
> <<"/_utils">>} user will be redirected on futon.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.