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

Side by Side Diff: net/proxy/proxy_config.h

Issue 12315019: Change ProxyRules to handle ProxyLists rather than just single ProxyServer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | net/proxy/proxy_config.cc » ('j') | net/proxy/proxy_config.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 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 #ifndef NET_PROXY_PROXY_CONFIG_H_ 5 #ifndef NET_PROXY_PROXY_CONFIG_H_
6 #define NET_PROXY_PROXY_CONFIG_H_ 6 #define NET_PROXY_PROXY_CONFIG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/proxy/proxy_bypass_rules.h" 12 #include "net/proxy/proxy_bypass_rules.h"
13 #include "net/proxy/proxy_config_source.h" 13 #include "net/proxy/proxy_config_source.h"
14 #include "net/proxy/proxy_list.h"
14 #include "net/proxy/proxy_server.h" 15 #include "net/proxy/proxy_server.h"
15 16
16 namespace base { 17 namespace base {
17 class Value; 18 class Value;
18 } 19 }
19 20
20 namespace net { 21 namespace net {
21 22
22 class ProxyInfo; 23 class ProxyInfo;
23 24
(...skipping 21 matching lines...) Expand all
45 46
46 // Note that the default of TYPE_NO_RULES results in direct connections 47 // Note that the default of TYPE_NO_RULES results in direct connections
47 // being made when using this ProxyConfig. 48 // being made when using this ProxyConfig.
48 ProxyRules(); 49 ProxyRules();
49 ~ProxyRules(); 50 ~ProxyRules();
50 51
51 bool empty() const { 52 bool empty() const {
52 return type == TYPE_NO_RULES; 53 return type == TYPE_NO_RULES;
53 } 54 }
54 55
55 // Sets |result| with the proxy to use for |url| based on the current rules. 56 // Sets |result| with the proxy to use for |url| based on the current rules.
eroman 2013/02/26 01:13:50 update: proxy --> proxies
marq_use_my_chromium_address 2013/02/27 23:08:19 Done.
56 void Apply(const GURL& url, ProxyInfo* result) const; 57 void Apply(const GURL& url, ProxyInfo* result) const;
57 58
58 // Parses the rules from a string, indicating which proxies to use. 59 // Parses the rules from a string, indicating which proxies to use.
59 // 60 //
60 // proxy-uri = [<proxy-scheme>"://"]<proxy-host>[":"<proxy-port>] 61 // proxy-uri = [<proxy-scheme>"://"]<proxy-host>[":"<proxy-port>]
61 // 62 //
62 // If the proxy to use depends on the scheme of the URL, can instead specify 63 // If the proxy to use depends on the scheme of the URL, can instead specify
63 // a semicolon separated list of: 64 // a semicolon separated list of:
64 // 65 //
65 // <url-scheme>"="<proxy-uri> 66 // <url-scheme>"="<proxy-uri>
66 // 67 //
68 //
69 // Multiple values can be specified for any given scheme, and they will
70 // be appended to the ProxyList for that scheme. If 'socks' is specified
71 // as a scheme, any schemes left without proxies specified will have
72 // that 'socks' server added.
eroman 2013/02/26 01:13:50 What about instead changing the grammar from: ur
marq_use_my_chromium_address 2013/02/27 23:08:19 Using this format to set things is the current pla
73 //
67 // For example: 74 // For example:
68 // "http=foopy:80;ftp=foopy2" -- use HTTP proxy "foopy:80" for http:// 75 // "http=foopy:80;ftp=foopy2" -- use HTTP proxy "foopy:80" for http://
69 // URLs, and HTTP proxy "foopy2:80" for 76 // URLs, and HTTP proxy "foopy2:80" for
70 // ftp:// URLs. 77 // ftp:// URLs.
71 // "foopy:80" -- use HTTP proxy "foopy:80" for all URLs. 78 // "foopy:80" -- use HTTP proxy "foopy:80" for all URLs.
72 // "socks4://foopy" -- use SOCKS v4 proxy "foopy:1080" for all 79 // "socks4://foopy" -- use SOCKS v4 proxy "foopy:1080" for all
73 // URLs. 80 // URLs.
81 // "http=foopy;http=bar.com; -- use HTTP proxy "foopy" for http URLs,
82 // and fail over to "bar.com" if "foopy"
83 // is unavailable.
84 // "http=foopy;http=direct:// -- use HTTP proxy "foopy" for http URLs,
85 // and use no proxy if "foopy" is
86 // unavailable.
87 // "http=foopy;socks=foopy2 -- use HTTP proxy "foopy" for http URLs,
88 // and use socks4://foopy2 for all other
89 // URLs.
74 void ParseFromString(const std::string& proxy_rules); 90 void ParseFromString(const std::string& proxy_rules);
75 91
76 // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp, 92 // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp,
77 // &fallback_proxy}, or NULL if there is no proxy to use. 93 // &fallback_proxy}, or NULL if there is no proxy to use.
78 // Should only call this if the type is TYPE_PROXY_PER_SCHEME. 94 // Should only call this if the type is TYPE_PROXY_PER_SCHEME.
79 const ProxyServer* MapUrlSchemeToProxy(const std::string& url_scheme) const; 95 const ProxyList* MapUrlSchemeToProxy(const std::string& url_scheme) const;
80 96
81 // Returns true if |*this| describes the same configuration as |other|. 97 // Returns true if |*this| describes the same configuration as |other|.
82 bool Equals(const ProxyRules& other) const; 98 bool Equals(const ProxyRules& other) const;
83 99
84 // Exceptions for when not to use a proxy. 100 // Exceptions for when not to use a proxy.
85 ProxyBypassRules bypass_rules; 101 ProxyBypassRules bypass_rules;
86 102
87 // Reverse the meaning of |bypass_rules|. 103 // Reverse the meaning of |bypass_rules|.
88 bool reverse_bypass; 104 bool reverse_bypass;
89 105
90 Type type; 106 Type type;
91 107
92 // Set if |type| is TYPE_SINGLE_PROXY. 108 // Set if |type| is TYPE_SINGLE_PROXY.
93 ProxyServer single_proxy; 109 ProxyList single_proxy;
eroman 2013/02/26 01:13:50 These names are no longer good, since they are act
marq_use_my_chromium_address 2013/02/27 23:08:19 Done.
94 110
95 // Set if |type| is TYPE_PROXY_PER_SCHEME. 111 // Set if |type| is TYPE_PROXY_PER_SCHEME.
96 ProxyServer proxy_for_http; 112 ProxyList proxy_for_http;
97 ProxyServer proxy_for_https; 113 ProxyList proxy_for_https;
98 ProxyServer proxy_for_ftp; 114 ProxyList proxy_for_ftp;
99 115
100 // Used when there isn't a more specific per-scheme proxy server. 116 // Used when a fallback (a socks= scheme) has been defined and the
eroman 2013/02/26 01:13:50 I don't think this comment should mention socks= h
marq_use_my_chromium_address 2013/02/27 23:08:19 Done.
101 ProxyServer fallback_proxy; 117 // url to be proxied doesn't match any of the standard schemes.
118 ProxyList fallback_proxy;
102 119
103 private: 120 private:
104 // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp} 121 // Returns one of {&proxy_for_http, &proxy_for_https, &proxy_for_ftp}
105 // or NULL if it is a scheme that we don't have a mapping 122 // or NULL if it is a scheme that we don't have a mapping
106 // for. Should only call this if the type is TYPE_PROXY_PER_SCHEME. 123 // for. Should only call this if the type is TYPE_PROXY_PER_SCHEME.
107 ProxyServer* MapUrlSchemeToProxyNoFallback(const std::string& scheme); 124 ProxyList* MapUrlSchemeToProxyNoFallback(const std::string& scheme);
108 }; 125 };
109 126
110 typedef int ID; 127 typedef int ID;
111 128
112 // Indicates an invalid proxy config. 129 // Indicates an invalid proxy config.
113 static const ID kInvalidConfigID = 0; 130 static const ID kInvalidConfigID = 0;
114 131
115 ProxyConfig(); 132 ProxyConfig();
116 ProxyConfig(const ProxyConfig& config); 133 ProxyConfig(const ProxyConfig& config);
117 ~ProxyConfig(); 134 ~ProxyConfig();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 ProxyConfigSource source_; 235 ProxyConfigSource source_;
219 236
220 ID id_; 237 ID id_;
221 }; 238 };
222 239
223 } // namespace net 240 } // namespace net
224 241
225 242
226 243
227 #endif // NET_PROXY_PROXY_CONFIG_H_ 244 #endif // NET_PROXY_PROXY_CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_config.cc » ('j') | net/proxy/proxy_config.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698