Skip to content

Commit

Permalink
Fix for bug 9608. adding check that tokenized header is valid.
Browse files Browse the repository at this point in the history
Review URL: http://codereview.chromium.org/60008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13050 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ace@google.com committed Apr 2, 2009
1 parent dbf6380 commit ce3bd9e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/http/http_auth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ void HttpAuth::CreateAuthHandler(const std::string& challenge,
scoped_refptr<HttpAuthHandler>* handler) {
// Find the right auth handler for the challenge's scheme.
ChallengeTokenizer props(challenge.begin(), challenge.end());
scoped_refptr<HttpAuthHandler> tmp_handler;
if (!props.valid()) {
*handler = NULL;
return;
}

scoped_refptr<HttpAuthHandler> tmp_handler;
if (LowerCaseEqualsASCII(props.scheme(), "basic")) {
tmp_handler = new HttpAuthHandlerBasic();
} else if (LowerCaseEqualsASCII(props.scheme(), "digest")) {
Expand Down
7 changes: 7 additions & 0 deletions net/http/http_auth_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ TEST(HttpAuthTest, ChooseBestChallenge) {

// Pick Digset over Basic
"DigestRealm",
},
{
"Y: Digest realm=\"X\", nonce=\"aaaaaaaaaa\"\n"
"www-authenticate:\n",

// Handle null header value.
"",
}
};

Expand Down

0 comments on commit ce3bd9e

Please sign in to comment.