diff options
author | nicolas.dufresne@gmail.com <nicolas.dufresne@gmail.com@c587cffe-e639-0410-9787-d7902ae8ed56> | 2012-07-05 16:01:12 +0000 |
---|---|---|
committer | nicolas.dufresne@gmail.com <nicolas.dufresne@gmail.com@c587cffe-e639-0410-9787-d7902ae8ed56> | 2012-07-05 16:01:12 +0000 |
commit | 61048ad16366884c6a9b908a90fb56c875fe46c7 (patch) | |
tree | b1c3384447f88766ab15579f536bfabc9201007f /libproxy/modules/config_envvar.cpp | |
parent | 75d11a34620966a07638337959aa8cd8c9d89893 (diff) | |
download | libproxy-61048ad16366884c6a9b908a90fb56c875fe46c7.tar.gz |
Allow multiple result to be returned from static config
git-svn-id: http://libproxy.googlecode.com/svn/trunk@842 c587cffe-e639-0410-9787-d7902ae8ed56
Diffstat (limited to 'libproxy/modules/config_envvar.cpp')
-rw-r--r-- | libproxy/modules/config_envvar.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libproxy/modules/config_envvar.cpp b/libproxy/modules/config_envvar.cpp index f1c4e46..37713c7 100644 --- a/libproxy/modules/config_envvar.cpp +++ b/libproxy/modules/config_envvar.cpp @@ -24,17 +24,18 @@ using namespace libproxy; class envvar_config_extension : public config_extension { public: - url get_config(url url) throw (runtime_error) { - char *proxy = NULL; + vector<url> get_config(const url &dst) throw (runtime_error) { + const char *proxy = NULL; + vector<url> response; // If the URL is an ftp url, try to read the ftp proxy - if (url.get_scheme() == "ftp") { + if (dst.get_scheme() == "ftp") { if (!(proxy = getenv("ftp_proxy"))) proxy = getenv("FTP_PROXY"); } // If the URL is an https url, try to read the https proxy - if (url.get_scheme() == "https") { + if (dst.get_scheme() == "https") { if (!(proxy = getenv("https_proxy"))) proxy = getenv("HTTPS_PROXY"); } @@ -47,10 +48,12 @@ public: if (!proxy) throw runtime_error("Unable to read configuration"); - return libproxy::url(proxy); + + response.push_back(url(proxy)); + return response; } - string get_ignore(url) { + string get_ignore(const url&) { char *ignore = getenv("no_proxy"); ignore = ignore ? ignore : getenv("NO_PROXY"); return string(ignore ? ignore : ""); |