mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-16 05:00:24 +00:00
Add cowboy_http_req:port/1.
Returns the port given in the Host header if present, otherwise the default port of 443 for HTTPS and 80 for HTTP is returned.
This commit is contained in:
parent
cc663df5db
commit
6c1f73c53c
6 changed files with 84 additions and 43 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
-export([
|
||||
method/1, version/1, peer/1,
|
||||
host/1, raw_host/1,
|
||||
host/1, raw_host/1, port/1,
|
||||
path/1, raw_path/1,
|
||||
qs_val/2, qs_val/3, qs_vals/1, raw_qs/1,
|
||||
binding/2, binding/3, bindings/1,
|
||||
|
@ -63,6 +63,10 @@ host(Req) ->
|
|||
raw_host(Req) ->
|
||||
{Req#http_req.raw_host, Req}.
|
||||
|
||||
-spec port(Req::#http_req{}) -> {Port::ip_port(), Req::#http_req{}}.
|
||||
port(Req) ->
|
||||
{Req#http_req.port, Req}.
|
||||
|
||||
-spec path(Req::#http_req{})
|
||||
-> {Path::cowboy_dispatcher:path_tokens(), Req::#http_req{}}.
|
||||
path(Req) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue