couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject svn commit: r988450 - in /couchdb/trunk: share/www/script/test/attachment_ranges.js src/couchdb/couch_httpd_db.erl
Date Tue, 24 Aug 2010 09:43:47 GMT
Author: rnewson
Date: Tue Aug 24 09:43:47 2010
New Revision: 988450

URL: http://svn.apache.org/viewvc?rev=988450&view=rev
Log:
return 400 Bad Request for unparseable range request.

Modified:
    couchdb/trunk/share/www/script/test/attachment_ranges.js
    couchdb/trunk/src/couchdb/couch_httpd_db.erl

Modified: couchdb/trunk/share/www/script/test/attachment_ranges.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/attachment_ranges.js?rev=988450&r1=988449&r2=988450&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/attachment_ranges.js (original)
+++ couchdb/trunk/share/www/script/test/attachment_ranges.js Tue Aug 24 09:43:47 2010
@@ -52,6 +52,14 @@ couchTests.attachment_ranges = function(
     TEquals("This is a base64 encoded text", xhr.responseText);
     TEquals("29", xhr.getResponseHeader("Content-Length"));
 
+    // Badly formed range header is a 400.
+    var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc/foo.txt", {
+        headers: {
+            "Range": "bytes:0-"
+        }
+    });
+    TEquals(400, xhr.status);
+
     // Fetch the end of an entity without an end offset is a 206.
     var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc/foo.txt", {
         headers: {

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=988450&r1=988449&r2=988450&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Tue Aug 24 09:43:47 2010
@@ -1059,6 +1059,8 @@ db_attachment_req(Req, _Db, _DocId, _Fil
 
 parse_ranges(undefined, Len) ->
     undefined;
+parse_ranges(fail, Len) ->
+    throw(bad_request);
 parse_ranges(Ranges, Len) ->
     parse_ranges(Ranges, Len, []).
 



Mime
View raw message