aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/http.hrl5
-rw-r--r--src/cowboy_dispatcher.erl2
-rw-r--r--src/cowboy_http_req.erl5
-rw-r--r--src/cowboy_http_websocket.erl6
-rw-r--r--src/cowboy_ssl_transport.erl4
-rw-r--r--src/cowboy_tcp_transport.erl4
6 files changed, 14 insertions, 12 deletions
diff --git a/include/http.hrl b/include/http.hrl
index c66f2b0..9ba3787 100644
--- a/include/http.hrl
+++ b/include/http.hrl
@@ -23,11 +23,12 @@
pid = undefined :: pid(),
method = 'GET' :: cowboy_http:method(),
version = {1, 1} :: cowboy_http:version(),
- peer = undefined :: undefined | {inet:ip_address(), inet:ip_port()},
+ peer = undefined :: undefined |
+ {inet:ip_address(), inet:port_number()},
host = undefined :: undefined | cowboy_dispatcher:tokens(),
host_info = undefined :: undefined | cowboy_dispatcher:tokens(),
raw_host = undefined :: undefined | binary(),
- port = undefined :: undefined | inet:ip_port(),
+ port = undefined :: undefined | inet:port_number(),
path = undefined :: undefined | '*' | cowboy_dispatcher:tokens(),
path_info = undefined :: undefined | cowboy_dispatcher:tokens(),
raw_path = undefined :: undefined | binary(),
diff --git a/src/cowboy_dispatcher.erl b/src/cowboy_dispatcher.erl
index 22f6e1e..db40e63 100644
--- a/src/cowboy_dispatcher.erl
+++ b/src/cowboy_dispatcher.erl
@@ -33,7 +33,7 @@
%% @doc Split a hostname into a list of tokens.
-spec split_host(binary())
- -> {tokens(), binary(), undefined | inet:ip_port()}.
+ -> {tokens(), binary(), undefined | inet:port_number()}.
split_host(<<>>) ->
{[], <<>>, undefined};
split_host(Host) ->
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index 25c5a58..6b947d9 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -65,7 +65,8 @@ version(Req) ->
{Req#http_req.version, Req}.
%% @doc Return the peer address and port number of the remote host.
--spec peer(#http_req{}) -> {{inet:ip_address(), inet:ip_port()}, #http_req{}}.
+-spec peer(#http_req{})
+ -> {{inet:ip_address(), inet:port_number()}, #http_req{}}.
peer(Req=#http_req{socket=Socket, transport=Transport, peer=undefined}) ->
{ok, Peer} = Transport:peername(Socket),
{Peer, Req#http_req{peer=Peer}};
@@ -113,7 +114,7 @@ raw_host(Req) ->
{Req#http_req.raw_host, Req}.
%% @doc Return the port used for this request.
--spec port(#http_req{}) -> {inet:ip_port(), #http_req{}}.
+-spec port(#http_req{}) -> {inet:port_number(), #http_req{}}.
port(Req) ->
{Req#http_req.port, Req}.
diff --git a/src/cowboy_http_websocket.erl b/src/cowboy_http_websocket.erl
index a926261..40fef23 100644
--- a/src/cowboy_http_websocket.erl
+++ b/src/cowboy_http_websocket.erl
@@ -467,8 +467,8 @@ hixie76_key_to_integer(Key) ->
Spaces = length([C || << C >> <= Key, C =:= 32]),
Number div Spaces.
--spec hixie76_location(atom(), binary(), inet:ip_port(), binary(), binary())
- -> binary().
+-spec hixie76_location(atom(), binary(), inet:port_number(),
+ binary(), binary()) -> binary().
hixie76_location(Protocol, Host, Port, Path, <<>>) ->
<< (hixie76_location_protocol(Protocol))/binary, "://", Host/binary,
(hixie76_location_port(Protocol, Port))/binary, Path/binary>>;
@@ -482,7 +482,7 @@ hixie76_location_protocol(_) -> <<"ws">>.
%% @todo We should add a secure/0 function to transports
%% instead of relying on their name.
--spec hixie76_location_port(atom(), inet:ip_port()) -> binary().
+-spec hixie76_location_port(atom(), inet:port_number()) -> binary().
hixie76_location_port(ssl, 443) ->
<<>>;
hixie76_location_port(tcp, 80) ->
diff --git a/src/cowboy_ssl_transport.erl b/src/cowboy_ssl_transport.erl
index 7ce608d..ccd8e5a 100644
--- a/src/cowboy_ssl_transport.erl
+++ b/src/cowboy_ssl_transport.erl
@@ -58,7 +58,7 @@ messages() -> {ssl, ssl_closed, ssl_error}.
%% </dl>
%%
%% @see ssl:listen/2
--spec listen([{port, inet:ip_port()} | {certfile, string()}
+-spec listen([{port, inet:port_number()} | {certfile, string()}
| {keyfile, string()} | {password, string()}
| {cacertfile, string()} | {ip, inet:ip_address()}])
-> {ok, ssl:sslsocket()} | {error, atom()}.
@@ -139,7 +139,7 @@ controlling_process(Socket, Pid) ->
%% @doc Return the address and port for the other end of a connection.
%% @see ssl:peername/1
-spec peername(ssl:sslsocket())
- -> {ok, {inet:ip_address(), inet:ip_port()}} | {error, atom()}.
+ -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}.
peername(Socket) ->
ssl:peername(Socket).
diff --git a/src/cowboy_tcp_transport.erl b/src/cowboy_tcp_transport.erl
index c1dad62..82d193b 100644
--- a/src/cowboy_tcp_transport.erl
+++ b/src/cowboy_tcp_transport.erl
@@ -45,7 +45,7 @@ messages() -> {tcp, tcp_closed, tcp_error}.
%% </dl>
%%
%% @see gen_tcp:listen/2
--spec listen([{port, inet:ip_port()} | {ip, inet:ip_address()}])
+-spec listen([{port, inet:port_number()} | {ip, inet:ip_address()}])
-> {ok, inet:socket()} | {error, atom()}.
listen(Opts) ->
{port, Port} = lists:keyfind(port, 1, Opts),
@@ -95,7 +95,7 @@ controlling_process(Socket, Pid) ->
%% @doc Return the address and port for the other end of a connection.
%% @see inet:peername/1
-spec peername(inet:socket())
- -> {ok, {inet:ip_address(), inet:ip_port()}} | {error, atom()}.
+ -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}.
peername(Socket) ->
inet:peername(Socket).