25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01: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, end,
Header = exmpp_stream:opening_reply(Opening, Header = exmpp_stream:opening_reply(Opening,
StateData#state.streamid, DefaultLang), StateData#state.streamid, DefaultLang),
case NS of case exmpp_xml:get_attribute_as_binary(Opening, 'xmlns:stream', undefined_stream_namespace) of
?NS_XMPP -> ?NS_XMPP_b ->
ServerB = exmpp_stringprep:nameprep( ServerB = exmpp_stringprep:nameprep(
exmpp_stream:get_receiving_entity(Opening)), exmpp_stream:get_receiving_entity(Opening)),
Server = binary_to_list(ServerB), Server = binary_to_list(ServerB),

View File

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