aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_protocol.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy_http_protocol.erl')
-rw-r--r--src/cowboy_http_protocol.erl15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl
index ea59799..a714111 100644
--- a/src/cowboy_http_protocol.erl
+++ b/src/cowboy_http_protocol.erl
@@ -108,8 +108,8 @@ wait_request(State=#state{socket=Socket, transport=Transport,
{error, _Reason} -> terminate(State)
end.
--spec request({http_request, http_method(), http_uri(),
- http_version()}, #state{}) -> ok | none().
+-spec request({http_request, cowboy_http:method(), cowboy_http:uri(),
+ cowboy_http:version()}, #state{}) -> ok | none().
request({http_request, _Method, _URI, Version}, State)
when Version =/= {1, 0}, Version =/= {1, 1} ->
error_terminate(505, State);
@@ -158,7 +158,7 @@ wait_header(Req, State=#state{socket=Socket,
{error, closed} -> terminate(State)
end.
--spec header({http_header, integer(), http_header(), any(), binary()}
+-spec header({http_header, integer(), cowboy_http:header(), any(), binary()}
| http_eoh, #http_req{}, #state{}) -> ok | none().
header({http_header, _I, 'Host', _R, RawHost}, Req=#http_req{
transport=Transport, host=undefined}, State) ->
@@ -380,7 +380,10 @@ ensure_body_processed(Req=#http_req{body_state=waiting}) ->
{error, badarg} -> ok; %% No body.
{error, _Reason} -> close;
_Any -> ok
- end.
+ end;
+ensure_body_processed(Req=#http_req{body_state={multipart, _, _}}) ->
+ {ok, Req2} = cowboy_http_req:multipart_skip(Req),
+ ensure_body_processed(Req2).
-spec ensure_response(#http_req{}) -> ok.
%% The handler has already fully replied to the client.
@@ -400,7 +403,7 @@ ensure_response(#http_req{socket=Socket, transport=Transport,
close.
%% Only send an error reply if there is no resp_sent message.
--spec error_terminate(http_status(), #state{}) -> ok.
+-spec error_terminate(cowboy_http:status(), #state{}) -> ok.
error_terminate(Code, State=#state{socket=Socket, transport=Transport}) ->
receive
{cowboy_http_req, resp_sent} -> ok
@@ -419,7 +422,7 @@ terminate(#state{socket=Socket, transport=Transport}) ->
%% 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(_Any) -> close.