# File lib/em-http/client.rb, line 285
    def unbind
      if finished? && (@last_effective_url != @uri) && (@redirects < @options[:redirects])
        begin
          # update uri to redirect location if we're allowed to traverse deeper
          @uri = @last_effective_url

          # keep track of the depth of requests we made in this session
          @redirects += 1

          # swap current connection and reassign current handler
          req = HttpOptions.new(@method, @uri, @options)
          reconnect(req.host, req.port)

          @response_header = HttpResponseHeader.new
          @state = :response_header
          @response = ''
          @data.clear
        rescue EventMachine::ConnectionError => e
          on_error(e.message, true)
        end
      else
        if finished?
          succeed(self)
        else
          @disconnect.call(self) if @state == :websocket and @disconnect
          fail(self)
        end
      end
    end