You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2013/12/15 21:41:35 UTC
git commit: updated refs/heads/154-feature-gzip-post to 3186e16
Updated Branches:
refs/heads/154-feature-gzip-post 899a91927 -> 3186e1604
Wrap decompression in a try/catch, report 400
COUCHDB-154
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/3186e160
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/3186e160
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/3186e160
Branch: refs/heads/154-feature-gzip-post
Commit: 3186e160458582b82a350baf5ca3a91eea07eb89
Parents: 899a919
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Sun Dec 15 15:38:10 2013 -0500
Committer: Adam Kocoloski <ad...@cloudant.com>
Committed: Sun Dec 15 15:40:54 2013 -0500
----------------------------------------------------------------------
src/couchdb/couch_httpd.erl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/3186e160/src/couchdb/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index a370bd2..616c866 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -573,7 +573,11 @@ json_body_obj(Httpd) ->
maybe_decompress(Httpd, Body) ->
case header_value(Httpd, "Content-Encoding", "identity") of
"gzip" ->
- zlib:gunzip(Body);
+ try
+ zlib:gunzip(Body)
+ catch error:data_error ->
+ throw({bad_request, "Request body is not properly gzipped."})
+ end;
"identity" ->
Body;
Else ->