summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_misc_handlers.erl
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2009-05-12 21:18:40 +0000
committerJan Lehnardt <jan@apache.org>2009-05-12 21:18:40 +0000
commit9418d9814779dd27e15036fc6b9d9355a4b70578 (patch)
tree2264845829e1e29eaca5a84e2624f8ef04a5014f /src/couchdb/couch_httpd_misc_handlers.erl
parent7c76d131110e4641114e3066844e7195efb2f33b (diff)
add offset parameter so clients like Futon can deliver a consistent user experience
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@774095 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_misc_handlers.erl')
-rw-r--r--src/couchdb/couch_httpd_misc_handlers.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl
index 92e0252a..5daeeeea 100644
--- a/src/couchdb/couch_httpd_misc_handlers.erl
+++ b/src/couchdb/couch_httpd_misc_handlers.erl
@@ -198,12 +198,15 @@ increment_update_seq_req(Req, _Db) ->
% httpd log handlers
handle_log_req(#httpd{method='GET'}=Req) ->
- LastBytes = list_to_integer(couch_httpd:qs_value(Req, "bytes", "1000")),
+ Bytes = list_to_integer(couch_httpd:qs_value(Req, "bytes", "1000")),
+ Offset = list_to_integer(couch_httpd:qs_value(Req, "offset", "0")),
+ Chunk = couch_log:read(Bytes, Offset),
{ok, Resp} = start_chunked_response(Req, 200, [
% send a plaintext response
- {"Content-Type", "text/plain; charset=utf-8"}
+ {"Content-Type", "text/plain; charset=utf-8"},
+ {"Content-Length", integer_to_list(length(Chunk))}
]),
- send_chunk(Resp, couch_log:read(LastBytes)),
+ send_chunk(Resp, Chunk),
send_chunk(Resp, "");
handle_log_req(Req) ->
send_method_not_allowed(Req, "GET").