simplify string utilities

This commit is contained in:
Chunting Gu
2021-04-19 14:01:18 +08:00
parent f5f72d7897
commit 01210e8a42
16 changed files with 150 additions and 191 deletions
+5 -3
View File
@@ -1,8 +1,9 @@
#include "webcc/response_parser.h"
#include "boost/algorithm/string.hpp"
#include "webcc/logger.h"
#include "webcc/response.h"
#include "webcc/string.h"
namespace webcc {
@@ -25,7 +26,8 @@ void SplitStartLine(const std::string& line, std::vector<std::string>* parts) {
parts->push_back(line.substr(off, pos - off));
off = pos + 1;
for (; off < line.size() && line[off] == SPACE; ++off) {}
for (; off < line.size() && line[off] == SPACE; ++off) {
}
}
if (off < line.size()) {
@@ -53,7 +55,7 @@ bool ResponseParser::ParseStartLine(const std::string& line) {
return false;
}
if (!starts_with(parts[0], "HTTP/1.")) {
if (!boost::starts_with(parts[0], "HTTP/1.")) {
LOG_ERRO("Invalid HTTP version: %s", parts[0].c_str());
return false;
}