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

fix mochiweb_response regression #100

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/mochiweb_response.erl
Expand Up @@ -43,19 +43,19 @@ dump({?MODULE, [Request, Code, Headers]}) ->

%% @spec send(iodata(), response()) -> ok
%% @doc Send data over the socket if the method is not HEAD.
send(Data, {?MODULE, [Request, _Code, _Headers]}=THIS) ->
case Request:get(method, THIS) of
send(Data, {?MODULE, [Request, _Code, _Headers]}) ->
case Request:get(method) of
'HEAD' ->
ok;
_ ->
Request:send(Data, THIS)
Request:send(Data)
end.

%% @spec write_chunk(iodata(), response()) -> ok
%% @doc Write a chunk of a HTTP chunked response. If Data is zero length,
%% then the chunked response will be finished.
write_chunk(Data, {?MODULE, [Request, _Code, _Headers]}=THIS) ->
case Request:get(version, THIS) of
case Request:get(version) of
Version when Version >= {1, 1} ->
Length = iolist_size(Data),
send([io_lib:format("~.16b\r\n", [Length]), Data, <<"\r\n">>], THIS);
Expand Down