25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Do not overwrite the stanza namespace (thanks to Anastasia Gornostaeva)

SVN Revision: 2292
This commit is contained in:
Badlop 2009-06-16 18:25:46 +00:00
parent 818f28d85f
commit 86738e965f

View File

@ -4,12 +4,12 @@
%%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as %%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as
%%% HTTP Binding) %%% HTTP Binding)
%%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de> %%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de>
%%% Id : $Id: ejabberd_http_bind.erl 405 2007-11-02 14:58:36Z mremond $ %%% Id : $Id: ejabberd_http_bind.erl 408 2007-11-08 15:48:24Z badlop $
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
-module(ejabberd_http_bind). -module(ejabberd_http_bind).
-author('steve@zeank.in-berlin.de'). -author('steve@zeank.in-berlin.de').
-vsn('$Rev: 405 $'). -vsn('$Rev: 408 $').
-behaviour(gen_fsm). -behaviour(gen_fsm).
@ -748,8 +748,7 @@ send_outpacket(#http_bind{pid = FsmRef}, OutPacket) ->
of of
El when element(1, El) == xmlelement -> El when element(1, El) == xmlelement ->
{xmlelement, _, _, OEls} = El, {xmlelement, _, _, OEls} = El,
TypedEls = [xml:replace_tag_attr("xmlns", TypedEls = [check_default_xmlns(OEl) ||
?NS_CLIENT,OEl) ||
OEl <- OEls], OEl <- OEls],
?DEBUG(" --- outgoing data --- ~n~s~n --- END --- ~n", ?DEBUG(" --- outgoing data --- ~n~s~n --- END --- ~n",
[xml:element_to_string( [xml:element_to_string(
@ -778,10 +777,8 @@ send_outpacket(#http_bind{pid = FsmRef}, OutPacket) ->
StreamAttribs, StreamEls} | StreamAttribs, StreamEls} |
StreamTail] -> StreamTail] ->
TypedTail = TypedTail =
[xml:replace_tag_attr( [check_default_xmlns(OEl) ||
"xmlns", OEl <- StreamTail],
?NS_CLIENT,OEl) ||
OEl <- StreamTail],
[{xmlelement, [{xmlelement,
"stream:features", "stream:features",
[{"xmlns:stream", [{"xmlns:stream",
@ -917,3 +914,12 @@ remove_tag_attr(Attr, El) ->
_ -> _ ->
El El
end. end.
check_default_xmlns({xmlelement, Name, Attrs, Els} = El) ->
EXmlns = xml:get_tag_attr_s("xmlns", El),
if
EXmlns == "" ->
{xmlelement, Name, [{"xmlns", ?NS_CLIENT} | Attrs], Els};
true ->
El
end.