You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2009/11/02 21:31:08 UTC

svn commit: r832091 - in /couchdb/trunk/src/couchdb: couch_httpd.erl couch_util.erl

Author: kocolosk
Date: Mon Nov  2 20:31:08 2009
New Revision: 832091

URL: http://svn.apache.org/viewvc?rev=832091&view=rev
Log:
cast string status codes (from _externals) to integers before logging. COUCHDB-551

Modified:
    couchdb/trunk/src/couchdb/couch_httpd.erl
    couchdb/trunk/src/couchdb/couch_util.erl

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=832091&r1=832090&r2=832091&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Mon Nov  2 20:31:08 2009
@@ -375,7 +375,7 @@
         Peer,
         Method,
         MochiReq:get(raw_path),
-        Code
+        couch_util:to_integer(Code)
     ]).
 
 

Modified: couchdb/trunk/src/couchdb/couch_util.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_util.erl?rev=832091&r1=832090&r2=832091&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_util.erl (original)
+++ couchdb/trunk/src/couchdb/couch_util.erl Mon Nov  2 20:31:08 2009
@@ -19,7 +19,7 @@
 -export([encodeBase64/1, decodeBase64/1, encodeBase64Url/1, decodeBase64Url/1,
     to_hex/1,parse_term/1, dict_find/3]).
 -export([file_read_size/1, get_nested_json_value/2, json_user_ctx/1]).
--export([to_binary/1, to_list/1, url_encode/1]).
+-export([to_binary/1, to_integer/1, to_list/1, url_encode/1]).
 
 -include("couch_db.hrl").
 -include_lib("kernel/include/file.hrl").
@@ -371,6 +371,13 @@
 to_binary(V) ->
     list_to_binary(io_lib:format("~p", [V])).
 
+to_integer(V) when is_integer(V) ->
+    V;
+to_integer(V) when is_list(V) ->
+    erlang:list_to_integer(V);
+to_integer(V) when is_binary(V) ->
+    erlang:list_to_integer(binary_to_list(V)).
+
 to_list(V) when is_list(V) ->
     V;
 to_list(V) when is_binary(V) ->