Permalink
Browse files

replace json.erl with json2.erl to fix issue 50

Yaws issue 50 (#50) notes that
the json.erl module uses list_to_atom and is therefore dangerous due
to the possibility of filling the atom table. Also, the test function
in json.erl has been broken for quite some time. Deprecate json.erl
and add json2.erl, which avoids list_to_atom. Repair the json2:test/0
function inherited from json.erl and add it to the t1 test
suite. Change www/json_intro.yaws to refer to json2.
  • Loading branch information...
vinoski committed Apr 24, 2011
1 parent 5d8fd4a commit 96534b2e9b274e71f92f338e5c07e3d2912bd45f
Showing with 743 additions and 14 deletions.
  1. +1 −1 src/Makefile
  2. +20 −0 src/json.erl
  3. +705 −0 src/json2.erl
  4. +4 −4 src/jsonrpc.erl
  5. +2 −2 src/yaws_jsonrpc.erl
  6. +3 −3 src/yaws_rpc.erl
  7. +6 −2 test/t1/Makefile
  8. +2 −2 www/json_intro.yaws
View
@@ -41,7 +41,7 @@ MODULES=yaws \
yaws_rss \
yaws_dav \
yaws_pam \
- json jsonrpc yaws_jsonrpc yaws_xmlrpc\
+ json json2 jsonrpc yaws_jsonrpc yaws_xmlrpc\
haxe yaws_rpc \
yaws_soap_srv yaws_soap_lib \
authmod_gssapi \
View
@@ -1,3 +1,22 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED
+%%% WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED
+%%%
+%%% Use module json2.erl instead
+%%%
+%%% This module is deprecated. It uses list_to_atom and so could potentially
+%%% fill the atom table. It also fails to pass its own internal tests due to
+%%% changes made years ago outside the context of Yaws.
+%%%
+%%% Do not report problems with this module, as they will not be fixed. You
+%%% should instead convert your code to use the json2 module.
+%%%
+%%% WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED
+%%% WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
%(%% Copyright (c) 2005-2006, A2Z Development USA, Inc. All Rights Reserved.
%%%
%%% The contents of this file are subject to the Erlang Public License,
@@ -15,6 +34,7 @@
%%% All Rights Reserved.
-module(json).
+-deprecated(module).
-export([encode/1, decode_string/1, decode/2]).
-export([is_obj/1, obj_new/0, obj_fetch/2, obj_find/2, obj_is_key/2]).
-export([obj_store/3, obj_from_list/1, obj_fold/3]).
Oops, something went wrong.

0 comments on commit 96534b2

Please sign in to comment.