soup_cookie_new() domain



Hi,

According to RFC 6265
https://tools.ietf.org/html/rfc6265#section-4.1.2.3

<cite>
...
If the server omits the Domain attribute, the user
agent will return the cookie only to the origin server.
...
</cite>

This is exactly the functionality that I wan't.

According to the documentation for soup_cookie_new()
https://developer.gnome.org/libsoup/stable/SoupCookie.html#soup-cookie-new
<cite>
...
If domain starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has domain as a suffix). Otherwise, it is a hostname and must match exactly.
...
</cite>
and the parameter domain is described as:
domain: cookie domain or hostname


How should I set the domain parameter to indicate that the Domain attribute should be omitted?

If I do not set the parameter domain i.e. setting it to NULL, I get a runtime warning.

I the source code I find this comment:
<cite>
        /* We ought to return if domain is NULL too, but this used to
         * do be incorrectly documented as legal, and it wouldn't
         * break anything as long as you called
         * soup_cookie_set_domain() immediately after. So we warn but
         * don't return, to discourage that behavior but not actually
         * break anyone doing it.
         */
</cite>

If I set domain to the empty string "", I don't get a warning, but this must still be wrong according to the libsoup documentation for domain for soup_cookie_new(), as it is neither a domain nor a hostname.

What will be the correct according to the libsoup documentation to set a cookie without the domain attribute as described in RFC 6265?

I would say that domain = NULL would be the right thing to specify, but I can see that someone writing the comment in the source code strongly disagree with that.

Best regards
Egon Andersen


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]