You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2010/12/16 22:18:45 UTC

svn commit: r1050163 - /couchdb/trunk/src/couchdb/couch_httpd_auth.erl

Author: fdmanana
Date: Thu Dec 16 21:18:42 2010
New Revision: 1050163

URL: http://svn.apache.org/viewvc?rev=1050163&view=rev
Log:
Removed duplicated function

An equivalent exists (couch_util:to_integer/1), but for this particular case it's not needed.

Modified:
    couchdb/trunk/src/couchdb/couch_httpd_auth.erl

Modified: couchdb/trunk/src/couchdb/couch_httpd_auth.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_auth.erl?rev=1050163&r1=1050162&r2=1050163&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_auth.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_auth.erl Thu Dec 16 21:18:42 2010
@@ -184,7 +184,8 @@ cookie_authentication_handler(#httpd{moc
                 FullSecret = <<Secret/binary, UserSalt/binary>>,
                 ExpectedHash = crypto:sha_mac(FullSecret, User ++ ":" ++ TimeStr),
                 Hash = ?l2b(string:join(HashParts, ":")),
-                Timeout = to_int(couch_config:get("couch_httpd_auth", "timeout", 600)),
+                Timeout = list_to_integer(
+                    couch_config:get("couch_httpd_auth", "timeout", "600")),
                 ?LOG_DEBUG("timeout ~p", [Timeout]),
                 case (catch erlang:list_to_integer(TimeStr, 16)) of
                     TimeStamp when CurrentTime < TimeStamp + Timeout ->
@@ -341,13 +342,6 @@ auth_name(String) when is_list(String) -
     [_,_,_,_,_,Name|_] = re:split(String, "[\\W_]", [{return, list}]),
     ?l2b(Name).
 
-to_int(Value) when is_binary(Value) ->
-    to_int(?b2l(Value));
-to_int(Value) when is_list(Value) ->
-    list_to_integer(Value);
-to_int(Value) when is_integer(Value) ->
-    Value.
-
 make_cookie_time() ->
     {NowMS, NowS, _} = erlang:now(),
     NowMS * 1000000 + NowS.