guzzle/guzzle — pull request #167 by fogs (2012-11-09 11:23:18+00:00)
Title:  Enhanced validity checking for cookies 

This patch refactors the validity checking of a cookie from ArrayCookieJar::add() to a dedicated method in Cookie, where it should better belong to. Also, the check for a valid cookie name now includes RFC compliance with regards to control characters.

PHPUnitTest cases were extended accordingly.

If you still disagree with domain being allow to have a value of "0", please remove the part from Cookie.php:488. IMHO, one should be free to setup a server with such a hostname in a private network and address it without the fully qualified domain name. But since I personally never will, I'm fine with either way.

Cookie names must be allowed being 0 as you are allowed to name them 1, 2 or 3. An empty string however must not be allowed.

Last thing: currently cookies that are invalid are silently rejected, when one tried to add them to the Jar. Shouldn't there be some kind of warning instead? It took me a while debugging my problem before I realized that not all cookies from a response ended up the the subsequent request..