couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [24/50] chttpd commit: updated refs/heads/master to 58020ab
Date Thu, 28 Aug 2014 11:59:47 GMT
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/master
Commit: 5dc36408b1431754ca6d8dabb5dc5c465c617aa8
Parents: 0d85df9
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Wed Oct 16 15:20:21 2013 -0400
Committer: Robert Newson <rnewson@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 ->


Mime
View raw message