Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Cache-Control max-age should be an integer, per the spec #106

Closed
telent opened this Issue · 2 comments

2 participants

@telent

1) Actual HTTP headers from a sinatra app that calls Sinatra::Helpers.expires

HTTP/1.1 200 OK
Cache-Control: max-age=2591999.99982039
Expires: Thu, 25 Nov 2010 14:03:54 GMT
Last-Modified: Fri, 22 Oct 2010 11:03:26 GMT
Content-Type: application/javascript
Server: thin 1.2.7 codename No Hup
Content-Length: 57254
Date: Tue, 26 Oct 2010 16:35:24 GMT
X-Varnish: 1175818610 1175810556
Age: 9090
Via: 1.1 varnish
Connection: keep-alive

2) RFC 2616

3.3.2 Delta Seconds

 Some HTTP header fields allow a time value to be specified as an
 integer number of seconds, represented in decimal, after the time
 that the message was received.

    delta-seconds  = 1*DIGIT

3) A brief exploration with irb

irb(main):002:0> Time.now()+252800-Time.now()
=> 252799.999996931

4) A suggested fix would be to add .to_i when setting max_age

5) I apologise for the lack of a proper test and patch but I am under deadline pressure. Hopefully you can find the bug on the information I've given

@rkh
Owner

Yeah, this should be sufficient, thanks.

@rkh
Owner

Make sure max-age is an integer (as specified by RFC2616). Closed by 1bee791.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.