     @_totalBytes = 0
     @_lengthComputable = false
 
-    @setAgents @agents
+    @setAgents @_agents
 
   # @property {function(XMLHttpRequestProgressEvent)} DOM level 0-style handler
   #   for the 'readystatechange' event

  # Called when something wrong happens on the HTTP socket
  #
  # @private
  # @param {http.ClientRequest} request the node.js ClientRequest instance that
  #   fired this event
  _onHttpError: (request) ->
    return unless @_request is request

    @_request.abort()
    @_setError()
    @_dispatchProgress 'error'

  # set HTTP and/or HTTPS agent
  #
  # @param {Object} agents
  # @option agents {Object} http the HTTP agent, defaults to http.globalAgent
  # @option agents {Object} https the HTTPS agent, defaults to https.globalAgent
  setAgents: (agents) ->
    @_agents = {
      http: (agents and agents.http) or http.globalAgent,
      https: (agents and agents.https) or https.globalAgent
    }

  # Sets the XHR's method, URL, synchronous flag, and authentication params.
