anchor.diff:      end.
   
   handle_auth(ARG, _Auth_H, #auth{realm = Realm, 
  -                                users=[], pam=false, mod = []}) ->
  +                                users=[], pam=false, mod = []}, Ret) ->
       maybe_auth_log({401, Realm}, ARG),
  -    false;
  -
  -handle_auth(ARG, Auth_H, Auth_methods = #auth{mod = Mod}) when Mod /= [] ->
  +    Ret;
  +
  +handle_auth(ARG, Auth_H, Auth_methods = #auth{mod = Mod}, Ret) when Mod /= [] ->
       case catch Mod:auth(ARG, Auth_methods) of
   	{'EXIT', _Reason} ->
               L = ?F("authmod crashed ~n~p:auth(~p, ~n ~p) \n"
  
positive.code: 
  %% Return values:
  %% continue, done, {page, Page}
  handle_ut(CliSock, ARG, UT = #urltype{type = unauthorized}, N) ->
      Req = ARG#arg.req,
      H = ARG#arg.headers,
      SC = get(sc),
      yaws:outh_set_dyn_headers(Req, H, UT),
  
      %% outh_set_dyn headers sets status to 200 by default
      %% so we need to set it 401
      yaws:outh_set_status_code(401),
      Outmod = get_unauthorized_outmod(UT#urltype.path, SC#sconf.authdirs, 
                                       SC#sconf.errormod_401),
  
      deliver_dyn_part(CliSock,
  		     0,
  		     "appmod",
  		     N,
  		     ARG,
  		     UT,
  		     fun(A)->Outmod:out(A)
  		     end,
  		     fun(A)->finish_up_dyn_file(A, CliSock)
  		     end);
  
  handle_ut(CliSock, ARG, UT = #urltype{type = error}, N) ->
      Req = ARG#arg.req,
      H = ARG#arg.headers,
      SC=get(sc),GC=get(gc),
      case UT#urltype.type of
          error when SC#sconf.xtra_docroots == [] ->
              yaws:outh_set_dyn_headers(Req, H, UT),
              deliver_dyn_part(CliSock, 
                               0, "404",
                               N,
                               ARG,UT,
                               fun(A)->(SC#sconf.errormod_404):
                                           out404(A,GC,SC) 
                               end,
                               fun(A)->finish_up_dyn_file(A, CliSock)
                               end
                              );
          error ->
              SC2 = SC#sconf{docroot = hd(SC#sconf.xtra_docroots),
                             xtra_docroots = tl(SC#sconf.xtra_docroots)},
              put(sc, SC2),
              
              %%!todo - review & change. rewriting the docroot and xtra_docroots
              %% is not a good way to handle the xtra_docroot feature because
              %% it makes less information available to the subsequent calls - 
              %% this is especially an issue for a nested ssi.
              ARG2 = ARG#arg{docroot = SC2#sconf.docroot},
              handle_request(CliSock, ARG2, N)
      end;
  
  
  handle_ut(CliSock, ARG, UT = #urltype{type = directory}, N) ->
      Req = ARG#arg.req,
      H = ARG#arg.headers,
      SC=get(sc),
  
      if (?sc_has_dir_listings(SC)) ->
              Directory_allowed = ['GET', 'HEAD', 'OPTIONS'],
              if
                  Req#http_request.method == 'GET';
                  Req#http_request.method == 'HEAD' ->
                      yaws:outh_set_dyn_headers(Req, H, UT),
                      P = UT#urltype.fullpath,  
                      yaws_ls:list_directory(ARG, CliSock, UT#urltype.data, 
                                             P, Req,
                                             ?sc_has_dir_all_zip(SC));
                  Req#http_request.method == 'OPTIONS' ->
                      deliver_options(CliSock, Req, Directory_allowed);
                  true ->
                      deliver_405(CliSock, Req, Directory_allowed)
              end;
         true ->
              handle_ut(CliSock, ARG, #urltype{type = error}, N)
      end;
  
  handle_ut(CliSock, ARG, UT = #urltype{type = regular}, _N) ->
      Req = ARG#arg.req,
  
negative.code:         case H#headers.authorization of
              {_User, Pass, Orig} ->
                  {User, Pass, Orig};
              undefined ->
                  {User, undefined, undefined};
              E ->
                  E
          end,
  