mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-09 16:52:09 +07:00
Fix mg_http_parse_header
Per standard, cookies are delimited by `; `. CL: Fix mg_http_parse_header: treat ";" as a delimiter. PUBLISHED_FROM=039243c30f5fabf4a4700a43506f841b3268306a
This commit is contained in:
committed by
Cesanta Bot
parent
b8eca17c55
commit
c2fbff6d0e
+3
-3
@@ -1644,7 +1644,7 @@ void mg_printf_html_escape(struct mg_connection *nc, const char *fmt, ...) {
|
||||
static void mg_http_parse_header_internal(struct mg_str *hdr,
|
||||
const char *var_name,
|
||||
struct altbuf *ab) {
|
||||
int ch = ' ', ch1 = ',', n = strlen(var_name);
|
||||
int ch = ' ', ch1 = ',', ch2 = ';', n = strlen(var_name);
|
||||
const char *p, *end = hdr ? hdr->p + hdr->len : NULL, *s = NULL;
|
||||
|
||||
/* Find where variable starts */
|
||||
@@ -1657,10 +1657,10 @@ static void mg_http_parse_header_internal(struct mg_str *hdr,
|
||||
if (s != NULL && &s[n + 1] < end) {
|
||||
s += n + 1;
|
||||
if (*s == '"' || *s == '\'') {
|
||||
ch = ch1 = *s++;
|
||||
ch = ch1 = ch2 = *s++;
|
||||
}
|
||||
p = s;
|
||||
while (p < end && p[0] != ch && p[0] != ch1) {
|
||||
while (p < end && p[0] != ch && p[0] != ch1 && p[0] != ch2) {
|
||||
if (ch != ' ' && p[0] == '\\' && p[1] == ch) p++;
|
||||
altbuf_append(ab, *p++);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user