From 06abf6331b7c564bfc88e557f55217ef8d9c76be Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 27 Feb 2009 16:19:19 +0000 Subject: [PATCH] Merge fix from trunk r1910 * src/web/ejabberd_http.erl: Added a workaround for inet:peername returning 'ebadf' SVN Revision: 1928 --- ChangeLog | 3 +++ src/web/ejabberd_http.erl | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2648c46c..e0676e15b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-02-27 Badlop + * src/web/ejabberd_http.erl: Added a workaround for inet:peername + returning 'ebadf' + * src/cyrsasl_digest.erl: Unquote backslash in DIGEST-MD5 quoted strings (EJAB-304) diff --git a/src/web/ejabberd_http.erl b/src/web/ejabberd_http.erl index 41f509657..551c09527 100644 --- a/src/web/ejabberd_http.erl +++ b/src/web/ejabberd_http.erl @@ -328,6 +328,13 @@ process_request(#state{request_method = 'POST', socket = Socket, request_handlers = RequestHandlers} = State) when is_integer(Len) -> + {ok, IP} = + case SockMod of + gen_tcp -> + inet:peername(Socket); + _ -> + SockMod:peername(Socket) + end, case SockMod of gen_tcp -> inet:setopts(Socket, [{packet, 0}]); @@ -347,13 +354,6 @@ process_request(#state{request_method = 'POST', LQ -> LQ end, - {ok, IP} = - case SockMod of - gen_tcp -> - inet:peername(Socket); - _ -> - SockMod:peername(Socket) - end, Request = #request{method = 'POST', path = LPath, q = LQuery,