From 2855ba5a57b90b0b8e2561a4f53fdaf3d41578dc Mon Sep 17 00:00:00 2001 From: Alexander Petrovsky Date: Fri, 7 Jan 2022 17:58:15 +0300 Subject: [PATCH] Get peer cert inderectly through ranch_transport:peercert/1 --- src/cowboy_http.erl | 2 +- src/cowboy_http2.erl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index c9bceed85..6ef8e8fae 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -161,7 +161,7 @@ init(Parent, Ref, Socket, Transport, ProxyHeader, Opts) -> Sock0 = Transport:sockname(Socket), Cert1 = case Transport:name() of ssl -> - case ssl:peercert(Socket) of + case Transport:peercert(Socket) of {error, no_peercert} -> {ok, undefined}; Cert0 -> diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl index ed2623c68..353cfdccd 100644 --- a/src/cowboy_http2.erl +++ b/src/cowboy_http2.erl @@ -133,7 +133,7 @@ init(Parent, Ref, Socket, Transport, ProxyHeader, Opts) -> Sock0 = Transport:sockname(Socket), Cert1 = case Transport:name() of ssl -> - case ssl:peercert(Socket) of + case Transport:peercert(Socket) of {error, no_peercert} -> {ok, undefined}; Cert0 ->