| OLD | NEW |
| 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_ntlm.h" | 5 #include "net/http/http_auth_handler_ntlm.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // GenerateType1Msg, and GenerateType3Msg, and perhaps further. | 31 // GenerateType1Msg, and GenerateType3Msg, and perhaps further. |
| 32 const void* in_buf; | 32 const void* in_buf; |
| 33 void* out_buf; | 33 void* out_buf; |
| 34 uint32 in_buf_len, out_buf_len; | 34 uint32 in_buf_len, out_buf_len; |
| 35 std::string decoded_auth_data; | 35 std::string decoded_auth_data; |
| 36 | 36 |
| 37 // |username| may be in the form "DOMAIN\user". Parse it into the two | 37 // |username| may be in the form "DOMAIN\user". Parse it into the two |
| 38 // components. | 38 // components. |
| 39 string16 domain; | 39 string16 domain; |
| 40 string16 user; | 40 string16 user; |
| 41 size_t backslash_idx = username->find(L'\\'); | 41 const char16 backslash_character = '\\'; |
| 42 if (backslash_idx == std::wstring::npos) { | 42 size_t backslash_idx = username->find(backslash_character); |
| 43 if (backslash_idx == string16::npos) { |
| 43 user = *username; | 44 user = *username; |
| 44 } else { | 45 } else { |
| 45 domain = username->substr(0, backslash_idx); | 46 domain = username->substr(0, backslash_idx); |
| 46 user = username->substr(backslash_idx + 1); | 47 user = username->substr(backslash_idx + 1); |
| 47 } | 48 } |
| 48 domain_ = domain; | 49 domain_ = domain; |
| 49 username_ = user; | 50 username_ = user; |
| 50 password_ = *password; | 51 password_ = *password; |
| 51 | 52 |
| 52 // Initial challenge. | 53 // Initial challenge. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // static | 112 // static |
| 112 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { | 113 std::wstring HttpAuthHandlerNTLM::CreateSPN(const GURL& origin) { |
| 113 // The service principal name of the destination server. See | 114 // The service principal name of the destination server. See |
| 114 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx | 115 // http://msdn.microsoft.com/en-us/library/ms677949%28VS.85%29.aspx |
| 115 std::wstring target(L"HTTP/"); | 116 std::wstring target(L"HTTP/"); |
| 116 target.append(ASCIIToWide(GetHostAndPort(origin))); | 117 target.append(ASCIIToWide(GetHostAndPort(origin))); |
| 117 return target; | 118 return target; |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace net | 121 } // namespace net |
| OLD | NEW |