summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-09-13 00:57:28 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-09-13 00:57:28 +0000
commit8eafd77cc84844523e25513036c7434b966cf336 (patch)
tree1eff558ff59e5b8b78868c5090ce8880ee99a78a
parentc5b424d3415200a427d528d27d9c14fbfd810320 (diff)
Bug fix: add missing case for not preserving HTTP basic auth credentials after a redirect for _changes
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@996399 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/couchdb/couch_rep_changes_feed.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/couchdb/couch_rep_changes_feed.erl b/src/couchdb/couch_rep_changes_feed.erl
index c67d4948..54a5f62f 100644
--- a/src/couchdb/couch_rep_changes_feed.erl
+++ b/src/couchdb/couch_rep_changes_feed.erl
@@ -257,9 +257,10 @@ handle_next_changes(_From, State) ->
handle_headers(200, _, State) ->
maybe_stream_next(State),
{noreply, State};
-handle_headers(301, Hdrs, State) ->
+handle_headers(301, Hdrs, #state{init_args = InitArgs} = State) ->
catch ibrowse:stop_worker_process(State#state.conn),
- Url = mochiweb_headers:get_value("Location", mochiweb_headers:make(Hdrs)),
+ [_, #http_db{url = Url1} | _] = InitArgs,
+ Url = couch_rep_httpc:redirect_url(Hdrs, Url1),
%% TODO use couch_httpc:request instead of start_http_request
{Pid, ReqId} = start_http_request(Url),
{noreply, State#state{conn=Pid, reqid=ReqId}};