vendor/bundle/ruby/2.1.0/gems/httpauth-0.2.1/lib/httpauth/digest.rb
def update_from_challenge!(options)
        # TODO: integrity checks
        @h[:username] = options[:username]
        @h[:password] = options[:password]
        @h[:digest] = options[:digest]
        @h[:uri] = options[:uri]
        @h[:method] = options[:method]
        @h[:request_body] = options[:request_body]
        unless @h[:qop].nil?
          # Determine the QOP
          if !options[:qop].nil? && @h[:qop].include?(options[:qop])
            @h[:qop] = options[:qop]
          elsif @h[:qop].include?(HTTPAuth::PREFERRED_QOP)
            @h[:qop] = HTTPAuth::PREFERRED_QOP
          else
            qop = @h[:qop].detect { |qop_field| HTTPAuth::SUPPORTED_QOPS.include? qop_field }
            if qop.nil?
              fail(UnsupportedError, "HTTPAuth doesn't support any of the proposed qop values: #{@h[:qop].inspect}")
            else
              @h[:qop] = qop
            end
          end
          @h[:cnonce] ||= Utils.create_nonce options[:salt]
          @h[:nc] ||= 1 unless @h[:qop].nil?
        end
        @h[:response] = Utils.calculate_digest(@h, @s, :request)
      end
# Updates @h from options, generally called after an instance was created with <tt>from_challenge</tt>.
Updates @h from options, generally called after an instance was created with from_challenge.
Updates @h from options generally called after an instance was created with from_challenge .
def update_from_challenge!(options)
        @h[:username] = options[:username]
        @h[:password] = options[:password]
        @h[:digest] = options[:digest]
        @h[:uri] = options[:uri]
        @h[:method] = options[:method]
        @h[:request_body] = options[:request_body]
        unless @h[:qop].nil?
          if !options[:qop].nil? && @h[:qop].include?(options[:qop])
            @h[:qop] = options[:qop]
          elsif @h[:qop].include?(HTTPAuth::PREFERRED_QOP)
            @h[:qop] = HTTPAuth::PREFERRED_QOP
          else
            qop = @h[:qop].detect { |qop_field| HTTPAuth::SUPPORTED_QOPS.include? qop_field }
            if qop.nil?
              fail(UnsupportedError, "HTTPAuth doesn't support any of the proposed qop values: #{@h[:qop].inspect}")
            else
              @h[:qop] = qop
            end
          end
          @h[:cnonce] ||= Utils.create_nonce options[:salt]
          @h[:nc] ||= 1 unless @h[:qop].nil?
        end
        @h[:response] = Utils.calculate_digest(@h, @s, :request)
      end
def update_from_challenge! ( options ) @h [ :username ] = options [ :username ] @h [ :password ] = options [ :password ] @h [ :digest ] = options [ :digest ] @h [ :uri ] = options [ :uri ] @h [ :method ] = options [ :method ] @h [ :request_body ] = options [ :request_body ] unless @h [ :qop ] . nil? if ! options [ :qop ] . nil? && @h [ :qop ] . include? ( options [ :qop ] ) @h [ :qop ] = options [ :qop ] elsif @h [ :qop ] . include? ( HTTPAuth :: PREFERRED_QOP ) @h [ :qop ] = HTTPAuth :: PREFERRED_QOP else qop = @h [ :qop ] . detect { | qop_field | HTTPAuth :: SUPPORTED_QOPS . include? qop_field } if qop . nil? fail ( UnsupportedError , "HTTPAuth doesn't support any of the proposed qop values: #{@h[:qop].inspect}" ) else @h [ :qop ] = qop end end @h [ :cnonce ] ||= Utils . create_nonce options [ :salt ] @h [ :nc ] ||= 1 unless @h [ :qop ] . nil? end @h [ :response ] = Utils . calculate_digest ( @h , @s , :request ) end
Updates @h from options, generally called after an instance was created with <tt>from_challenge</tt>.
Updates @h from options generally called after an instance was created with <tt > from_challenge< / tt > .
# TODO: integrity checks # Determine the QOP
options