diff options
author | Loïc Hoguin <[email protected]> | 2017-10-25 20:17:21 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-10-25 21:03:26 +0100 |
commit | ef58e15547ee171a716eaa768374e2e7e2f7d397 (patch) | |
tree | 0871f7f142014592f581f7c1a9705eb95d65dc2a /doc/src/manual/cowboy_req.sock.asciidoc | |
parent | 4090adaecc6ba30eeeabf50aee57c22945fa27eb (diff) | |
download | cowboy-ef58e15547ee171a716eaa768374e2e7e2f7d397.tar.gz cowboy-ef58e15547ee171a716eaa768374e2e7e2f7d397.tar.bz2 cowboy-ef58e15547ee171a716eaa768374e2e7e2f7d397.zip |
Introduce cowboy_req:sock/1 and cowboy_req:cert/1
To obtain the local socket ip/port and the client TLS
certificate, respectively.
Diffstat (limited to 'doc/src/manual/cowboy_req.sock.asciidoc')
-rw-r--r-- | doc/src/manual/cowboy_req.sock.asciidoc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_req.sock.asciidoc b/doc/src/manual/cowboy_req.sock.asciidoc new file mode 100644 index 0000000..c5e7fa7 --- /dev/null +++ b/doc/src/manual/cowboy_req.sock.asciidoc @@ -0,0 +1,51 @@ += cowboy_req:sock(3) + +== Name + +cowboy_req:sock - Socket address and port + +== Description + +[source,erlang] +---- +sock(Req :: cowboy_req:req()) -> Info + +Info :: {inet:ip_address(), inet:port_number()} +---- + +Return the socket's IP address and port number. + +The socket information can also be obtained using pattern matching: + +[source,erlang] +---- +#{sock := {IP, Port}} = Req. +---- + +== Arguments + +Req:: + +The Req object. + +== Return value + +The socket's local IP address and port number. + +== Changelog + +* *2.0*: Function introduced. + +== Examples + +.Get the socket's IP address and port number. +[source,erlang] +---- +{IP, Port} = cowboy_req:sock(Req). +---- + +== See also + +link:man:cowboy_req(3)[cowboy_req(3)], +link:man:cowboy_req:peer(3)[cowboy_req:peer(3)], +link:man:cowboy_req:cert(3)[cowboy_req:cert(3)] |