Did a lot of work on the HTTP server side
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user