I have the pleasure to frequently hack on libsoup as part of the great Igalia WebKit team. Many things are happening in libsoup but that’s a topic for some other upcoming post. Today I will talk about a new feature I landed just a few days ago and that will be shipped with the 2.40 release. I’m talking about the support for http://publicsuffix.org.

What’s that? The public suffix list is a community driven initiative from Mozilla whose aim is to provide a trusted list of well known public domain suffixes, like for example: .com, .space.museum or ايران.ir.

Why something like that is useful? Citing the web page, it can be used for:

  • Avoid privacy-damaging “supercookies” being set for high-level domain name suffixes
  • Highlight the most important part of a domain name in the user interface
  • Accurately sort history entries by site

My main motivation when I decided to implement it in libsoup was to fix the “supercookie” issue. Hosts could set cookies for a whole top level domain like .com, something that has important security and privacy considerations. Firefox, Chromium and Opera use it also for this purpose. Epiphany has just joined the group.

Apart from that it could be also used for visual stuff. Wondering how Firefox does something like this?

Domain highlighting
Firefox showing in bold font the URL base domain

The API is quite simple, basically there are 2 calls:

const char *soup_tld_get_base_domain   (const char *hostname,
                                        GError    **error);

gboolean    soup_tld_domain_is_public_suffix (const char *domain);

the first one returns a pointer to the start of the base domain of a URL (like www.igalia.com -> igalia.com  in the picture above) while the second one will tell you if a given domain is a well known public domain or not (libsoup uses it internally to block supercookies).

Leave a Reply

Your email address will not be published. Required fields are marked *