void ParseProxyList(string proxyListString, vector<SharedProxy>& proxyList, const string& urlScheme) { string sep = "; "; StringTokenizer proxyTokens(proxyListString, sep, StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); for (size_t i = 0; i < proxyTokens.count(); i++) { string entry = proxyTokens[i]; // If this entry defines a scheme, make it override the argument. string entryScheme; size_t schemeEnd = entry.find('='); if (schemeEnd != string::npos) { // This proxy only applies to the scheme before '=' entryScheme = entry.substr(0, schemeEnd); entry = entry.substr(schemeEnd + 1); } SharedProxy proxy(ParseProxyEntry(entry, urlScheme, entryScheme)); GetLogger()->Debug("Proxy entry: %s", proxy->ToString().c_str()); proxyList.push_back(proxy); } }
static void ParseProxyList(string proxyList, string bypassList, vector<SharedPtr<Proxy > >& ieProxyList) { std::string sep = "; "; StringTokenizer proxyTokens(proxyList, sep, StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); for (size_t i = 0; i < proxyTokens.count(); i++) { string entry = proxyTokens[i]; string scheme = ""; bool forScheme = false; size_t schemeEnd = entry.find('='); if (schemeEnd != string::npos) { // This proxy only applies to the scheme before '=' scheme = entry.substr(0, schemeEnd - 1); entry = entry.substr(schemeEnd + 1); } SharedPtr<Proxy> proxy = new Proxy; proxy->info = Proxy::ProxyEntryToURI(entry); // Set the scheme based on the value that came before '=' // We want this proxy to only apply to what it was specifically // set for. proxy->info->setScheme(scheme); ieProxyList.push_back(proxy); } if (ieProxyList.size() > 0 && !bypassList.empty()) { SharedPtr<Proxy> proxy = ieProxyList.at(0); ParseBypassList(bypassList, proxy->bypassList); } }