Let me introduce you to what I consider one of the worst hacks we have in current and modern internet protocols: the Public Suffix List (PSL). This is a list (maintained by Mozilla) with domains that have some kind administrative setup or arrangement that makes sub-domains independent. For example, you can't be allowed to set cookies for "*.com" because .com is a TLD that has independent domains. But the same thing goes for "*.co.uk" and there's no hint anywhere about this - except for the Public Suffix List. Then, take that simple little example and extrapolate to a domain system that grows with several new TLDs every month and more. The PSL is now several thousands of entries long.
And cookies isn't the only thing this is used for. Another really common and perhaps even more important use case is for wildcard matches in TLS server certificates. You should not be allowed to buy and use a cert for "*.co.uk" but you can for "*.yourcompany.co.uk"...
Not really official but still...
If you read the cookie RFC or the spec for how to do TLS wildcard certificate matching you won't read any line putting it crystal clear that the Suffix List is what you must use and I'm sure different browser solve this slightly differently but in practice and most unfortunately (if you ask me) you must either use the list or make your own to be fully compliant with how the web works 2014.
curl, wget and the PSL
In curl and libcurl, we have so far not taken the PSL into account which is by choice since I've not had any decent way to handle it and there are lots of embedded and other use cases that simply won't be able to cope with that large PSL chunk.
Wget hasn't had any PSL awareness either, but the recent weeks this has been brought up on the wget list and more attention has been given to this. Work has been initiated to do something about it, which has lead to...
I've mostly cheered the effort so far and said that I wouldn't mind building on this to enhance curl in the future if it just gets a suitable (liberal enough) license and it seems to go in that direction. For curl's sake, I would like to get a conditional dependency on this so that people without particular size restrictions can use this, and people on more embedded and special-purpose situations can continue to build without PSL support.
If you're interested in helping out in curl and libcurl in this area, feel most welcome!
Meanwhile, the IETF has set up a new mailing list called dbound for discussions around PSL and similar issues and it seems very timely!