summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2009-03-27 00:26:39 +0000
committerJan Lehnardt <jan@apache.org>2009-03-27 00:26:39 +0000
commit6b53d12b758b8e917a92e9d34eb59aa575d000b7 (patch)
tree14dd379f74274a41273344a350b1d769bd7d77d8 /src
parent1dd554d884644bbf6f5a7d07b7c8fe51feb7a4c4 (diff)
Location header responses should be absolute URIs, thanks Christopher
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@758942 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_httpd_db.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 78b127b4..07815bda 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -56,7 +56,8 @@ create_db_req(#httpd{user_ctx=UserCtx}=Req, DbName) ->
case couch_server:create(DbName, [{user_ctx, UserCtx}]) of
{ok, Db} ->
couch_db:close(Db),
- send_json(Req, 201, [{"Location", "/" ++ DbName}], {[{ok, true}]});
+ DocUrl = absolute_uri(Req, "/" ++ DbName),
+ send_json(Req, 201, [{"Location", DocUrl}], {[{ok, true}]});
Error ->
throw(Error)
end.
@@ -496,8 +497,9 @@ db_doc_req(#httpd{method='POST'}=Req, Db, DocId) ->
]});
db_doc_req(#httpd{method='PUT'}=Req, Db, DocId) ->
+ Location = absolute_uri(Req, "/" ++ ?b2l(Db#db.name) ++ "/" ++ ?b2l(DocId)),
update_doc(Req, Db, DocId, couch_httpd:json_body(Req),
- [{"Location", "/" ++ ?b2l(Db#db.name) ++ "/" ++ ?b2l(DocId)}]);
+ [{"Location", Location}]);
db_doc_req(#httpd{method='COPY'}=Req, Db, SourceDocId) ->
SourceRev =