From 110819525f52b09d16a58b6b81ac3e0163df763f Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 10 May 2010 13:56:58 +0200 Subject: [PATCH] Partially revert "Fix more HTTP-Bind", add proper fix: c2s works again, BOSH not yet --- src/ejabberd_c2s.erl | 4 ++-- src/web/ejabberd_http_bind.erl | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 1bb7dd950..195492268 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -265,8 +265,8 @@ wait_for_stream({xmlstreamstart, #xmlel{ns = NS} = Opening}, StateData) -> end, Header = exmpp_stream:opening_reply(Opening, StateData#state.streamid, DefaultLang), - case exmpp_xml:get_attribute_as_binary(Opening, 'xmlns:stream', undefined_stream_namespace) of - ?NS_XMPP_b -> + case NS of + ?NS_XMPP -> ServerB = exmpp_stringprep:nameprep( exmpp_stream:get_receiving_entity(Opening)), Server = binary_to_list(ServerB), diff --git a/src/web/ejabberd_http_bind.erl b/src/web/ejabberd_http_bind.erl index 7ef8538d5..e2e191607 100644 --- a/src/web/ejabberd_http_bind.erl +++ b/src/web/ejabberd_http_bind.erl @@ -684,17 +684,21 @@ process_http_put(#http_put{rid = Rid, attrs = Attrs, payload = Payload, C2SPid -> case StreamTo of {To, ""} -> - StreamAttrs = [#xmlattr{name = 'to', value = list_to_binary(To)}, - #xmlattr{name = 'xmlns:stream', value = ?NS_XMPP_b}], - StreamEl = #xmlel{name = 'stream:stream', ns = ?NS_JABBER_CLIENT_b, attrs = StreamAttrs}, + DecNs = [{?NS_XMPP, "stream"}, + {?NS_JABBER_CLIENT, none}], + StreamAttrs = [#xmlattr{name = 'to', value = list_to_binary(To)}], + StreamEl = #xmlel{name = stream, ns = ?NS_XMPP, declared_ns = DecNs, + attrs = StreamAttrs}, gen_fsm:send_event( C2SPid, {xmlstreamstart, StreamEl}); {To, Version} -> + DecNs = [{?NS_XMPP, "stream"}, + {?NS_JABBER_CLIENT, none}], StreamAttrs = [#xmlattr{name = 'to', value = list_to_binary(To)}, - #xmlattr{name = 'version', value = list_to_binary(Version)}, - #xmlattr{name = 'xmlns:stream', value = ?NS_XMPP_b}], - StreamEl = #xmlel{name = 'stream:stream', ns = ?NS_JABBER_CLIENT_b, attrs = StreamAttrs}, + #xmlattr{name = 'version', value = list_to_binary(Version)}], + StreamEl = #xmlel{name = stream, ns = ?NS_XMPP, declared_ns = DecNs, + attrs = StreamAttrs}, gen_fsm:send_event( C2SPid, {xmlstreamstart, StreamEl});