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:     do_http_request(Url, Action, Headers, []).
  
  do_http_request(Url, Action, Headers, JsonBody) ->
      do_http_request(Url, Action, Headers, JsonBody, 10, 1000).
  
  do_http_request(Url, Action, Headers, Body, Retries, Pause) when is_binary(Url) ->
      do_http_request(?b2l(Url), Action, Headers, Body, Retries, Pause);
  do_http_request(Url, Action, _Headers, _JsonBody, 0, _Pause) ->
      ?LOG_ERROR("couch_rep HTTP ~p request failed after 10 retries: ~s", 
          [Action, Url]),
      exit({http_request_failed, ?l2b(["failed to replicate ", Url])});
  do_http_request(Url, Action, Headers, JsonBody, Retries, Pause) ->
      ?LOG_DEBUG("couch_rep HTTP ~p request: ~s", [Action, Url]),
      Body =
      case JsonBody of
  