Browse files

changed behavior of 'POST' method, now append data to the end of the …

…object
  • Loading branch information...
1 parent 2dc13c5 commit 5fc74c3f68e6bf12aad8d4ec5e66f536f8db17a6 Alex T committed Apr 17, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/luwak_wm_file.erl
View
8 src/luwak_wm_file.erl
@@ -502,8 +502,12 @@ accept_doc_body(RD, Ctx=#ctx{key=K, client=C}) ->
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 5fc74c3

Please sign in to comment.