Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
7371-inets-change-error-type-from-TLS-to-HTTP.p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 7371-inets-change-error-type-from-TLS-to-HTTP.patch of Package erlang
From 1ea4eaaa28be4982f40967c12f095d248268cf86 Mon Sep 17 00:00:00 2001 From: Jakub Witczak <kuba@erlang.org> Date: Thu, 3 Aug 2023 17:48:03 +0200 Subject: [PATCH 1/2] inets: change error type from 'TLS' to 'HTTP' - change error type from 'TLS' to 'HTTP' when connection setup fails - using 'HTTP' error category provides transport information in logs --- lib/inets/src/http_server/httpd_logger.erl | 16 ++++++++-------- .../src/http_server/httpd_request_handler.erl | 7 ++++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/inets/src/http_server/httpd_logger.erl b/lib/inets/src/http_server/httpd_logger.erl index fac551e4bc..f1b2a111e9 100644 --- a/lib/inets/src/http_server/httpd_logger.erl +++ b/lib/inets/src/http_server/httpd_logger.erl @@ -33,11 +33,11 @@ error_report(Protocol, Reason, #mod{init_data = #init_data{peername = PeerName, Location) -> ServerName = httpd_util:lookup(Db, server_name), Report0 = #{protocol => Protocol, - reason => Reason, - peer => PeerName, - host => SockName, - server_name => ServerName, - metadata => Location}, + reason => Reason, + peer => PeerName, + host => SockName, + server_name => ServerName, + metadata => Location}, Report1 = case URI of undefined -> Report0; @@ -46,11 +46,11 @@ error_report(Protocol, Reason, #mod{init_data = #init_data{peername = PeerName, end, case Protocol of 'HTTP' -> - Report1#{transport => transport_type(Type)}; + Report1#{transport => transport_type(Type)}; _ -> Report1 - end. - + end. + log(Level, #{metadata := MetaData} = Report, Domain) -> logger:log(Level, maps:without([metadata], Report), MetaData#{domain => [otp,inets, httpd, Domain, Level], diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl index e99526a278..3b4fc5c512 100644 --- a/lib/inets/src/http_server/httpd_request_handler.erl +++ b/lib/inets/src/http_server/httpd_request_handler.erl @@ -148,8 +148,13 @@ continue_init(Manager, ConfigDB, SocketType, Socket, Peername, Sockname, {Result, Status} = httpd_manager:new_connection(Manager), case Result of error -> + %% this error might happen when httpd manager is stopped + %% during execution of httpd_transport:negotiate; this is + %% most likely to happen for TLS requiring more processing + %% 'HTTP' as error category(Protocol) because transport + %% information is wanted in logs httpd_util:error_log(ConfigDB, - httpd_logger:error_report('TLS', Status, + httpd_logger:error_report('HTTP', Status, Mod, ?LOCATION)), exit({shutdown, Status}); _ -> -- 2.35.3
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