This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new a0dd946  Do not drop updated httpdb record after auth headers are 
updated
a0dd946 is described below

commit a0dd94657f2f62b42fae2cdbd26b255e8fb95848
Author: Nick Vatamaniuc <vatam...@apache.org>
AuthorDate: Fri Apr 6 12:16:43 2018 -0400

    Do not drop updated httpdb record after auth headers are updated
    
    In replicator, after client auth plugin updates headers it could also update
    its private context. Make sure to pass the updated httpdb record along to
    response processing code.
    
    For example, session plugin updates the epoch number in its context, and it
    needs the epoch number later in response processing to make the decision
    whether to refresh the cookie or not.
---
 src/couch_replicator/src/couch_replicator_httpc.erl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/couch_replicator/src/couch_replicator_httpc.erl 
b/src/couch_replicator/src/couch_replicator_httpc.erl
index 2f865c6..e4cf116 100644
--- a/src/couch_replicator/src/couch_replicator_httpc.erl
+++ b/src/couch_replicator/src/couch_replicator_httpc.erl
@@ -71,14 +71,14 @@ send_req(HttpDb, Params1, Callback) ->
         [{K, ?b2l(iolist_to_binary(V))} || {K, V} <- get_value(qs, Params1, 
[])]),
     Params = ?replace(Params2, ibrowse_options,
         lists:keysort(1, get_value(ibrowse_options, Params2, []))),
-    {Worker, Response} = send_ibrowse_req(HttpDb, Params),
+    {Worker, Response, HttpDb1} = send_ibrowse_req(HttpDb, Params),
     Ret = try
-        process_response(Response, Worker, HttpDb, Params, Callback)
+        process_response(Response, Worker, HttpDb1, Params, Callback)
     catch
         throw:{retry, NewHttpDb0, NewParams0} ->
             {retry, NewHttpDb0, NewParams0}
     after
-        Pool = HttpDb#httpdb.httpc_pool,
+        Pool = HttpDb1#httpdb.httpc_pool,
         case get(?STOP_HTTP_WORKER) of
             stop ->
                 ok = stop_and_release_worker(Pool, Worker),
@@ -124,7 +124,7 @@ send_ibrowse_req(#httpdb{headers = BaseHeaders} = HttpDb0, 
Params) ->
     backoff_before_request(Worker, HttpDb, Params),
     Response = ibrowse:send_req_direct(
         Worker, Url, Headers2, Method, Body, IbrowseOptions, Timeout),
-    {Worker, Response}.
+    {Worker, Response, HttpDb}.
 
 
 %% Stop worker, wait for it to die, then release it. Make sure it is dead 
before

-- 
To stop receiving notification emails like this one, please contact
vatam...@apache.org.

Reply via email to