1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Merge pull request #338 from orgsync/fix-qop-parsing

quotes qop value prior to parsing
This commit is contained in:
John Nunemaker 2014-10-24 09:33:58 -04:00
commit a028de4298
2 changed files with 15 additions and 1 deletions

View file

@ -44,7 +44,10 @@ module Net
private
def parse(response_header)
response_header['www-authenticate'] =~ /Digest (.*)/
header = response_header['www-authenticate']
.gsub(/qop=(auth(?:-int)?)/, %Q(qop="\\1"))
header =~ /Digest (.*)/
params = {}
$1.gsub(/(\w+)="(.*?)"/) { params[$1] = $2 }
params

View file

@ -75,6 +75,17 @@ describe Net::HTTPHeader::DigestAuthenticator do
end
end
context "when quality of protection (qop) is unquoted" do
before do
@digest = setup_digest({
'www-authenticate' => 'Digest realm="myhost@testrealm.com", nonce="NONCE", qop=auth',
})
end
it "should still set qop" do
authorization_header.should include(%Q(qop="auth"))
end
end
context "with unspecified quality of protection (qop)" do
before do