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:05:40 UTC
[04/49] chttpd commit: updated refs/heads/windsor-merge to 554ef74
Use couch_httpd_db:parse_copy_destination_header
Remove parse_copy_destination_header and use the function defined
in couch_httpd_db instead.
Requires cloudant/dbcore@e9745834c164f6ef7f9e583bc4c36cdd83c415f4
so that parse_copy_destination_header is exported and has the
relevant backported code to throw an HTTP 400 if the COPY request
header does not have a Destination field.
BugzID: 18659
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/7932e0c0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/7932e0c0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/7932e0c0
Branch: refs/heads/windsor-merge
Commit: 7932e0c056de758ba6b0fce026b28e07da23634d
Parents: 57697a8
Author: Mike Wallace <mi...@googlemail.com>
Authored: Tue Apr 2 13:45:33 2013 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 29 17:11:14 2014 +0100
----------------------------------------------------------------------
src/chttpd_db.erl | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/7932e0c0/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 8839eb1..eff1cbf 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -684,7 +684,7 @@ db_doc_req(#httpd{method='COPY', user_ctx=Ctx}=Req, Db, SourceDocId) ->
missing_rev -> nil;
Rev -> Rev
end,
- {TargetDocId, TargetRevs} = parse_copy_destination_header(Req),
+ {TargetDocId, TargetRevs} = couch_httpd_db:parse_copy_destination_header(Req),
% open old doc
Doc = couch_doc_open(Db, SourceDocId, SourceRev, []),
% save new doc
@@ -1278,18 +1278,6 @@ extract_header_rev(Req, ExplicitRev) ->
end.
-parse_copy_destination_header(Req) ->
- Destination = chttpd:header_value(Req, "Destination"),
- case re:run(Destination, "\\?", [{capture, none}]) of
- nomatch ->
- {list_to_binary(Destination), {0, []}};
- match ->
- [DocId, RevQs] = re:split(Destination, "\\?", [{return, list}]),
- [_RevQueryKey, Rev] = re:split(RevQs, "=", [{return, list}]),
- {Pos, RevId} = couch_doc:parse_rev(Rev),
- {list_to_binary(DocId), {Pos, [RevId]}}
- end.
-
validate_attachment_names(Doc) ->
lists:foreach(fun(#att{name=Name}) ->
validate_attachment_name(Name)