aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/http.hrl4
-rw-r--r--include/types.hrl2
-rw-r--r--src/cowboy_http_req.erl2
-rw-r--r--src/cowboy_ssl_transport.erl5
-rw-r--r--src/cowboy_tcp_transport.erl5
5 files changed, 10 insertions, 8 deletions
diff --git a/include/http.hrl b/include/http.hrl
index 391e79a..79bfc7b 100644
--- a/include/http.hrl
+++ b/include/http.hrl
@@ -12,6 +12,8 @@
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+-include_lib("kernel/include/inet.hrl").
+
-type http_method() :: 'OPTIONS' | 'GET' | 'HEAD'
| 'POST' | 'PUT' | 'DELETE' | 'TRACE' | string().
-type http_uri() :: '*' | {absoluteURI, http | https, Host::string(),
@@ -45,7 +47,7 @@
%% Request.
method = 'GET' :: http_method(),
version = {1, 1} :: http_version(),
- peer = undefined :: undefined | {Address::inet:ip_address(), Port::port_number()},
+ peer = undefined :: undefined | {Address::ip_address(), Port::ip_port()},
host = undefined :: undefined | cowboy_dispatcher:path_tokens(),
raw_host = undefined :: undefined | string(),
path = undefined :: undefined | '*' | cowboy_dispatcher:path_tokens(),
diff --git a/include/types.hrl b/include/types.hrl
index 371dd18..10cc6f4 100644
--- a/include/types.hrl
+++ b/include/types.hrl
@@ -11,5 +11,3 @@
%% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
--type port_number() :: 0..65535.
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index 932ba3e..d7c217f 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -48,7 +48,7 @@ version(Req) ->
{Req#http_req.version, Req}.
-spec peer(Req::#http_req{})
- -> {{Address::inet:ip_address(), Port::port_number()}, Req::#http_req{}}.
+ -> {{Address::ip_address(), Port::ip_port()}, Req::#http_req{}}.
peer(Req=#http_req{socket=Socket, transport=Transport, peer=undefined}) ->
{ok, Peer} = Transport:peername(Socket),
{Peer, Req#http_req{peer=Peer}};
diff --git a/src/cowboy_ssl_transport.erl b/src/cowboy_ssl_transport.erl
index 3909409..e7a96ed 100644
--- a/src/cowboy_ssl_transport.erl
+++ b/src/cowboy_ssl_transport.erl
@@ -19,6 +19,7 @@
-opaque sslsocket() :: term().
-include("include/types.hrl").
+-include_lib("kernel/include/inet.hrl").
%% API.
@@ -28,7 +29,7 @@ name() -> ssl.
-spec messages() -> {ssl, ssl_closed, ssl_error}.
messages() -> {ssl, ssl_closed, ssl_error}.
--spec listen([{port, Port::port_number()} | {certfile, CertPath::string()}
+-spec listen([{port, Port::ip_port()} | {certfile, CertPath::string()}
| {keyfile, KeyPath::string()} | {password, Password::string()}])
-> {ok, LSocket::sslsocket()} | {error, Reason::atom()}.
listen(Opts) ->
@@ -71,7 +72,7 @@ controlling_process(Socket, Pid) ->
ssl:controlling_process(Socket, Pid).
-spec peername(Socket::sslsocket())
- -> {ok, {Address::inet:ip_address(), Port::port_number()}} | {error, atom()}.
+ -> {ok, {Address::ip_address(), Port::ip_port()}} | {error, atom()}.
peername(Socket) ->
ssl:peername(Socket).
diff --git a/src/cowboy_tcp_transport.erl b/src/cowboy_tcp_transport.erl
index fa46451..d67e096 100644
--- a/src/cowboy_tcp_transport.erl
+++ b/src/cowboy_tcp_transport.erl
@@ -17,6 +17,7 @@
controlling_process/2, peername/1, close/1]). %% API.
-include("include/types.hrl").
+-include_lib("kernel/include/inet.hrl").
%% API.
@@ -26,7 +27,7 @@ name() -> tcp.
-spec messages() -> {tcp, tcp_closed, tcp_error}.
messages() -> {tcp, tcp_closed, tcp_error}.
--spec listen([{port, Port::port_number()}])
+-spec listen([{port, Port::ip_port()}])
-> {ok, LSocket::inet:socket()} | {error, Reason::atom()}.
listen(Opts) ->
{port, Port} = lists:keyfind(port, 1, Opts),
@@ -60,7 +61,7 @@ controlling_process(Socket, Pid) ->
gen_tcp:controlling_process(Socket, Pid).
-spec peername(Socket::inet:socket())
- -> {ok, {Address::inet:ip_address(), Port::port_number()}} | {error, atom()}.
+ -> {ok, {Address::ip_address(), Port::ip_port()}} | {error, atom()}.
peername(Socket) ->
inet:peername(Socket).