diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-11-04 22:27:58 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-11-04 22:27:58 +0900 |
| commit | f84d2253b2250ed5760398c189bfc8bf8dff1f69 (patch) | |
| tree | 19a84b1b75161152d5c3c338282596a2537e4c1d /src/AbstractCommand.cc | |
| parent | 6267676e8bba1566aa68a757359c9481b135cc6d (diff) | |
Rewritten util::split and added its iterator version.
Iterator based functions util::startsWith, util::endsWith,
util::streq, util::strieq were added.
Diffstat (limited to 'src/AbstractCommand.cc')
| -rw-r--r-- | src/AbstractCommand.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index d31d610c..9dd0ac39 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -589,16 +589,19 @@ namespace { bool inNoProxy(const SharedHandle<Request>& req, const std::string& noProxy) { - std::vector<std::string> entries; - util::split(noProxy, std::back_inserter(entries), ",", true); + std::vector<Scip> entries; + util::splitIter(noProxy.begin(), noProxy.end(), std::back_inserter(entries), + ',', true); if(entries.empty()) { return false; } - for(std::vector<std::string>::const_iterator i = entries.begin(), + for(std::vector<Scip>::const_iterator i = entries.begin(), eoi = entries.end(); i != eoi; ++i) { - std::string::size_type slashpos = (*i).find('/'); - if(slashpos == std::string::npos) { - if(util::noProxyDomainMatch(req->getHost(), *i)) { + std::string::const_iterator slashpos = + std::find((*i).first, (*i).second, '/'); + if(slashpos == (*i).second) { + if(util::noProxyDomainMatch + (req->getHost(), std::string((*i).first, (*i).second))) { return true; } } else { @@ -606,9 +609,9 @@ bool inNoProxy(const SharedHandle<Request>& req, // implementation is that we should first resolve // hostname(which may result in several IP addresses) and // evaluates against all of them - std::string ip = (*i).substr(0, slashpos); + std::string ip((*i).first, slashpos); uint32_t bits; - if(!util::parseUIntNoThrow(bits, (*i).begin()+slashpos+1, (*i).end())) { + if(!util::parseUIntNoThrow(bits, slashpos+1, (*i).second)) { continue; } if(util::inSameCidrBlock(ip, req->getHost(), bits)) { |
