Merge pull request #3140 from dag10/master

Fix URIs or header values containing tildes being unparsable.
This commit is contained in:
Sergio R. Caprile 2025-05-21 09:58:30 -03:00 committed by GitHub
commit 662cc27f4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1655,7 +1655,7 @@ static bool vcb(uint8_t c) {
static size_t clen(const char *s, const char *end) {
const unsigned char *u = (unsigned char *) s, c = *u;
long n = (long) (end - s);
if (c > ' ' && c < '~') return 1; // Usual ascii printed char
if (c > ' ' && c <= '~') return 1; // Usual ascii printed char
if ((c & 0xe0) == 0xc0 && n > 1 && vcb(u[1])) return 2; // 2-byte UTF8
if ((c & 0xf0) == 0xe0 && n > 2 && vcb(u[1]) && vcb(u[2])) return 3;
if ((c & 0xf8) == 0xf0 && n > 3 && vcb(u[1]) && vcb(u[2]) && vcb(u[3]))