| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_negotiate.h" | 5 #include "net/http/http_auth_handler_negotiate.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // ports. IE6 required a hotpatch and a registry setting to enable | 140 // ports. IE6 required a hotpatch and a registry setting to enable |
| 141 // including non-standard ports, and IE7 and IE8 also require the same | 141 // including non-standard ports, and IE7 and IE8 also require the same |
| 142 // registry setting, but no hotpatch. Firefox does not appear to have an | 142 // registry setting, but no hotpatch. Firefox does not appear to have an |
| 143 // option to include non-standard ports as of 3.6. | 143 // option to include non-standard ports as of 3.6. |
| 144 // http://support.microsoft.com/kb/908209 | 144 // http://support.microsoft.com/kb/908209 |
| 145 // | 145 // |
| 146 // Without any command-line flags, Chrome matches the behavior of Firefox | 146 // Without any command-line flags, Chrome matches the behavior of Firefox |
| 147 // and IE. Users can override the behavior so aliases are allowed and | 147 // and IE. Users can override the behavior so aliases are allowed and |
| 148 // non-standard ports are included. | 148 // non-standard ports are included. |
| 149 int port = origin.EffectiveIntPort(); | 149 int port = origin.EffectiveIntPort(); |
| 150 std::string server; | 150 std::string server = address_list.canonical_name(); |
| 151 if (!address_list.GetCanonicalName(&server)) | 151 if (server.empty()) |
| 152 server = origin.host(); | 152 server = origin.host(); |
| 153 #if defined(OS_WIN) | 153 #if defined(OS_WIN) |
| 154 static const char kSpnSeparator = '/'; | 154 static const char kSpnSeparator = '/'; |
| 155 #elif defined(OS_POSIX) | 155 #elif defined(OS_POSIX) |
| 156 static const char kSpnSeparator = '@'; | 156 static const char kSpnSeparator = '@'; |
| 157 #endif | 157 #endif |
| 158 if (port != 80 && port != 443 && use_port_) { | 158 if (port != 80 && port != 443 && use_port_) { |
| 159 return ASCIIToWide(base::StringPrintf("HTTP%c%s:%d", kSpnSeparator, | 159 return ASCIIToWide(base::StringPrintf("HTTP%c%s:%d", kSpnSeparator, |
| 160 server.c_str(), port)); | 160 server.c_str(), port)); |
| 161 } else { | 161 } else { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 bool HttpAuthHandlerNegotiate::CanDelegate() const { | 330 bool HttpAuthHandlerNegotiate::CanDelegate() const { |
| 331 // TODO(cbentzel): Should delegation be allowed on proxies? | 331 // TODO(cbentzel): Should delegation be allowed on proxies? |
| 332 if (target_ == HttpAuth::AUTH_PROXY) | 332 if (target_ == HttpAuth::AUTH_PROXY) |
| 333 return false; | 333 return false; |
| 334 if (!url_security_manager_) | 334 if (!url_security_manager_) |
| 335 return false; | 335 return false; |
| 336 return url_security_manager_->CanDelegate(origin_); | 336 return url_security_manager_->CanDelegate(origin_); |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace net | 339 } // namespace net |
| OLD | NEW |