phusion/passenger — pull request #93 by zilkey (2013-12-30 18:20:26+00:00)
Title: fix bug where Date header was incorrectly formatted as week-based year

Passenger sometimes gets the date wrong when appending the http Date header to responses. This happens when the week-based year differs from the calendar year. It happens because it uses `%G` to print the year when it should be using `%Y` (see this commit: https://github.com/phusion/passenger/commit/15ed1d4aef7aba8f635ce68c559583d61a3b267d).

Given the time `2013-12-30 18:12:11 UTC `, the date header using the week-based year is printed as:

`Mon, 30 Dec 2014 18:12:43 UTC`

Whereas the header using the calendar-based year would be printed as:

`Mon, 30 Dec 2013 18:13:26 UTC`

Notice that the week-based year is December of 2014. This causes cookies to appear invalid on any browser that uses the date header to calculate cookie expiration (such as Chrome). We discovered this today while debugging a problem where no users could log into our Rails app in Chrome or Firefox.

I'm not good enough at C++ yet to quickly write a unit test for this, but I wanted to submit this immediately because I imagine it is affecting a number of rails sites.