| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/proxy/proxy_server.h" | 5 #include "net/proxy/proxy_server.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/string_tokenizer.h" | 9 #include "base/string_tokenizer.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Parse the proxy scheme from a URL-like representation, to a | 41 // Parse the proxy scheme from a URL-like representation, to a |
| 42 // ProxyServer::Scheme. This corresponds with the values used in | 42 // ProxyServer::Scheme. This corresponds with the values used in |
| 43 // ProxyServer::ToURI(). If no type could be matched, returns SCHEME_INVALID. | 43 // ProxyServer::ToURI(). If no type could be matched, returns SCHEME_INVALID. |
| 44 ProxyServer::Scheme GetSchemeFromURI(std::string::const_iterator begin, | 44 ProxyServer::Scheme GetSchemeFromURI(std::string::const_iterator begin, |
| 45 std::string::const_iterator end) { | 45 std::string::const_iterator end) { |
| 46 if (LowerCaseEqualsASCII(begin, end, "http")) | 46 if (LowerCaseEqualsASCII(begin, end, "http")) |
| 47 return ProxyServer::SCHEME_HTTP; | 47 return ProxyServer::SCHEME_HTTP; |
| 48 if (LowerCaseEqualsASCII(begin, end, "socks4")) | 48 if (LowerCaseEqualsASCII(begin, end, "socks4")) |
| 49 return ProxyServer::SCHEME_SOCKS4; | 49 return ProxyServer::SCHEME_SOCKS4; |
| 50 if (LowerCaseEqualsASCII(begin, end, "socks")) |
| 51 return ProxyServer::SCHEME_SOCKS4; |
| 50 if (LowerCaseEqualsASCII(begin, end, "socks5")) | 52 if (LowerCaseEqualsASCII(begin, end, "socks5")) |
| 51 return ProxyServer::SCHEME_SOCKS5; | 53 return ProxyServer::SCHEME_SOCKS5; |
| 52 if (LowerCaseEqualsASCII(begin, end, "direct")) | 54 if (LowerCaseEqualsASCII(begin, end, "direct")) |
| 53 return ProxyServer::SCHEME_DIRECT; | 55 return ProxyServer::SCHEME_DIRECT; |
| 54 return ProxyServer::SCHEME_INVALID; | 56 return ProxyServer::SCHEME_INVALID; |
| 55 } | 57 } |
| 56 | 58 |
| 57 } // namespace | 59 } // namespace |
| 58 | 60 |
| 59 std::string ProxyServer::HostNoBrackets() const { | 61 std::string ProxyServer::HostNoBrackets() const { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 213 } |
| 212 | 214 |
| 213 // Choose a default port number if none was given. | 215 // Choose a default port number if none was given. |
| 214 if (port == -1) | 216 if (port == -1) |
| 215 port = GetDefaultPortForScheme(scheme); | 217 port = GetDefaultPortForScheme(scheme); |
| 216 | 218 |
| 217 return ProxyServer(scheme, host, port); | 219 return ProxyServer(scheme, host, port); |
| 218 } | 220 } |
| 219 | 221 |
| 220 } // namespace net | 222 } // namespace net |
| OLD | NEW |