You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/01 11:06:03 UTC
[27/49] chttpd commit: updated refs/heads/windsor-merge to 554ef74
Wrap decompression in a try/catch, report 400
BugzID: 24000
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/5dc36408
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/5dc36408
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/5dc36408
Branch: refs/heads/windsor-merge
Commit: 5dc36408b1431754ca6d8dabb5dc5c465c617aa8
Parents: 0d85df9
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Wed Oct 16 15:20:21 2013 -0400
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 29 18:25:28 2014 +0100
----------------------------------------------------------------------
src/chttpd.erl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/5dc36408/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 82aab96..7489d3a 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -872,7 +872,11 @@ json_stack_arity(A) ->
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 ->