anchor.diff:      
   make_attachment_stub_receiver(Url, Headers, Name, Type, Length, Retries) ->
       %% start the process that receives attachment data from ibrowse
  -    Pid = spawn_link(fun() -> attachment_loop(nil) end),
  +    #url{host=Host, port=Port} = ibrowse_lib:parse_url(Url),
  +    {ok, Conn} = ibrowse:spawn_link_worker_process(Host, Port),
  +    Pid = spawn_link(fun() -> attachment_loop(nil, Conn) end),
       
       %% make the async request
  -    Options = [{stream_to, Pid}, {response_format, binary}],
  -    ReqId = case ibrowse:send_req(Url, Headers, get, [], Options, infinity) of
  +    Opts = [{stream_to, Pid}, {response_format, binary}],
  +    ReqId = 
  +    case ibrowse:send_req_direct(Conn, Url, Headers, get, [], Opts, infinity) of
           {ibrowse_req_id, X} -> X;
           {error, _Reason} -> exit(attachment_request_failed)
       end,
  
positive.code:                     receive
                          {From, continue} -> 
                              %% normal case
                              attachment_loop(ReqId);
                          {From, fail} ->
                              %% error, failure code
                              ?LOG_ERROR(
                                  "streaming attachment failed with status ~p",
                                  [Status]),
                              exit(attachment_request_failed);
                          {From, stop_ok} ->
                              %% stop looping, controller will start a new loop
                              stop_ok
                      end
              end,
              attachment_loop(ReqId);
          {ibrowse_async_response, ReqId, {chunk_start,_}} ->
              attachment_loop(ReqId);
          {ibrowse_async_response, ReqId, chunk_end} ->
              attachment_loop(ReqId);
          {ibrowse_async_response, ReqId, {error, Err}} ->
              ?LOG_ERROR("streaming attachment failed with ~p", [Err]),
              exit(attachment_request_failed);
          {ibrowse_async_response, ReqId, Data} -> 
              receive {From, gimme_data} -> From ! {self(), Data} end,
              attachment_loop(ReqId);
          {ibrowse_async_response_end, ReqId} -> ok
      end.
  
  attachment_stub_converter(DbS, Id, Rev, {Name, {stub, Type, Length}}) ->
      #http_db{uri=DbUrl, headers=Headers} = DbS,
      {Pos, [RevId|_]} = Rev,
      Url = lists:flatten([DbUrl, url_encode(Id), "/", url_encode(?b2l(Name)),
          "?rev=", couch_doc:rev_to_str({Pos,RevId})]),
      ?LOG_DEBUG("Attachment URL ~p", [Url]),
      {ok, RcvFun} = make_attachment_stub_receiver(Url, Headers, Name, 
          Type, Length),
  
negative.code:         [Id, couch_doc:rev_to_str(Rev), Error]),
      dump_update_errors(Rest).
  
  attachment_loop(ReqId, Conn) ->
      couch_util:should_flush(),
      receive 
          {From, {set_req_id, NewId}} ->
              %% we learn the ReqId to listen for
              From ! {self(), {ok, NewId}},
              attachment_loop(NewId, Conn);
          {ibrowse_async_headers, ReqId, Status, Headers} ->
              %% we got header, give the controlling process a chance to react
              receive 
  