summaryrefslogtreecommitdiff
path: root/apps/mochiweb/src/mochiweb_response.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-10-26 00:06:54 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-10-26 00:09:23 -0400
commitf35cbdbc2b4de02e8400aceb9e10f71c515be16d (patch)
tree79bb6bef65053fb4bb9f4401d0748bfa299ee7be /apps/mochiweb/src/mochiweb_response.erl
parentebac05f686b56791511cb9b599dfb5a742dcfc96 (diff)
use get-deps for mochiweb
We need to host our own mochiweb which tags the versions used by CouchDB. This commit also contains a new rebar with a patch to fix git tag dependencies (submitted upstream).
Diffstat (limited to 'apps/mochiweb/src/mochiweb_response.erl')
-rw-r--r--apps/mochiweb/src/mochiweb_response.erl56
1 files changed, 0 insertions, 56 deletions
diff --git a/apps/mochiweb/src/mochiweb_response.erl b/apps/mochiweb/src/mochiweb_response.erl
deleted file mode 100644
index 6285c4c4..00000000
--- a/apps/mochiweb/src/mochiweb_response.erl
+++ /dev/null
@@ -1,56 +0,0 @@
-%% @author Bob Ippolito <bob@mochimedia.com>
-%% @copyright 2007 Mochi Media, Inc.
-
-%% @doc Response abstraction.
-
--module(mochiweb_response, [Request, Code, Headers]).
--author('bob@mochimedia.com').
-
--define(QUIP, "Any of you quaids got a smint?").
-
--export([get_header_value/1, get/1, dump/0]).
--export([send/1, write_chunk/1]).
-
-%% @spec get_header_value(string() | atom() | binary()) -> string() | undefined
-%% @doc Get the value of the given response header.
-get_header_value(K) ->
- mochiweb_headers:get_value(K, Headers).
-
-%% @spec get(request | code | headers) -> term()
-%% @doc Return the internal representation of the given field.
-get(request) ->
- Request;
-get(code) ->
- Code;
-get(headers) ->
- Headers.
-
-%% @spec dump() -> {mochiweb_request, [{atom(), term()}]}
-%% @doc Dump the internal representation to a "human readable" set of terms
-%% for debugging/inspection purposes.
-dump() ->
- [{request, Request:dump()},
- {code, Code},
- {headers, mochiweb_headers:to_list(Headers)}].
-
-%% @spec send(iodata()) -> ok
-%% @doc Send data over the socket if the method is not HEAD.
-send(Data) ->
- case Request:get(method) of
- '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) ->
- 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">>]);
- _ ->
- send(Data)
- end.