summaryrefslogtreecommitdiff
path: root/src/mochiweb/mochiweb_response.erl
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-04-30 00:45:50 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-04-30 00:45:50 +0000
commit2f40a05f2631b9c92758720c2e9703cb0c9198d7 (patch)
tree1a3bee7cc5e62f1f8f88e4727b3d92f70dd0787b /src/mochiweb/mochiweb_response.erl
parent31168059f61685443a30450dc0a0623e11f1bbc6 (diff)
Update MochiWeb code in trunk to r66.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@652206 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/mochiweb/mochiweb_response.erl')
-rw-r--r--src/mochiweb/mochiweb_response.erl19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/mochiweb/mochiweb_response.erl b/src/mochiweb/mochiweb_response.erl
index 87917c40..d69c6726 100644
--- a/src/mochiweb/mochiweb_response.erl
+++ b/src/mochiweb/mochiweb_response.erl
@@ -37,16 +37,21 @@ dump() ->
%% @doc Send data over the socket if the method is not HEAD.
send(Data) ->
case Request:get(method) of
- 'HEAD' ->
- ok;
- _ ->
- Request:send(Data)
+ 'HEAD' ->
+ ok;
+ _ ->
+ Request:send(Data)
end.
%% @spec write_chunk(iodata()) -> 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) ->
- Length = iolist_size(Data),
- send(io_lib:format("~.16b\r\n", [Length])),
- send([Data, <<"\r\n">>]).
+ case Request:get(version) of
+ Version when Version >= {1, 1} ->
+ Length = iolist_size(Data),
+ send(io_lib:format("~.16b\r\n", [Length])),
+ send([Data, <<"\r\n">>]);
+ _ ->
+ send(Data)
+ end.