diff options
| author | frosty <frostinator33@airmail.cc> | 2026-10-27 21:25:54 -0400 |
|---|---|---|
| committer | frosty <frostinator33@airmail.cc> | 2026-10-27 21:25:54 -0400 |
| commit | 09e1f7e1eabb022c9093ed2961d0551f69608f23 (patch) | |
| tree | f1aa96c7bb50d58f04f1cbbf1d2e837c1b56a249 /src/Utility | |
| parent | 250898c638f07ace6bc7167faede93113c8fd0db (diff) | |
fix: use '+' delimiter for engines cookie to comply with RFC 6265
Diffstat (limited to 'src/Utility')
| -rw-r--r-- | src/Utility/Utility.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/Utility/Utility.c b/src/Utility/Utility.c index ed1ff13..dffb596 100644 --- a/src/Utility/Utility.c +++ b/src/Utility/Utility.c @@ -177,7 +177,7 @@ int get_user_engines(char ***out_ids, int *out_count) { } char *saveptr; - char *token = strtok_r(copy, ",", &saveptr); + char *token = strtok_r(copy, "+", &saveptr); while (token) { while (*token == ' ' || *token == '\t') token++; @@ -191,9 +191,30 @@ int get_user_engines(char ***out_ids, int *out_count) { } } - token = strtok_r(NULL, ",", &saveptr); + token = strtok_r(NULL, "+", &saveptr); } + if (count == 0) { + char *copy2 = strdup(cookie); + if (copy2) { + char *saveptr2 = NULL; + char *token2 = strtok_r(copy2, ",", &saveptr2); + while (token2) { + while (*token2 == ' ' || *token2 == '\t') + token2++; + if (token2[0] != '\0' && is_engine_id_enabled(token2)) { + char **new_ids = realloc(ids, sizeof(char *) * (count + 1)); + if (new_ids) { + ids = new_ids; + ids[count] = strdup(token2); + count++; + } + } + token2 = strtok_r(NULL, ",", &saveptr2); + } + free(copy2); + } + } free(copy); free(cookie); |
