summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_db.erl
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-01-15 23:12:56 +0000
committerDamien F. Katz <damien@apache.org>2009-01-15 23:12:56 +0000
commit1c13d302c9bfa4e6532fab6fd9c210acd64b962f (patch)
tree1682cbb16823542101fd0d36184e3a863677223b /src/couchdb/couch_httpd_db.erl
parent369dfbc2babdc2db0e5a07736b763bc06c5b9914 (diff)
Support for streaming attachment writes.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@734849 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_db.erl')
-rw-r--r--src/couchdb/couch_httpd_db.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 44b6265c..cdebb1e3 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -255,7 +255,7 @@ db_req(#httpd{path_parts=[_,<<"_admins">>]}=Req, _Db) ->
% Special case to enable using an unencoded slash in the URL of design docs,
% as slashes in document IDs must otherwise be URL encoded.
-db_req(#httpd{method='GET',mochi_req=MochiReq, path_parts=[DbName,<<"_design/",Name/binary>>|Rest]}=Req, Db) ->
+db_req(#httpd{method='GET',mochi_req=MochiReq, path_parts=[DbName,<<"_design/",_/binary>>|_]}=Req, _Db) ->
PathFront = "/" ++ binary_to_list(DbName) ++ "/_design",
{ok, [PathFront|PathTail]} = regexp:split(MochiReq:get(raw_path),"%2F"),
RedirectTo = PathFront ++ "/" ++ mochiweb_util:join(PathTail, "%2F"),
@@ -279,7 +279,6 @@ all_docs_view(Req, Db, Keys) ->
start_key = StartKey,
start_docid = StartDocId,
end_key = EndKey,
- end_docid = EndDocId,
limit = Limit,
skip = SkipCount,
direction = Dir
@@ -590,7 +589,12 @@ db_attachment_req(#httpd{method=Method}=Req, Db, DocId, FileNameParts)
_ ->
[{FileName, {
list_to_binary(couch_httpd:header_value(Req,"Content-Type")),
- couch_httpd:body(Req)
+ case couch_httpd:header_value(Req,"Content-Length") of
+ undefined ->
+ throw({bad_request, "Attachment uploads must be fixed length"});
+ Length ->
+ {fun() -> couch_httpd:recv(Req, 0) end, list_to_integer(Length)}
+ end
}}]
end,