[Issue]: Parsing empty domain attributes in cookies
Julian Jørgensen <[email protected]> Mon, 27 Apr 2026 23:30:06 +0200
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <20260427233006.1162bcce@gottagofast> |
--MP_/vtUBU7zUrWQvXeO=wUIjnpU Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Dillo devs, Thanks for a great browser :-). I'm having great fun using it for accessing smaller sites. However, I might have found a minor issue with the way it handles cookies. I'm not very familiar with browser, so the problem is most likely on the site I'm trying to access. I use this pretty popular search engine called kagi.com. They have a html mode, which I enjoy testing in browsers like Dillo. The problem is that their session cookie is saved with an empty domain like so: `Domain=3D;`. As far as I can understand from [1], it seems that this should result in Dillo (the user agent?) ignoring this key/value pair. However, Dillo will parse the domain as "", which will fail the domain/host verification later in the program. I have attached a git formatted patch to demonstrate the issue. After applying this change, the kagi.com page works like I would expect. Best regards, Julian J=C3=B8rgensen [1]: https://www.rfc-editor.org/rfc/rfc6265#section-5.2.3 --MP_/vtUBU7zUrWQvXeO=wUIjnpU Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-Ignore-empty-Domain-key-value-pairs-in-cookies.patch >From afff02435655bc55d63000d7a1e8a67c54922f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20J=C3=B8rgensen?= <[email protected]> Date: Mon, 27 Apr 2026 22:50:04 +0200 Subject: [PATCH] Ignore empty Domain key-value pairs in cookies This should match what RFC 6265 section 5.2.4 states. --- dpi/cookies.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dpi/cookies.c b/dpi/cookies.c index aa6fb989..fa31deb3 100644 --- a/dpi/cookies.c +++ b/dpi/cookies.c @@ -932,8 +932,12 @@ static CookieData_t *Cookies_parse(char *cookie_str, const char *server_date) cookie->path = value; } else if (dStrAsciiCasecmp(attr, "Domain") == 0) { value = Cookies_parse_value(&str); - dFree(cookie->domain); - cookie->domain = value; + if (value[0] != '\0') { + dFree(cookie->domain); + cookie->domain = value; + } else { + dFree(value); + } } else if (dStrAsciiCasecmp(attr, "Max-Age") == 0) { value = Cookies_parse_value(&str); if (dIsdigit(*value) || *value == '-') { -- 2.54.0 --MP_/vtUBU7zUrWQvXeO=wUIjnpU Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected] To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected] --MP_/vtUBU7zUrWQvXeO=wUIjnpU--