diff options
author | Loïc Hoguin <[email protected]> | 2016-11-05 14:17:30 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-11-05 14:17:30 +0200 |
commit | faca7866ed1c59cd41e11fcfc5a9f95378380497 (patch) | |
tree | 7e33284b3426083154b7a1d52ae5db8996212739 /doc/src/manual/cowboy_req.peer.asciidoc | |
parent | 8fe700f341d324c44f6c5f196f8c699c85ee6d78 (diff) | |
download | cowboy-faca7866ed1c59cd41e11fcfc5a9f95378380497.tar.gz cowboy-faca7866ed1c59cd41e11fcfc5a9f95378380497.tar.bz2 cowboy-faca7866ed1c59cd41e11fcfc5a9f95378380497.zip |
Partially update manual for the cowboy_req
Only the access functions have been modified so far.
Diffstat (limited to 'doc/src/manual/cowboy_req.peer.asciidoc')
-rw-r--r-- | doc/src/manual/cowboy_req.peer.asciidoc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_req.peer.asciidoc b/doc/src/manual/cowboy_req.peer.asciidoc new file mode 100644 index 0000000..e2df691 --- /dev/null +++ b/doc/src/manual/cowboy_req.peer.asciidoc @@ -0,0 +1,61 @@ += cowboy_req:peer(3) + +== Name + +cowboy_req:peer - Peer address and port + +== Description + +[source,erlang] +---- +peer(Req :: cowboy_req:req()) -> Peer + +Peer :: {inet:ip_address(), inet:port_number()} +---- + +Return the peer's IP address and port number. + +The peer can also be obtained using pattern matching: + +[source,erlang] +---- +#{peer := {IP, Port}} = Req. +---- + +// @todo So we need tests for accessing the Req directly. + +== Arguments + +Req:: + +The Req object. + +== Return value + +The peer's IP address and port number. + +The peer is not necessarily the client's IP address and port. +It is the IP address of the endpoint connecting directly to +the server, which may be a gateway or a proxy. + +The forwarded header can be used to get better information +about the different endpoints from the client to the server. +Note however that it is only informative; there is no reliable +way of determining the source of an HTTP request. + +== Changelog + +* *2.0*: Only the peer is returned, it is no longer wrapped in a tuple. +* *1.0*: Function introduced. + +== Examples + +.Get the peer IP address and port number. +[source,erlang] +---- +{IP, Port} = cowboy_req:peer(Req). +---- + +== See also + +link:man:cowboy_req(3)[cowboy_req(3)] |