Did a lot of work on the HTTP server side

This commit is contained in:
2022-05-12 13:48:42 -04:00
parent 297ca3d56e
commit 9cf04a7741
6 changed files with 747 additions and 236 deletions

View File

@@ -218,6 +218,19 @@ string_view read_nbytes(string_view &source, int nbytes) {
return result;
}
string_view read_ascii_identifier(string_view &source) {
size_t len = 0;
if ((len < source.size()) && (sv::ascii_isalpha(source[len]))) {
len += 1;
while ((len < source.size()) && (sv::ascii_isalnum(source[len]))) {
len += 1;
}
}
string_view result = source.substr(0, len);
source.remove_prefix(len);
return result;
}
bool valid_utf8(string_view s)
{
const unsigned char *bytes = (const unsigned char *)s.data();