mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
quotes qop value prior to parsing
it is very common for this header to contain this value unquoted
This commit is contained in:
parent
fea7a189e8
commit
c187bb6341
2 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue