From 2f40a05f2631b9c92758720c2e9703cb0c9198d7 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Wed, 30 Apr 2008 00:45:50 +0000 Subject: 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 --- src/mochiweb/mochiweb_response.erl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/mochiweb/mochiweb_response.erl') 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. -- cgit v1.2.3