Commit:d5676b22c92b6f69bfe86ba0017d91663ab14f95
solve the problem
======= le 19/09/2009, 17:21:27 vous écriviez: =======
>My proposition to solve this issue (maybe it's not an issue, leet me see if I am wrong, maybe I need to sleep :+) ) is not correct.
>
>What I understand is :
>
>-> when you load a yaws configuration file, yaws_config:fload/8 set a list
>of #auth records in #sconf. authdirs
>
>-> when you call load_yaws_auth_file/3 , #sconf.authdirs takes the function result which is a list of tuples {Dir,#auth}
>
>
>If you decide to set manually your #sconf records in embedded mode what you should set in your #sconf.authdirs ?
>A list of #auth records (like a configure file load) or a tuples list {Directory,#auth} ?
>
>On the other hand, the function yaws:make_www_authenticate_header/1 is called when yaws load a configuration file or when parse_yaws_auth_file/2 is called and with a "yaws_auth" file in your directory. In embedded mode, I suppose that we have to set manually and completely the headers field, even the default www_authenticate_header. But if we have a "yaws_auth" file in our directory, www_authenticate_header will be set twice, isn't it ?
>
>
>For the moment, I changed the yaws_config:load_yaws_auth_file/3 :
>
>
>load_yaws_auth_file(_SC, [], Acc) ->
> Acc;
>
>
>% handle the case where we have a tuple {Dir,#auth} in #sconf.authdirs :
>load_yaws_auth_file(SC,[{_Dir,Auth}|T],Acc)->
> load_yaws_auth_file(SC,[Auth|T],Acc);
>
>
>load_yaws_auth_file(SC, [A|T], Acc) ->
>
> [Dir] = A#auth.dir,
> FN0=[SC#sconf.docroot, [$/|Dir], [$/|".yaws_auth"]],
> FN1 = remove_multiple_slash(lists:flatten(FN0)),
>
> A2 = case file:consult(FN1) of
> {ok, TermList} ->
> error_logger:info_msg("Reading .yaws_auth ~s~n",[FN1]),
> Auth = parse_yaws_auth_file(TermList, A),
> [Dir1] = Auth#auth.dir,
> {Dir1, Auth};
> {error, enoent} ->
> {Dir, A};
> _Err ->
> error_logger:format("Bad .yaws_auth file in dir ~p~n",
> [Dir]),
> {Dir, A}
> end,
> load_yaws_auth_file(SC, T, [A2|Acc]).
>
>
>let me know where are my mistakes, maybe I don't use correctly the function yaws_api:setconf(GC, Groups).
>
>
>
>thank you
>
>
>wde
>
>
>
>
>
>
>
>
>======= le 19/09/2009, 09:11:57 vous écriviez: =======
>
>>Hello all,
>>
>>After an upgrade from 1.81 to 1.84 in current git repository (last commit : 0efd59)
>>I got the following error :
>>
>>** exception error: {badrecord,auth}
>> in function yaws_config:load_yaws_auth_file/3
>> in call from yaws_config:setup_auth/1
>> in call from yaws_config:'-add_yaws_auth/1-fun-0-'/1
>> in call from lists:map/2
>> in call from yaws_api:setconf/3
>>
>>
>>I tried to understand the difference between 1.81 and 1.84 about www-authenticate management. I added comments in the code :
>>
>>In the yaws_config.erl module :
>>
>>
>>add_yaws_auth(SCs) ->
>> lists:map(
>> fun(SC) ->
>> SC#sconf{authdirs = setup_auth(SC)}
>> end, SCs).
>>
>>
>>
>>setup_auth(SC) ->
>> Auth_dirs0 = get_yaws_auth_dirs(SC#sconf.docroot),
>>
>> Auth_dirs1 = [#auth{dir = [X]} || X <- Auth_dirs0],
>>
>> % So we add the previous authdirs from SC to a list of #auth
>> Auth_dirs2 = Auth_dirs1 ++ SC#sconf.authdirs,
>>
>> %load_yaws_auth_file return a list of tuple : {Dir,#auth}
>> Auth_dirs3 = load_yaws_auth_file(SC, Auth_dirs2, []),
>>
>> start_pam(Auth_dirs3),
>>
>> % The result will set the authdirs field from the given SC
>> Auth_dirs3.
>>
>>
>>
>>
>>
>>load_yaws_auth_file/3 always wait for a list of #auth as second argument
>>but if we call this function many times (maybe in embedded mode) we pass to load_yaws_auth_file/3
>>a list composed of #auth and tuple {Dir,#auth}.
>>
>>
>>
>>A solution could be to replace in setup_auth/1 in yaws_config.erl module :
>>
>>Auth_dirs2 = Auth_dirs1 ++ SC#sconf.authdirs,
>>
>>by
>>
>>Auth_dirs2 = Auth_dirs1 ++ [ A || {_Dir,A} <- SC#sconf.authdirs],
>>
>>
>>
>>Thank you for your help,
>>
>>
>>wde
>>
>>
>>
>>
>>
>>------------------------------------------------------------------------------
>>Come build with us! The BlackBerry® Developer Conference in SF, CA
>>is the only developer event you need to attend this year. Jumpstart your
>>developing skills, take BlackBerry mobile applications to market and stay
>>ahead of the curve. Join us from November 9-12, 2009. Register now!
>>http://p.sf.net/sfu/devconf
>>_______________________________________________
>>Erlyaws-list mailing list
>>Erlyaws-list@...
>>https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>>
>
>= = = = = = = = = ========= = = = = = = = = = =
>
>wde
>wde@...
>19/09/2009
>
= = = = = = = = = ========= = = = = = = = = = =
wde
wde@...
29/09/2009
|