Permalink
Browse files

Merge pull request #12 from atesta/master

append data with POST request
  • Loading branch information...
2 parents 8470624 + 5fc74c3 commit bab07c209a4502962cc42e67179e6cc56594b4c6 @slfritchie slfritchie committed May 19, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/luwak_wm_file.erl
View
8 src/luwak_wm_file.erl
@@ -521,8 +521,12 @@ accept_doc_body(RD, Ctx=#ctx{key=K, client=C, file_props=FP}) ->
HCtx = Ctx#ctx{handle={ok,H1}},
{accept_streambody(RD, HCtx), RD, HCtx}.
-accept_streambody(RD, #ctx{handle={ok, H}, client=C}) ->
- Stream = luwak_put_stream:start_link(C, H, 0, 1000),
+accept_streambody(RD, #ctx{handle={ok, H}, client=C, method=Method}) ->
+ Offset = case Method of
+ 'POST' -> luwak_file:length(C,H);
+ _ ->0
+ end,
+ Stream = luwak_put_stream:start_link(C, H, Offset, 1000),
Size = luwak_file:get_default_block_size(),
accept_streambody1(Stream, 0, wrq:stream_req_body(RD, Size)).

0 comments on commit bab07c2

Please sign in to comment.