Stop using cv2pdb and improve HTTP handling a little

This commit is contained in:
2023-07-03 15:18:21 -04:00
parent ea10bddb0b
commit af62ac040f
4 changed files with 36 additions and 16 deletions

View File

@@ -1143,6 +1143,24 @@ eng::string HttpParser::first_path_component(std::string_view defval) const {
}
}
eng::string HttpParser::to_lua_identifier(std::string_view pathcomp) {
eng::ostringstream oss;
for (char c : pathcomp) {
if (sv::ascii_islower(c)) {
oss << c;
} else if (sv::ascii_isupper(c)) {
oss << char(c + 'a' - 'A');
} else if (sv::ascii_isdigit(c)) {
oss << c;
} else if ((c == '.') || (c == '_')) {
oss << '_';
} else {
return "";
}
}
return oss.str();
}
void HttpParser::fail(int code, std::string_view message) {
status_ = code;
error_ = message;