0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Remove cowboy_req:new/14

This internal function is no longer necessary.
This commit is contained in:
Loïc Hoguin 2016-06-21 19:03:18 +02:00
parent d9cad866f2
commit 3a7643782e

View file

@ -16,7 +16,6 @@
-module(cowboy_req). -module(cowboy_req).
%% Request API. %% Request API.
-export([new/14]).
-export([method/1]). -export([method/1]).
-export([version/1]). -export([version/1]).
-export([peer/1]). -export([peer/1]).
@ -157,36 +156,6 @@
%% Request API. %% Request API.
-spec new(any(), module(),
undefined | {inet:ip_address(), inet:port_number()},
binary(), binary(), binary(),
cowboy:http_version(), cowboy:http_headers(), binary(),
inet:port_number() | undefined, binary(), boolean(), boolean(),
undefined | cowboy:onresponse_fun())
-> req().
new(Socket, Transport, Peer, Method, Path, Query,
Version, Headers, Host, Port, Buffer, CanKeepalive,
Compress, OnResponse) ->
Req = #http_req{socket=Socket, transport=Transport, pid=self(), peer=Peer,
method=Method, path=Path, qs=Query, version=Version,
headers=Headers, host=Host, port=Port, buffer=Buffer,
resp_compress=Compress, onresponse=OnResponse},
case CanKeepalive of
false ->
Req#http_req{connection=close};
true ->
case parse_header(<<"connection">>, Req) of
undefined ->
case Version of
'HTTP/1.1' -> Req; %% keepalive
'HTTP/1.0' -> Req#http_req{connection=close}
end;
Tokens ->
Connection = connection_to_atom(Tokens),
Req#http_req{connection=Connection}
end
end.
-spec method(req()) -> binary(). -spec method(req()) -> binary().
method(#{method := Method}) -> method(#{method := Method}) ->
Method. Method.