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 ->