anchor.diff:              Pid ! {self(), stop_ok},
               RedirectUrl = mochiweb_headers:get_value("Location", 
                   mochiweb_headers:make(StreamHeaders)),
  -            make_attachment_stub_receiver(RedirectUrl, Headers, Name, Type, Length, 
  -                Retries - 1);
  +            catch ibrowse:stop_worker_process(Conn),
  +            make_attachment_stub_receiver(RedirectUrl, Headers, Name, Type,
  +                Length, Retries - 1, Pause);
           ResponseCode >= 400, ResponseCode < 500 -> 
               % an error... log and fail
               ?LOG_ERROR("streaming attachment failed with code ~p: ~s", 
  
positive.code:             exit(attachment_request_failed);
          ResponseCode == 500 ->
              % an error... log and retry
              ?LOG_INFO("retrying streaming attachment request due to 500 error: ~s", [Url]),
              Pid ! {self(), fail},
              make_attachment_stub_receiver(Url, Headers, Name, Type, Length, 
                  Retries - 1)
          end
      end.
  
  
negative.code:         ResponseCode >= 300, ResponseCode < 400 ->
              RedirectUrl = mochiweb_headers:get_value("Location", 
                  mochiweb_headers:make(ResponseHeaders)),
              do_http_request(RedirectUrl, Action, Headers, JsonBody, Retries-1,
                  Pause);
          ResponseCode >= 400, ResponseCode < 500 -> 
              ?JSON_DECODE(ResponseBody);        
          ResponseCode == 500 ->
              ?LOG_INFO("retrying couch_rep HTTP ~p request in ~p seconds " ++ 
                  "due to 500 error: ~s", [Action, Pause/1000, Url]),
              timer:sleep(Pause),
              do_http_request(Url, Action, Headers, JsonBody, Retries - 1, 2*Pause)
          end;
      {error, Reason} ->
          ?LOG_INFO("retrying couch_rep HTTP ~p request in ~p seconds due to " ++ 
              "{error, ~p}: ~s", [Action, Pause/1000, Reason, Url]),
          timer:sleep(Pause),
          do_http_request(Url, Action, Headers, JsonBody, Retries - 1, 2*Pause)
      end.
  
  ensure_full_commit(#http_db{uri=DbUrl, headers=Headers}) ->
  