Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not send connection close header when Expect header is in request #156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/mochiweb_request.erl
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ ok({ContentType, ResponseHeaders, Body}, {?MODULE, [_Socket, _Opts, _Method, _Ra
should_close({?MODULE, [_Socket, _Opts, _Method, _RawPath, Version, _Headers]}=THIS) ->
ForceClose = erlang:get(?SAVE_FORCE_CLOSE) =/= undefined,
DidNotRecv = erlang:get(?SAVE_RECV) =:= undefined,
ForceClose orelse Version < {1, 0}
(ForceClose orelse Version < {1, 0}
%% Connection: close
orelse is_close(get_header_value("connection", THIS))
%% HTTP 1.0 requires Connection: Keep-Alive
Expand All @@ -450,7 +450,8 @@ should_close({?MODULE, [_Socket, _Opts, _Method, _RawPath, Version, _Headers]}=T
andalso get_combined_header_value("content-length", THIS) =/= undefined
andalso list_to_integer(get_combined_header_value("content-length", THIS)) > 0)
orelse (DidNotRecv
andalso get_header_value("transfer-encoding", THIS) =:= "chunked").
andalso get_header_value("transfer-encoding", THIS) =:= "chunked"))
andalso get_header_value("expect", THIS) =:= undefined.

is_close("close") ->
true;
Expand Down