0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00

Rename inet:ip_port() to inet:port_number()

Thanks go to @superbobry for pointing it out.
This commit is contained in:
Loïc Hoguin 2012-03-12 21:57:07 +01:00
parent 5d46ad0e58
commit 3885912d9b
6 changed files with 14 additions and 12 deletions

View file

@ -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(),

View file

@ -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) ->

View file

@ -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}.

View file

@ -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) ->

View file

@ -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).

View file

@ -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).