couchdb-dev mailing list archives

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

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

Daniel Moore commented on COUCHDB-2034:
---------------------------------------

I think that would definitely be preferable from a user standpoint. 

Looking over the existing code, though, I wonder if it'd be a huge pain in the neck to implement,
given all the change detection that's in there. It seems like you'd have to watch the {{authentication_handlers}}
config and then subscribe to the config items for each handler (and probably unsubscribe from
configs no longer used). 

> 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