couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Kocoloski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-2034) authentication_handlers does not accept complex arguments
Date Sun, 26 Jan 2014 00:47:45 GMT

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

Adam Kocoloski commented on COUCHDB-2034:
-----------------------------------------

You're quite right [~danielmoore]; I came to the same realization the morning after I left
this edit but never noted it on the ticket. I still think it would be preferable to have explicit
labels and separate out the definitions, so e.g.

{code}
[httpd]
authentication_handlers = my_auth, basic, cookie, oauth

[httpd.authentication_handlers]
basic  = {couch_httpd_auth, default_authentication_handler}
cookie = {couch_httpd_auth, cookie_authentication_handler}
oauth = {couch_httpd_oauth, oauth_authentication_handler}
my_auth = {my_mod, my_fun, [ { one, two }, { three, four } ] }
{code}

which has the advantage of being backwards compatible with current syntax if we want it to
be.

> authentication_handlers does not accept complex arguments
> ---------------------------------------------------------
>
>                 Key: COUCHDB-2034
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2034
>             Project: CouchDB
>          Issue Type: Bug
>            Reporter: Daniel Moore
>            Assignee: Adam Kocoloski
>
> I have written a custom authentication handler for couch, but when I use the "SpecArg"
syntax with embedded tuples, I get parse errors spinning up the server. For instance, a config
like:
> {code}
> [httpd]
> authentication_handlers = {my_mod, my_fun, [ { one, two }, { three, four } ] }
> {code}
> Gives:
> {code}
> [error] [<0.93.0>] {error_report,<0.30.0>,
>                     {<0.93.0>,supervisor_report,
>                      [{supervisor,{local,couch_secondary_services}},
>                       {errorContext,start_error},
>                       {reason,
>                        {'EXIT',
>                         {{case_clause,
>                           {error,
>                            {1,erl_parse,["syntax error before: ","'.'"]}}},
>                          [{couch_httpd,make_arity_1_fun,1,
>                            [{file,"couch_httpd.erl"},{line,200}]},
>                           {couch_httpd,'-set_auth_handlers/0-fun-0-',1,
>                            [{file,"couch_httpd.erl"},{line,194}]},
>                           {lists,map,2,[{file,"lists.erl"},{line,1224}]},
>                           {couch_httpd,set_auth_handlers,0,
>                            [{file,"couch_httpd.erl"},{line,193}]},
>                           {couch_httpd,start_link,2,
>                            [{file,"couch_httpd.erl"},{line,130}]},
>                           {supervisor,do_start_child,2,
>                            [{file,"supervisor.erl"},{line,310}]},
>                           {supervisor,start_children,3,
>                            [{file,"supervisor.erl"},{line,293}]},
>                           {supervisor,init_children,2,
>                            [{file,"supervisor.erl"},{line,259}]}]}}},
>                       {offender,
>                        [{pid,undefined},
>                         {name,httpd},
>                         {mfargs,{couch_httpd,start_link,[]}},
>                         {restart_type,permanent},
>                         {shutdown,brutal_kill},
>                         {child_type,worker}]}]}}
> {code}
> This seems to be as a result of [using a regex|https://github.com/apache/couchdb/blob/master/src/couchdb/couch_httpd.erl?source=c#L224-L225]
to split the tuples. Perhaps we could change the strategy to wrapping the string with "\["
and "\]" and parsing it altogether?



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message