File 3721-inets-Use-proc_lib-set_label-1.patch of Package erlang
From 8bd5198eb5dab9d5f728580a3ddf8e63cdb8e48a Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Thu, 18 Jan 2024 12:09:19 +0100
Subject: [PATCH] inets: Use proc_lib:set_label/1
---
lib/inets/src/http_client/httpc_handler.erl | 2 ++
lib/inets/src/http_server/httpd_request_handler.erl | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index b4ac3b61ee..7ba0f68aa5 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -221,6 +221,8 @@ init([Parent, Request, Options, ProfileName]) ->
%% Do not let initial tcp-connection block the manager-process
proc_lib:init_ack(Parent, self()),
+ {Host, Port} = Request#request.address,
+ proc_lib:set_label({Request#request.scheme, erlang:iolist_to_binary(Host), Port}),
handle_verbose(Options#options.verbose),
ProxyOptions = handle_proxy_options(Request#request.scheme, Options),
Address = handle_proxy(Request#request.address, ProxyOptions),
diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl
index 43e916c61b..0b2f4cdc87 100644
--- a/lib/inets/src/http_server/httpd_request_handler.erl
+++ b/lib/inets/src/http_server/httpd_request_handler.erl
@@ -97,8 +97,10 @@ init([Manager, ConfigDB, AcceptTimeout]) ->
%%link(Manager),
%% At this point the function httpd_request_handler:start/2 will return.
proc_lib:init_ack({ok, self()}),
-
{SocketType, Socket} = await_socket_ownership_transfer(AcceptTimeout),
+ ServerName = erlang:iolist_to_binary(httpd_util:lookup(ConfigDB, server_name)),
+ Protocol = protocol(SocketType),
+ proc_lib:set_label({Protocol, ServerName}),
Peername = http_transport:peername(SocketType, Socket),
Sockname = http_transport:sockname(SocketType, Socket),
@@ -773,3 +775,8 @@ setopts(Socket, SocketType, Options) ->
{error, _} -> %% inet can return einval instead of closed
self() ! {http_transport:close_tag(SocketType), Socket}
end.
+
+protocol({ssl,_}) ->
+ https;
+protocol(_) ->
+ http.
--
2.43.0