From b6fd0a5ca538a50a39f48aa72f47e3c6e93f3240 Mon Sep 17 00:00:00 2001 From: Badlop Date: Sat, 21 Jun 2008 00:19:57 +0000 Subject: [PATCH] * src/web/ejabberd_http.erl: Support PUT and DELETE methods in ejabberd_http (thanks to Eric Cestari)(EJAB-662) SVN Revision: 1373 --- ChangeLog | 5 ++++- src/web/ejabberd_http.erl | 13 +++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ef86c354..5adbdd511 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2008-06-21 Badlop - * doc/guide.tex: Explain that S2S outgoing first tries IPV4 and if + * src/web/ejabberd_http.erl: Support PUT and DELETE methods in + ejabberd_http (thanks to Eric Cestari)(EJAB-662) + + * doc/guide.tex: Explain that S2S outgoing first tries IPv4 and if that fails then tries IPv6 * doc/guide.html: Likewise diff --git a/src/web/ejabberd_http.erl b/src/web/ejabberd_http.erl index a53910803..51384a216 100644 --- a/src/web/ejabberd_http.erl +++ b/src/web/ejabberd_http.erl @@ -271,13 +271,14 @@ process(Handlers, Request) -> process(HandlersLeft, Request) end. -process_request(#state{request_method = 'GET', +process_request(#state{request_method = Method, request_path = {abs_path, Path}, request_auth = Auth, request_lang = Lang, request_handlers = RequestHandlers, sockmod = SockMod, - socket = Socket} = State) -> + socket = Socket} = State) + when Method=:='GET' orelse Method=:='HEAD' orelse Method=:='DELETE' -> case (catch url_decode_q_split(Path)) of {'EXIT', _} -> process_request(false); @@ -296,7 +297,7 @@ process_request(#state{request_method = 'GET', _ -> SockMod:peername(Socket) end, - Request = #request{method = 'GET', + Request = #request{method = Method, path = LPath, q = LQuery, auth = Auth, @@ -319,7 +320,7 @@ process_request(#state{request_method = 'GET', end end; -process_request(#state{request_method = 'POST', +process_request(#state{request_method = Method, request_path = {abs_path, Path}, request_auth = Auth, request_content_length = Len, @@ -327,7 +328,7 @@ process_request(#state{request_method = 'POST', sockmod = SockMod, socket = Socket, request_handlers = RequestHandlers} = State) - when is_integer(Len) -> + when (Method=:='POST' orelse Method=:='PUT') andalso is_integer(Len) -> case SockMod of gen_tcp -> inet:setopts(Socket, [{packet, 0}]); @@ -347,7 +348,7 @@ process_request(#state{request_method = 'POST', LQ -> LQ end, - Request = #request{method = 'POST', + Request = #request{method = Method, path = LPath, q = LQuery, auth = Auth, -- 2.50.1