* src/Makefile.in: Likewise.
* src/configure.ac: Likewise.
SVN Revision: 849
+2007-07-31 Mickael Remond <mickael.remond@process-one.net>
+
+ * src/xml.erl: Making use of CDATA escaping optional through with
+ a compile time option (EJAB-298).
+ * src/Makefile.in: Likewise.
+ * src/configure.ac: Likewise.
+
2007-07-31 Alexey Shchepin <alexey@sevcom.net>
* src/mod_version.erl: Added option to hide OS version (thanks to
ERLC_FLAGS+=-DROSTER_GATEWAY_WORKAROUND
endif
+ifeq (@full_xml@, true)
+ ERLC_FLAGS+=-DFULL_XML_SUPPORT
+endif
+
prefix = @prefix@
SUBDIRS = @mod_irc@ @mod_pubsub@ @mod_muc@ @mod_proxy65@ @eldap@ @web@ stringprep @tls@ @odbc@ @ejabberd_zlib@
#endif"
ac_default_prefix=/
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE ERLC ac_pt_ERLC ERL ac_pt_ERL ERLANG_CFLAGS ERLANG_LIBS LIBICONV CPP EGREP EXPAT_CFLAGS EXPAT_LIBS ZLIB_CFLAGS ZLIB_LIBS LIBOBJS mod_pubsub make_mod_pubsub mod_irc make_mod_irc mod_muc make_mod_muc mod_proxy65 make_mod_proxy65 eldap make_eldap web make_web tls make_tls odbc make_odbc ejabberd_zlib make_ejabberd_zlib roster_gateway_workaround db_type SSL_LIBS SSL_CFLAGS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE ERLC ac_pt_ERLC ERL ac_pt_ERL ERLANG_CFLAGS ERLANG_LIBS LIBICONV CPP EGREP EXPAT_CFLAGS EXPAT_LIBS ZLIB_CFLAGS ZLIB_LIBS LIBOBJS mod_pubsub make_mod_pubsub mod_irc make_mod_irc mod_muc make_mod_muc mod_proxy65 make_mod_proxy65 eldap make_eldap web make_web tls make_tls odbc make_odbc ejabberd_zlib make_ejabberd_zlib roster_gateway_workaround db_type full_xml SSL_LIBS SSL_CFLAGS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
--enable-ejabberd_zlib enable ejabberd_zlib (default: yes)
--enable-roster-gateway-workaround Turn on workaround for processing gateway subscriptions (default: no)
--enable-mssql Use Microsoft SQL Server database (default: no, requires --enable-odbc)
+ --enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
fi;
+# Check whether --enable-full_xml or --disable-full_xml was given.
+if test "${enable_full_xml+set}" = set; then
+ enableval="$enable_full_xml"
+ case "${enableval}" in
+ yes) full_xml=true ;;
+ no) full_xml=false ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-full-xml" >&5
+echo "$as_me: error: bad value ${enableval} for --enable-full-xml" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ full_xml=false
+fi;
+
+
ac_config_files="$ac_config_files Makefile $make_mod_irc $make_mod_muc $make_mod_pubsub $make_mod_proxy65 $make_eldap $make_web stringprep/Makefile $make_tls $make_odbc $make_ejabberd_zlib"
#openssl
s,@make_ejabberd_zlib@,$make_ejabberd_zlib,;t t
s,@roster_gateway_workaround@,$roster_gateway_workaround,;t t
s,@db_type@,$db_type,;t t
+s,@full_xml@,$full_xml,;t t
s,@SSL_LIBS@,$SSL_LIBS,;t t
s,@SSL_CFLAGS@,$SSL_CFLAGS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
esac],[db_type=generic])
AC_SUBST(db_type)
+AC_ARG_ENABLE(full_xml,
+[ --enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)],
+[case "${enableval}" in
+ yes) full_xml=true ;;
+ no) full_xml=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-full-xml) ;;
+esac],[full_xml=false])
+AC_SUBST(full_xml)
+
AC_CONFIG_FILES([Makefile
$make_mod_irc
$make_mod_muc
-vsn('$Revision$ ').
-export([element_to_string/1,
- crypt/1,
+ crypt/1, make_text_node/1,
remove_cdata/1,
get_cdata/1, get_tag_cdata/1,
get_attr/2, get_attr_s/2,
get_path_s/2,
replace_tag_attr/3]).
+%% Select at compile time how to escape characters in binary text
+%% nodes.
+%% Can be choosen with ./configure --enable-full-xml
+-ifdef(FULL_XML_SUPPORT).
+-define(ESCAPE_BINARY(CData), make_text_node(CData)).
+-else.
+-define(ESCAPE_BINARY(CData), crypt(CData)).
+-endif.
+
element_to_string(El) ->
case El of
{xmlelement, Name, Attrs, Els} ->
[$<, Name, attrs_to_list(Attrs), $/, $>]
end;
%% We do not crypt CDATA binary, but we enclose it in XML CDATA
- {xmlcdata, CData}
- when binary(CData) ->
- make_text_node(CData);
- %% We crypt list and short binaries (implies a conversion to
- %% list).
+ {xmlcdata, CData} when binary(CData) ->
+ ?ESCAPE_BINARY(CData);
+ %% We crypt list and possibly binaries if full XML usage is
+ %% disabled unsupported (implies a conversion to list).
{xmlcdata, CData} ->
crypt(CData)
end.
[$\s, crypt(Name), $=, $', crypt(Value), $'].
crypt(S) when is_list(S) ->
+ io:format("MREMOND crypt~n",[]),
[case C of
$& -> "&";
$< -> "<";
%% Make a cdata_binary depending on what characters it contains
make_text_node(CData) ->
+ io:format("MREMOND CDATA~n",[]),
case cdata_need_escape(CData) of
cdata ->
CDATA1 = <<"<![CDATA[">>,