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

Side by Side Diff: net/proxy/proxy_server.cc

Issue 3388021: Change the meaning of the command-line flag --proxy-server="socks://foo" to i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_server.h ('k') | net/proxy/proxy_server_unittest.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) 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/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Parse the proxy scheme from a URL-like representation, to a 43 // Parse the proxy scheme from a URL-like representation, to a
44 // ProxyServer::Scheme. This corresponds with the values used in 44 // ProxyServer::Scheme. This corresponds with the values used in
45 // ProxyServer::ToURI(). If no type could be matched, returns SCHEME_INVALID. 45 // ProxyServer::ToURI(). If no type could be matched, returns SCHEME_INVALID.
46 ProxyServer::Scheme GetSchemeFromURI(std::string::const_iterator begin, 46 ProxyServer::Scheme GetSchemeFromURI(std::string::const_iterator begin,
47 std::string::const_iterator end) { 47 std::string::const_iterator end) {
48 if (LowerCaseEqualsASCII(begin, end, "http")) 48 if (LowerCaseEqualsASCII(begin, end, "http"))
49 return ProxyServer::SCHEME_HTTP; 49 return ProxyServer::SCHEME_HTTP;
50 if (LowerCaseEqualsASCII(begin, end, "socks4")) 50 if (LowerCaseEqualsASCII(begin, end, "socks4"))
51 return ProxyServer::SCHEME_SOCKS4; 51 return ProxyServer::SCHEME_SOCKS4;
52 if (LowerCaseEqualsASCII(begin, end, "socks")) 52 if (LowerCaseEqualsASCII(begin, end, "socks"))
53 return ProxyServer::SCHEME_SOCKS4; 53 return ProxyServer::SCHEME_SOCKS5;
54 if (LowerCaseEqualsASCII(begin, end, "socks5")) 54 if (LowerCaseEqualsASCII(begin, end, "socks5"))
55 return ProxyServer::SCHEME_SOCKS5; 55 return ProxyServer::SCHEME_SOCKS5;
56 if (LowerCaseEqualsASCII(begin, end, "direct")) 56 if (LowerCaseEqualsASCII(begin, end, "direct"))
57 return ProxyServer::SCHEME_DIRECT; 57 return ProxyServer::SCHEME_DIRECT;
58 if (LowerCaseEqualsASCII(begin, end, "https")) 58 if (LowerCaseEqualsASCII(begin, end, "https"))
59 return ProxyServer::SCHEME_HTTPS; 59 return ProxyServer::SCHEME_HTTPS;
60 return ProxyServer::SCHEME_INVALID; 60 return ProxyServer::SCHEME_INVALID;
61 } 61 }
62 62
63 std::string HostNoBrackets(const std::string& host) { 63 std::string HostNoBrackets(const std::string& host) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (port == -1) 229 if (port == -1)
230 port = GetDefaultPortForScheme(scheme); 230 port = GetDefaultPortForScheme(scheme);
231 231
232 host_port_pair = HostPortPair(HostNoBrackets(host), port); 232 host_port_pair = HostPortPair(HostNoBrackets(host), port);
233 } 233 }
234 234
235 return ProxyServer(scheme, host_port_pair); 235 return ProxyServer(scheme, host_port_pair);
236 } 236 }
237 237
238 } // namespace net 238 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_server.h ('k') | net/proxy/proxy_server_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698