25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

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

SVN Revision: 2229
This commit is contained in:
Badlop 2009-06-16 17:46:03 +00:00
parent 4a83538cf6
commit b42dd00a53

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,9 +777,7 @@ send_outpacket(#http_bind{pid = FsmRef}, OutPacket) ->
StreamAttribs, StreamEls} | StreamAttribs, StreamEls} |
StreamTail] -> StreamTail] ->
TypedTail = TypedTail =
[xml:replace_tag_attr( [check_default_xmlns(OEl) ||
"xmlns",
?NS_CLIENT,OEl) ||
OEl <- StreamTail], OEl <- StreamTail],
[{xmlelement, [{xmlelement,
"stream:features", "stream:features",
@ -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.