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

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

Issue 399068: Move base64 from 'net/base' into 'base'. (Closed)
Patch Set: rebase Created 11 years, 1 month 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
« no previous file with comments | « net/base/strict_transport_security_state.cc ('k') | net/http/http_auth_handler_ntlm.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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>
8
9 #include "base/base64.h"
7 #include "base/string_util.h" 10 #include "base/string_util.h"
8 #include "net/http/http_auth.h" 11 #include "net/http/http_auth.h"
9 #include "net/base/base64.h"
10 12
11 namespace net { 13 namespace net {
12 14
13 // Note that if a realm was not specified, we will default it to ""; 15 // Note that if a realm was not specified, we will default it to "";
14 // so specifying 'Basic realm=""' is equivalent to 'Basic'. 16 // so specifying 'Basic realm=""' is equivalent to 'Basic'.
15 // 17 //
16 // This is more generous than RFC 2617, which is pretty clear in the 18 // This is more generous than RFC 2617, which is pretty clear in the
17 // production of challenge that realm is required. 19 // production of challenge that realm is required.
18 // 20 //
19 // We allow it to be compatibility with certain embedded webservers that don't 21 // We allow it to be compatibility with certain embedded webservers that don't
(...skipping 19 matching lines...) Expand all
39 return challenge_tok.valid(); 41 return challenge_tok.valid();
40 } 42 }
41 43
42 std::string HttpAuthHandlerBasic::GenerateCredentials( 44 std::string HttpAuthHandlerBasic::GenerateCredentials(
43 const std::wstring& username, 45 const std::wstring& username,
44 const std::wstring& password, 46 const std::wstring& password,
45 const HttpRequestInfo*, 47 const HttpRequestInfo*,
46 const ProxyInfo*) { 48 const ProxyInfo*) {
47 // TODO(eroman): is this the right encoding of username/password? 49 // TODO(eroman): is this the right encoding of username/password?
48 std::string base64_username_password; 50 std::string base64_username_password;
49 if (!Base64Encode(WideToUTF8(username) + ":" + WideToUTF8(password), 51 if (!base::Base64Encode(WideToUTF8(username) + ":" + WideToUTF8(password),
50 &base64_username_password)) 52 &base64_username_password))
51 return std::string(); // FAIL 53 return std::string(); // FAIL
52 return std::string("Basic ") + base64_username_password; 54 return std::string("Basic ") + base64_username_password;
53 } 55 }
54 56
55 } // namespace net 57 } // namespace net
OLDNEW
« no previous file with comments | « net/base/strict_transport_security_state.cc ('k') | net/http/http_auth_handler_ntlm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698