Skip to content
Browse files

fix argument type conversion for digest stale option

git-svn-id: file:///srv/svn/limedav/better_httpauth/trunk@106 5302b642-3916-44d6-a90b-748a43cdb162
  • Loading branch information...
1 parent 206df22 commit a81d88633527ccf45dca2f596fc3ca43ec2a835f Tim Olsen committed with
Showing with 5 additions and 4 deletions.
  1. +2 −2 lib/httpauth/digest.rb
  2. +3 −2 test/digest_credentials_test.rb
View
4 lib/httpauth/digest.rb
@@ -54,7 +54,7 @@ class << self
# * <tt>variant</tt>: Specifies whether the directives are for an Authorize header (:credentials),
# for a WWW-Authenticate header (:challenge) or for a Authentication-Info header (:auth_info).
def encode_directives(h, variant)
- encode = {:domain => :list_to_space_quoted_string, :algorithm => false, :stale => :str_to_bool, :nc => :int_to_hex}
+ encode = {:domain => :list_to_space_quoted_string, :algorithm => false, :stale => :bool_to_str, :nc => :int_to_hex}
if [:credentials, :auth].include? variant
encode.merge! :qop => false
elsif variant == :challenge
@@ -88,7 +88,7 @@ def encode_directives(h, variant)
# for a WWW-Authenticate header (:challenge) or for a Authentication-Info header (:auth_info).
def decode_directives(directives, variant)
raise HTTPAuth::UnwellformedHeader.new("Can't decode directives which are nil") if directives.nil?
- decode = {:domain => :space_quoted_string_to_list, :algorithm => false, :stale => :bool_to_str, :nc => :hex_to_int, :nextnonce => :unquote_string}
+ decode = {:domain => :space_quoted_string_to_list, :algorithm => false, :stale => :str_to_bool, :nc => :hex_to_int}
if [:credentials, :auth].include? variant
decode.merge! :qop => false
elsif variant == :challenge
View
5 test/digest_credentials_test.rb
@@ -78,7 +78,8 @@ def test_from_blank
:method=>"GET",
:response=>"5e7bbe24dac88a1936edf1a89cae6168",
:cnonce=>"30b49be53eab919d",
- :qop=>"auth"
+ :qop=>"auth",
+ :stale => false
assert credentials.validate({})
end
-end
+end

0 comments on commit a81d886

Please sign in to comment.
Something went wrong with that request. Please try again.