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:
parent
4090adaecc
commit
ef58e15547
9 changed files with 268 additions and 35 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue