manually add protobuf generated files

This commit is contained in:
philippe44
2023-03-27 20:16:38 -07:00
parent fc78b36c1f
commit 31184b6946
14 changed files with 1258 additions and 15 deletions

View File

@@ -6,18 +6,20 @@ namespace bell {
void URLParser::parse(const char* url, std::vector<std::string>& match) {
match[0] = url;
char scratch[512];
/* Parsing the following (http|https://[host][/path][?query]#hash] as in regex
* below. This needs to be changed if you update that regex */
// get schema [http(s)]://
// get the schema
if (sscanf(url, "%[^:]:/", scratch) > 0) match[1] = scratch;
// get host http(s)://[host]
if (sscanf(url, "htt%*[^:]://%512[^/#]", scratch) > 0) match[2] = scratch;
// get the host
if (sscanf(url, "htt%*[^:]://%512[^/#?]", scratch) > 0) match[2] = scratch;
// get the path
url = strstr(url, match[2].c_str());
if (!url || *url == '\0') return;
url += match[2].size();
url = strstr(url, match[2].c_str()) + match[2].size();
if (sscanf(url, "/%512[^?]", scratch) > 0) match[3] = scratch;
else if (*url && *url != '?' && *url != '#') url++;
// get the query
if (match[3].size()) url += match[3].size() + 1;
@@ -30,6 +32,9 @@ void URLParser::parse(const char* url, std::vector<std::string>& match) {
// fix the acquired items
match[3] = "/" + match[3];
if (match[4].size()) match[4] = "?" + match[4];
// need at least schema and host
if (match[1].size() == 0 || match[2].size() == 0) match.clear();
}
#else
const std::regex URLParser::urlParseRegex = std::regex(

View File

@@ -34,7 +34,7 @@ class HTTPClient {
#ifndef BELL_DISABLE_FMT
return ValueHeader{"Range", fmt::format("bytes={}-{}", from, to)};
#else
return ValueHeader{"Range", "bytes=" + std::to_string(from) + "-" + std::to_string(to) };
return ValueHeader{"Range", "bytes=" + std::to_string(from) + "-" + std::to_string(to)};
#endif
}