summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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).