summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2009-10-15 06:29:26 +0000
committerAdam Kocoloski <kocolosk@apache.org>2009-10-15 06:29:26 +0000
commitbc3b258fe7ae3ffee555a348066887dbe1bce8b6 (patch)
treeb6f29f27224be1e8cfae6fec93530500cb75ab8b /src
parent67cddcac3997fc800aed0f73c0b28a419059ccc4 (diff)
also fix attachment redirects
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@825407 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_rep_att.erl4
-rw-r--r--src/couchdb/couch_rep_httpc.erl4
2 files changed, 3 insertions, 5 deletions
diff --git a/src/couchdb/couch_rep_att.erl b/src/couchdb/couch_rep_att.erl
index baeb6c65..40ca4687 100644
--- a/src/couchdb/couch_rep_att.erl
+++ b/src/couchdb/couch_rep_att.erl
@@ -85,10 +85,8 @@ start_http_request(Req) ->
validate_headers(_Req, 200, _Headers) ->
ok;
validate_headers(Req, Code, Headers) when Code > 299, Code < 400 ->
- %% TODO check that the qs is actually included in the Location header
- %% TODO this only supports one level of redirection
Url = mochiweb_headers:get_value("Location",mochiweb_headers:make(Headers)),
- NewReq = Req#http_db{url=Url, resource="", qs=[]},
+ NewReq = couch_rep_httpc:redirected_request(Req, Url),
{ibrowse_req_id, ReqId} = couch_rep_httpc:request(NewReq),
receive {ibrowse_async_headers, ReqId, NewCode, NewHeaders} ->
ok = validate_headers(NewReq, list_to_integer(NewCode), NewHeaders)
diff --git a/src/couchdb/couch_rep_httpc.erl b/src/couchdb/couch_rep_httpc.erl
index d9e63b3b..55d8180e 100644
--- a/src/couchdb/couch_rep_httpc.erl
+++ b/src/couchdb/couch_rep_httpc.erl
@@ -14,8 +14,8 @@
-include("couch_db.hrl").
-include("../ibrowse/ibrowse.hrl").
--export([db_exists/1, db_exists/2, full_url/1, request/1, spawn_worker_process/1,
- spawn_link_worker_process/1]).
+-export([db_exists/1, db_exists/2, full_url/1, request/1, redirected_request/2,
+ spawn_worker_process/1, spawn_link_worker_process/1]).
request(Req) when is_record(Req, http_db) ->
do_request(Req).