Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: net/http/http_auth_handler_basic.cc

Issue 6191001: Cleanup: Use AUTH_SCHEME enum instead of a string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Merge with trunk Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth_handler.cc ('k') | net/http/http_auth_handler_digest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_auth_handler_basic.h" 5 #include "net/http/http_auth_handler_basic.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/http/http_auth.h" 13 #include "net/http/http_auth.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 // Note that if a realm was not specified, we will default it to ""; 17 // Note that if a realm was not specified, we will default it to "";
18 // so specifying 'Basic realm=""' is equivalent to 'Basic'. 18 // so specifying 'Basic realm=""' is equivalent to 'Basic'.
19 // 19 //
20 // This is more generous than RFC 2617, which is pretty clear in the 20 // This is more generous than RFC 2617, which is pretty clear in the
21 // production of challenge that realm is required. 21 // production of challenge that realm is required.
22 // 22 //
23 // We allow it to be compatibility with certain embedded webservers that don't 23 // We allow it to be compatibility with certain embedded webservers that don't
24 // include a realm (see http://crbug.com/20984.) 24 // include a realm (see http://crbug.com/20984.)
25 bool HttpAuthHandlerBasic::Init(HttpAuth::ChallengeTokenizer* challenge) { 25 bool HttpAuthHandlerBasic::Init(HttpAuth::ChallengeTokenizer* challenge) {
26 auth_scheme_ = AUTH_SCHEME_BASIC; 26 auth_scheme_ = HttpAuth::AUTH_SCHEME_BASIC;
27 scheme_ = "basic";
28 score_ = 1; 27 score_ = 1;
29 properties_ = 0; 28 properties_ = 0;
30 return ParseChallenge(challenge); 29 return ParseChallenge(challenge);
31 } 30 }
32 31
33 bool HttpAuthHandlerBasic::ParseChallenge( 32 bool HttpAuthHandlerBasic::ParseChallenge(
34 HttpAuth::ChallengeTokenizer* challenge) { 33 HttpAuth::ChallengeTokenizer* challenge) {
35 // Verify the challenge's auth-scheme. 34 // Verify the challenge's auth-scheme.
36 if (!LowerCaseEqualsASCII(challenge->scheme(), "basic")) 35 if (!LowerCaseEqualsASCII(challenge->scheme(), "basic"))
37 return false; 36 return false;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // TODO(cbentzel): Move towards model of parsing in the factory 92 // TODO(cbentzel): Move towards model of parsing in the factory
94 // method and only constructing when valid. 93 // method and only constructing when valid.
95 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerBasic()); 94 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerBasic());
96 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) 95 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log))
97 return ERR_INVALID_RESPONSE; 96 return ERR_INVALID_RESPONSE;
98 handler->swap(tmp_handler); 97 handler->swap(tmp_handler);
99 return OK; 98 return OK;
100 } 99 }
101 100
102 } // namespace net 101 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler.cc ('k') | net/http/http_auth_handler_digest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698