Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
1141-add-connect_addr-to-Env-in-mod_esi-callbac...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1141-add-connect_addr-to-Env-in-mod_esi-callback.patch of Package erlang
From 4e8adc4d5b96d2c6e891b4ae1db23f39a1bf32d2 Mon Sep 17 00:00:00 2001 From: Konrad Pietrzak <konrad@erlang.org> Date: Fri, 29 Nov 2024 12:21:29 +0100 Subject: [PATCH] add connect_addr to Env in mod_esi callback --- lib/inets/src/http_server/httpd_script_env.erl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/inets/src/http_server/httpd_script_env.erl b/lib/inets/src/http_server/httpd_script_env.erl index 19c953f494..d874cd0e2f 100644 --- a/lib/inets/src/http_server/httpd_script_env.erl +++ b/lib/inets/src/http_server/httpd_script_env.erl @@ -87,6 +87,21 @@ which_method(#mod{method = Method}) -> which_request_uri(#mod{request_uri = RUri}) -> RUri. +which_connect_addr(#mod{socket = Socket, socket_type = SocketType}) when + SocketType == ip_comm; + element(1, SocketType) == ip_comm -> + maybe + {ok, {Addr, _Port}} ?= inet:sockname(Socket), + inet:ntoa(Addr) + end; +which_connect_addr(#mod{socket = Socket, socket_type = SocketType}) when + SocketType == ssl; + element(1, SocketType) == ssl -> + maybe + {ok, {Addr, _Port}} ?= ssl:sockname(Socket), + inet:ntoa(Addr) + end. + create_basic_elements(esi, ModData) -> [{server_software, which_server(ModData)}, {server_name, which_name(ModData)}, @@ -96,6 +111,7 @@ create_basic_elements(esi, ModData) -> {server_port, which_port(ModData)}, {request_method, which_method(ModData)}, {remote_addr, which_peername(ModData)}, + {connect_addr, which_connect_addr(ModData)}, {peer_cert, which_peercert(ModData)}, {script_name, which_request_uri(ModData)}]; @@ -108,6 +124,7 @@ create_basic_elements(cgi, ModData) -> {"SERVER_PORT", integer_to_list(which_port(ModData))}, {"REQUEST_METHOD", which_method(ModData)}, {"REMOTE_ADDR", which_peername(ModData)}, + {"CONNECT_ADDR", which_connect_addr(ModData)}, {"SCRIPT_NAME", which_request_uri(ModData)}]. create_http_header_elements(ScriptType, Headers) -> -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor