24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-18 22:15:20 +02:00

Fix more HTTP-Bind; now works with exmpp bosh_client, but not others yet.

This commit is contained in:
Badlop 2010-05-05 19:59:57 +02:00
parent 4d1dfe8914
commit 674ee7f5f6
2 changed files with 6 additions and 8 deletions

View File

@ -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 NS of
?NS_XMPP ->
case exmpp_xml:get_attribute_as_binary(Opening, 'xmlns:stream', undefined_stream_namespace) of
?NS_XMPP_b ->
ServerB = exmpp_stringprep:nameprep(
exmpp_stream:get_receiving_entity(Opening)),
Server = binary_to_list(ServerB),

View File

@ -194,7 +194,7 @@ process_request(Data, IP) ->
%% Existing session
{ok, {Sid, Rid, Attrs, Payload1}} ->
StreamStart =
case exmpp_xml:get_attribute_from_list_as_list(Attrs, "xmpp:restart", "") of
case exmpp_xml:get_attribute_from_list_as_list(Attrs, ?NS_BOSH, restart, "") of
"true" ->
true;
_ ->
@ -255,7 +255,7 @@ handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
{'EXIT', _} -> 0.0;
V -> V
end,
XmppVersion = exmpp_xml:get_attribute_from_list_as_list(Attrs, "xmpp:version", ""),
XmppVersion = exmpp_xml:get_attribute_from_list_as_list(Attrs, ?NS_BOSH, version, ""),
?DEBUG("Create session: ~p", [Sid]),
mnesia:transaction(
fun() ->
@ -688,18 +688,16 @@ process_http_put(#http_put{rid = Rid, attrs = Attrs, payload = Payload,
case StreamTo of
{To, ""} ->
StreamAttrs = [#xmlattr{name = 'to', value = list_to_binary(To)},
#xmlattr{name = 'xmlns', value = ?NS_JABBER_CLIENT_b},
#xmlattr{name = 'xmlns:stream', value = ?NS_XMPP_b}],
StreamEl = #xmlel{ns = 'stream:stream', attrs = StreamAttrs},
StreamEl = #xmlel{name = 'stream:stream', ns = ?NS_JABBER_CLIENT_b, attrs = StreamAttrs},
gen_fsm:send_event(
C2SPid,
{xmlstreamstart, StreamEl});
{To, Version} ->
StreamAttrs = [#xmlattr{name = 'to', value = list_to_binary(To)},
#xmlattr{name = 'xmlns', value = ?NS_JABBER_CLIENT_b},
#xmlattr{name = 'version', value = list_to_binary(Version)},
#xmlattr{name = 'xmlns:stream', value = ?NS_XMPP_b}],
StreamEl = #xmlel{ns = 'stream:stream', attrs = StreamAttrs},
StreamEl = #xmlel{name = 'stream:stream', ns = ?NS_JABBER_CLIENT_b, attrs = StreamAttrs},
gen_fsm:send_event(
C2SPid,
{xmlstreamstart, StreamEl});