anchor.diff:      end.
   
   authorize(Req) ->
  -    Valid = 
  -        case Req:get_header_value("Authorization") of
  -            "Basic " ++ Token ->
  -                os:getenv("LOGPLEX_AUTH_KEY") == (catch binary_to_list(base64:decode(Token)));
  -            _ ->
  -                false
  -        end,
  -    if 
  -        Valid ->
  -            ok;
  -        true ->
  -            Req:respond({401, [{"Content-Type", "text/html"}], "Not Authorized"})
  -    end,
  -    Valid.
  +    AuthKey = os:getenv("LOGPLEX_AUTH_KEY"),
  +    case Req:get_header_value("Authorization") of
  +	AuthKey ->
  +	    true;
  +        _ ->
  +            Req:respond({401, [{"Content-Type", "text/html"}], "Not Authorized"}),
  +	    throw(normal)
  +    end.
   
   error_resp(Req, RespCode, Body) ->
       Req:respond({RespCode, [{"Content-Type", "text/html"}], Body}),
  
positive.code:     end},
  
      {['POST', "/sessions"], fun(Req, _Match) ->
          Body = Req:recv_body(),
          Session = logplex_session:create(Body),
          not is_binary(Session) andalso error_resp(Req, 500, <<"failed to create session">>),
  
negative.code:                 undefined -> 20;
                  BinNum -> list_to_integer(binary_to_list(BinNum))
              end,
          Num = ternary(Filters == [], Num0 - 1, -1),
  
          logplex_stats:incr(session_accessed),
  
  