From: Claes W. <kl...@ta...> - 2010-02-11 22:52:17
|
Tino Breddin wrote: > Hi all, > > I'm trying to use http authentication for a simple website. The > configuration looks like the following: > > <server localhost> > port = 7777 > listen = 0.0.0.0 > allowed_scripts = cgi > docroot = /var/www > <auth> > dir = / > realm = foobar > </auth> > </server> > > The directory /var/www contains a file .yaws_auth which has entries like > the following: > > {"testuser", "mypw"}. Had a look at this - I feel that auth is the part of yaws that the least documented and also cared for. Anyway, and I'm not sure when, but .yaws_auth authentication seems to have become broken. diff --git a/src/yaws_config.erl b/src/yaws_config.erl index ea492ef..df06c85 100644 --- a/src/yaws_config.erl +++ b/src/yaws_config.erl @@ -117,8 +117,10 @@ load_yaws_auth_from_docroot(Docroot) -> SP = string:sub_string(Path, length(Docroot)+1), Dir = filename:dirname(SP), case load_yaws_auth_file(Path, #auth{dir = [Dir]}) of - {ok, Auth} -> [Auth| Acc]; - _ -> Acc + Auth when is_record(Auth, auth) -> + [Auth| Acc]; + _Other -> + Acc end end, filelib:fold_files(Docroot, "^.yaws_auth$", true, Fun, []). Is the fix, I've checked this in, and since it's a really boring bug, I guess it's time for a little intermediary release. Thanks for reporting /klacke |