mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 04:30:25 +00:00
Rename the type http_version/0 to cowboy_http:version/0
This commit is contained in:
parent
314483a0b6
commit
8622dff906
4 changed files with 6 additions and 6 deletions
|
@ -13,7 +13,6 @@
|
||||||
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
-type http_version() :: {Major::non_neg_integer(), Minor::non_neg_integer()}.
|
|
||||||
-type http_header() :: 'Cache-Control' | 'Connection' | 'Date' | 'Pragma'
|
-type http_header() :: 'Cache-Control' | 'Connection' | 'Date' | 'Pragma'
|
||||||
| 'Transfer-Encoding' | 'Upgrade' | 'Via' | 'Accept' | 'Accept-Charset'
|
| 'Transfer-Encoding' | 'Upgrade' | 'Via' | 'Accept' | 'Accept-Charset'
|
||||||
| 'Accept-Encoding' | 'Accept-Language' | 'Authorization' | 'From' | 'Host'
|
| 'Accept-Encoding' | 'Accept-Language' | 'Authorization' | 'From' | 'Host'
|
||||||
|
@ -42,7 +41,7 @@
|
||||||
%% Request.
|
%% Request.
|
||||||
pid = undefined :: pid(),
|
pid = undefined :: pid(),
|
||||||
method = 'GET' :: cowboy_http:method(),
|
method = 'GET' :: cowboy_http:method(),
|
||||||
version = {1, 1} :: http_version(),
|
version = {1, 1} :: cowboy_http:version(),
|
||||||
peer = undefined :: undefined | {inet:ip_address(), inet:ip_port()},
|
peer = undefined :: undefined | {inet:ip_address(), inet:ip_port()},
|
||||||
host = undefined :: undefined | cowboy_dispatcher:tokens(),
|
host = undefined :: undefined | cowboy_dispatcher:tokens(),
|
||||||
host_info = undefined :: undefined | cowboy_dispatcher:tokens(),
|
host_info = undefined :: undefined | cowboy_dispatcher:tokens(),
|
||||||
|
|
|
@ -32,8 +32,9 @@
|
||||||
Port::integer() | undefined, Path::binary()}
|
Port::integer() | undefined, Path::binary()}
|
||||||
| {scheme, Scheme::binary(), binary()}
|
| {scheme, Scheme::binary(), binary()}
|
||||||
| {abs_path, binary()} | binary().
|
| {abs_path, binary()} | binary().
|
||||||
|
-type version() :: {Major::non_neg_integer(), Minor::non_neg_integer()}.
|
||||||
|
|
||||||
-export_type([method/0, uri/0]).
|
-export_type([method/0, uri/0, version/0]).
|
||||||
|
|
||||||
-include("include/http.hrl").
|
-include("include/http.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
|
@ -109,7 +109,7 @@ wait_request(State=#state{socket=Socket, transport=Transport,
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec request({http_request, cowboy_http:method(), cowboy_http:uri(),
|
-spec request({http_request, cowboy_http:method(), cowboy_http:uri(),
|
||||||
http_version()}, #state{}) -> ok | none().
|
cowboy_http:version()}, #state{}) -> ok | none().
|
||||||
request({http_request, _Method, _URI, Version}, State)
|
request({http_request, _Method, _URI, Version}, State)
|
||||||
when Version =/= {1, 0}, Version =/= {1, 1} ->
|
when Version =/= {1, 0}, Version =/= {1, 1} ->
|
||||||
error_terminate(505, State);
|
error_terminate(505, State);
|
||||||
|
@ -422,7 +422,7 @@ terminate(#state{socket=Socket, transport=Transport}) ->
|
||||||
|
|
||||||
%% Internal.
|
%% Internal.
|
||||||
|
|
||||||
-spec version_to_connection(http_version()) -> keepalive | close.
|
-spec version_to_connection(cowboy_http:version()) -> keepalive | close.
|
||||||
version_to_connection({1, 1}) -> keepalive;
|
version_to_connection({1, 1}) -> keepalive;
|
||||||
version_to_connection(_Any) -> close.
|
version_to_connection(_Any) -> close.
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ method(Req) ->
|
||||||
{Req#http_req.method, Req}.
|
{Req#http_req.method, Req}.
|
||||||
|
|
||||||
%% @doc Return the HTTP version used for the request.
|
%% @doc Return the HTTP version used for the request.
|
||||||
-spec version(#http_req{}) -> {http_version(), #http_req{}}.
|
-spec version(#http_req{}) -> {cowboy_http:version(), #http_req{}}.
|
||||||
version(Req) ->
|
version(Req) ->
|
||||||
{Req#http_req.version, Req}.
|
{Req#http_req.version, Req}.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue