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/HttpHeaderProcessor.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/HttpHeaderProcessor.cc')
| -rw-r--r-- | src/HttpHeaderProcessor.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/HttpHeaderProcessor.cc b/src/HttpHeaderProcessor.cc index 6cfce918..d196f6be 100644 --- a/src/HttpHeaderProcessor.cc +++ b/src/HttpHeaderProcessor.cc @@ -139,16 +139,17 @@ SharedHandle<HttpHeader> HttpHeaderProcessor::getHttpRequestHeader() delimpos < 14) { throw DL_RETRY_EX(EX_NO_STATUS_HEADER); } - std::vector<std::string> firstLine; - util::split(buf_.substr(0, delimpos), std::back_inserter(firstLine)," ",true); + std::vector<Scip> firstLine; + util::splitIter(buf_.begin(), buf_.begin()+delimpos, + std::back_inserter(firstLine), ' ', true); if(firstLine.size() != 3) { throw DL_ABORT_EX2("Malformed HTTP request header.", error_code::HTTP_PROTOCOL_ERROR); } SharedHandle<HttpHeader> httpHeader(new HttpHeader()); - httpHeader->setMethod(firstLine[0]); - httpHeader->setRequestPath(firstLine[1]); - httpHeader->setVersion(firstLine[2]); + httpHeader->setMethod(firstLine[0].first, firstLine[0].second); + httpHeader->setRequestPath(firstLine[1].first, firstLine[1].second); + httpHeader->setVersion(firstLine[2].first, firstLine[2].second); if((delimpos = buf_.find("\r\n\r\n")) == std::string::npos && (delimpos = buf_.find("\n\n")) == std::string::npos) { delimpos = buf_.size(); |
