| 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_negotiate.h" | 5 #include "net/http/http_auth_handler_negotiate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" |
| 9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/address_family.h" | 11 #include "net/base/address_family.h" |
| 11 #include "net/base/host_resolver.h" | 12 #include "net/base/host_resolver.h" |
| 12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 13 #include "net/http/http_auth_filter.h" | 14 #include "net/http/http_auth_filter.h" |
| 14 #include "net/http/url_security_manager.h" | 15 #include "net/http/url_security_manager.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 | 18 |
| 18 HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( | 19 HttpAuthHandlerNegotiate::HttpAuthHandlerNegotiate( |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 int port = origin.EffectiveIntPort(); | 162 int port = origin.EffectiveIntPort(); |
| 162 std::string server; | 163 std::string server; |
| 163 if (!address_list.GetCanonicalName(&server)) | 164 if (!address_list.GetCanonicalName(&server)) |
| 164 server = origin.host(); | 165 server = origin.host(); |
| 165 #if defined(OS_WIN) | 166 #if defined(OS_WIN) |
| 166 static const char kSpnSeparator = '/'; | 167 static const char kSpnSeparator = '/'; |
| 167 #elif defined(OS_POSIX) | 168 #elif defined(OS_POSIX) |
| 168 static const char kSpnSeparator = '@'; | 169 static const char kSpnSeparator = '@'; |
| 169 #endif | 170 #endif |
| 170 if (port != 80 && port != 443 && use_port_) { | 171 if (port != 80 && port != 443 && use_port_) { |
| 171 return ASCIIToWide(StringPrintf("HTTP%c%s:%d", kSpnSeparator, | 172 return ASCIIToWide(base::StringPrintf("HTTP%c%s:%d", kSpnSeparator, |
| 172 server.c_str(), port)); | 173 server.c_str(), port)); |
| 173 } else { | 174 } else { |
| 174 return ASCIIToWide(StringPrintf("HTTP%c%s", kSpnSeparator, server.c_str())); | 175 return ASCIIToWide(base::StringPrintf("HTTP%c%s", kSpnSeparator, |
| 176 server.c_str())); |
| 175 } | 177 } |
| 176 } | 178 } |
| 177 | 179 |
| 178 int HttpAuthHandlerNegotiate::DoLoop(int result) { | 180 int HttpAuthHandlerNegotiate::DoLoop(int result) { |
| 179 DCHECK(next_state_ != STATE_NONE); | 181 DCHECK(next_state_ != STATE_NONE); |
| 180 | 182 |
| 181 int rv = result; | 183 int rv = result; |
| 182 do { | 184 do { |
| 183 State state = next_state_; | 185 State state = next_state_; |
| 184 next_state_ = STATE_NONE; | 186 next_state_ = STATE_NONE; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 resolver_, disable_cname_lookup_, | 325 resolver_, disable_cname_lookup_, |
| 324 use_port_)); | 326 use_port_)); |
| 325 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 327 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
| 326 return ERR_INVALID_RESPONSE; | 328 return ERR_INVALID_RESPONSE; |
| 327 handler->swap(tmp_handler); | 329 handler->swap(tmp_handler); |
| 328 return OK; | 330 return OK; |
| 329 #endif | 331 #endif |
| 330 } | 332 } |
| 331 | 333 |
| 332 } // namespace net | 334 } // namespace net |
| OLD | NEW |