Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be stricter when writing HTTP timestamps #18

Closed
zerebubuth opened this issue Feb 13, 2017 · 0 comments
Closed

Be stricter when writing HTTP timestamps #18

zerebubuth opened this issue Feb 13, 2017 · 0 comments
Assignees

Comments

@zerebubuth
Copy link
Member

The HTTP spec says:

All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception. For the purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal Time). This is indicated in the first two formats by the inclusion of "GMT" as the three-letter abbreviation for time zone...

Tapalcatl is currently sending timestamps in RFC1123Z format, which does not exactly comply with the spec. Most servers and clients appear to be fine parsing it, but it causes a problem with Varnish, as the latter is very strict. This, in turn, causes Fastly to be unable to take advantage of "304 Not Modified" responses to If-Modified-Since conditional requests.

The Go http package provides a TimeFormat constant and says:

TimeFormat is the time format to use when generating times in HTTP headers. It is like time.RFC1123 but hard-codes GMT as the time zone. The time being formatted must be in UTC for Format to generate the correct format.

We should use the http.TimeFormat for generating times, and http.ParseTime for parsing them, to make sure we're standards-compliant and Varnish is happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants