25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +01:00

* src/web/ejabberd_http.erl: Added a workaround for inet:peername

returning 'ebadf'

SVN Revision: 1910
This commit is contained in:
Alexey Shchepin 2009-02-23 05:25:10 +00:00
parent e6324f8a02
commit b6208955f3
2 changed files with 12 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2009-02-23 Alexey Shchepin <alexey@process-one.net>
* src/web/ejabberd_http.erl: Added a workaround for inet:peername
returning 'ebadf'
2009-02-20 Badlop <badlop@process-one.net>
* src/ejabberd_listener.erl: When stopping a listener, don't stop

View File

@ -381,6 +381,13 @@ process_request(#state{request_method = Method,
request_headers = RequestHeaders,
request_handlers = RequestHandlers} = State)
when (Method=:='POST' orelse Method=:='PUT') andalso 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}]);
@ -400,13 +407,6 @@ process_request(#state{request_method = Method,
LQ ->
LQ
end,
{ok, IP} =
case SockMod of
gen_tcp ->
inet:peername(Socket);
_ ->
SockMod:peername(Socket)
end,
Request = #request{method = Method,
path = LPath,
q = LQuery,