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

* src/web/ejabberd_http.hrl: Added "ip" field in the "request"

record
* src/web/ejabberd_http.erl: Likewise

SVN Revision: 762
This commit is contained in:
Alexey Shchepin 2007-05-07 15:47:33 +00:00
parent 372944df6c
commit 32613987a8
3 changed files with 34 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2007-05-07 Alexey Shchepin <alexey@sevcom.net>
* src/web/ejabberd_http.hrl: Added "ip" field in the "request"
record
* src/web/ejabberd_http.erl: Likewise
2007-05-03 Alexey Shchepin <alexey@sevcom.net> 2007-05-03 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_sm.erl: Added set_presence_hook * src/ejabberd_sm.erl: Added set_presence_hook

View File

@ -253,7 +253,9 @@ process_request(#state{request_method = 'GET',
request_path = {abs_path, Path}, request_path = {abs_path, Path},
request_auth = Auth, request_auth = Auth,
request_lang = Lang, request_lang = Lang,
request_handlers = RequestHandlers} = State) -> request_handlers = RequestHandlers,
sockmod = SockMod,
socket = Socket} = State) ->
case (catch url_decode_q_split(Path)) of case (catch url_decode_q_split(Path)) of
{'EXIT', _} -> {'EXIT', _} ->
process_request(false); process_request(false);
@ -265,11 +267,19 @@ process_request(#state{request_method = 'GET',
LQ LQ
end, end,
LPath = string:tokens(NPath, "/"), LPath = string:tokens(NPath, "/"),
{ok, {IP, _Port}} =
case SockMod of
gen_tcp ->
inet:peername(Socket);
_ ->
SockMod:peername(Socket)
end,
Request = #request{method = 'GET', Request = #request{method = 'GET',
path = LPath, path = LPath,
q = LQuery, q = LQuery,
auth = Auth, auth = Auth,
lang = Lang}, lang = Lang,
ip=IP},
%% XXX bard: This previously passed control to %% XXX bard: This previously passed control to
%% ejabberd_web:process_get, now passes it to a local %% ejabberd_web:process_get, now passes it to a local
%% procedure (process) that handles dispatching based on %% procedure (process) that handles dispatching based on
@ -962,4 +972,3 @@ get_line("\r\n" ++ Tail, Cur) ->
end; end;
get_line([H|T], Cur) -> get_line([H|T], Cur) ->
get_line(T, [H|Cur]). get_line(T, [H|Cur]).

View File

@ -12,7 +12,6 @@
us, us,
auth, auth,
lang = "", lang = "",
data = "" data = "",
ip
}). }).