couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [1/2] chttpd commit: updated refs/heads/master to 77b3af4
Date Mon, 27 Jul 2015 12:12:54 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 3866725ee -> 77b3af447


Revert "Discard request body after request"

This reverts commit 56cf6412ad3572b5d07a281c5a25ec511af0530c.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/9dc2ba52
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/9dc2ba52
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/9dc2ba52

Branch: refs/heads/master
Commit: 9dc2ba523dc0edb54a991c4199bb1f2d0ed2c695
Parents: 3866725
Author: Robert Newson <rnewson@apache.org>
Authored: Mon Jul 27 12:32:35 2015 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Mon Jul 27 12:32:35 2015 +0100

----------------------------------------------------------------------
 src/chttpd.erl | 51 ---------------------------------------------------
 1 file changed, 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/9dc2ba52/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 9fb9395..1e80a53 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -251,8 +251,6 @@ handle_request(MochiReq0) ->
                 _Else ->
                     send_error(HttpReq, {Error, nil, Stack})
             end
-    after
-        maybe_discard_body(HttpReq)
     end,
 
     RequestTime = timer:now_diff(os:timestamp(), Begin)/1000,
@@ -504,55 +502,6 @@ json_body_obj(Httpd) ->
     end.
 
 
-maybe_discard_body(#httpd{mochi_req=MochiReq}=Req) ->
-    case erlang:get(mochiweb_request_body) of
-        undefined ->
-            Expect = case MochiReq:get_header_value("expect") of
-                undefined ->
-                    undefined;
-                Value when is_list(Value) ->
-                    string:to_lower(Value)
-                end,
-            case Expect of
-                "100-continue" ->
-                    ok;
-                _Else  ->
-                    discard_body(Req)
-            end;
-        _Body ->
-            ok % already consumed.
-    end.
-
-
-discard_body(#httpd{}=Req) ->
-    case body_length(Req) of
-        undefined ->
-            ok;
-        {unknown_transfer_encoding, Unknown} ->
-            exit({unknown_transfer_encoding, Unknown});
-        chunked ->
-            discard(Req);
-        0 ->
-            ok;
-        Length when is_integer(Length) ->
-            discard(Req);
-        Length ->
-            exit({length_not_integer, Length})
-    end.
-
-discard(#httpd{mochi_req=MochiReq}) ->
-    Discarded = MochiReq:stream_body(8192,
-        fun ({Len, _}, Acc) -> Len + Acc end, 0),
-    case Discarded of
-        undefined ->
-            ok;
-        Length when is_integer(Length) ->
-            couch_log:notice("Discarded ~B bytes of request body.",
-                     [Discarded])
-    end,
-    ok.
-
-
 doc_etag(#doc{revs={Start, [DiskRev|_]}}) ->
     "\"" ++ ?b2l(couch_doc:rev_to_str({Start, DiskRev})) ++ "\"".
 


Mime
View raw message