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

Fix for 'terminate' in request, send empty body instead of error (thanks to Stefan Strigler)

SVN Revision: 2278
This commit is contained in:
Badlop 2009-06-16 18:24:50 +00:00
parent 80b59441d5
commit b79473b2f5

View File

@ -3,12 +3,12 @@
%%% Author : Stefan Strigler <steve@zeank.in-berlin.de> %%% Author : Stefan Strigler <steve@zeank.in-berlin.de>
%%% Purpose : HTTP Binding support (JEP-0124) %%% Purpose : HTTP Binding support (JEP-0124)
%%% 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 241 2007-08-03 12:13:13Z sstrigler $ %%% Id : $Id: ejabberd_http_bind.erl 243 2007-08-03 13:48:49Z sstrigler $
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
-module(ejabberd_http_bind). -module(ejabberd_http_bind).
-author('steve@zeank.in-berlin.de'). -author('steve@zeank.in-berlin.de').
-vsn('$Rev: 241 $'). -vsn('$Rev: 243 $').
-behaviour(gen_fsm). -behaviour(gen_fsm).
@ -226,8 +226,13 @@ receive_loop(Sid, Rid, Wait, Hold, Attrs, StreamStart) ->
prepare_response(Sid, Rid, Wait, Hold, Attrs, StreamStart) -> prepare_response(Sid, Rid, Wait, Hold, Attrs, StreamStart) ->
case http_get(Sid, Rid) of case http_get(Sid, Rid) of
{error, not_exists} -> {error, not_exists} ->
?DEBUG("no session associated with sid: ~s", [Sid]), case xml:get_attr_s("type", Attrs) of
{404, ?HEADER, ""}; "terminate" ->
{200, ?HEADER, "<body xmlns='http://jabber.org/protocol/httpbind'/>"};
_ ->
?DEBUG("no session associated with sid: ~s", [Sid]),
{404, ?HEADER, ""}
end;
{ok, keep_on_hold} -> {ok, keep_on_hold} ->
receive_loop(Sid, Rid, Wait, Hold, Attrs, StreamStart); receive_loop(Sid, Rid, Wait, Hold, Attrs, StreamStart);
{ok, cancel} -> {ok, cancel} ->