0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Introduce cowboy_req:sock/1 and cowboy_req:cert/1

To obtain the local socket ip/port and the client TLS
certificate, respectively.
This commit is contained in:
Loïc Hoguin 2017-10-25 20:17:21 +01:00
parent 4090adaecc
commit ef58e15547
No known key found for this signature in database
GPG key ID: 71366FF21851DF03
9 changed files with 268 additions and 35 deletions

View file

@ -19,6 +19,8 @@
-export([method/1]).
-export([version/1]).
-export([peer/1]).
-export([sock/1]).
-export([cert/1]).
-export([scheme/1]).
-export([host/1]).
-export([host_info/1]).
@ -151,6 +153,14 @@ version(#{version := Version}) ->
peer(#{peer := Peer}) ->
Peer.
-spec sock(req()) -> {inet:ip_address(), inet:port_number()}.
sock(#{sock := Sock}) ->
Sock.
-spec cert(req()) -> binary() | undefined.
cert(#{cert := Cert}) ->
Cert.
-spec scheme(req()) -> binary().
scheme(#{scheme := Scheme}) ->
Scheme.