File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -68,14 +68,13 @@ class HTTP::StaticFileHandler
68
68
context.response.headers[" Last-Modified" ] = HTTP .rfc1123_date(last_modified)
69
69
70
70
if if_modified_since = context.request.headers[" If-Modified-Since" ]?
71
- # TODO: Use a more generalized time format parser for better compatibility to RFC 7232
72
- header_time = Time .parse(if_modified_since, " %a, %d %b %Y %H:%M:%S GMT" )
71
+ header_time = HTTP .parse_time(if_modified_since)
73
72
74
73
# File mtime probably has a higher resolution than the header value.
75
74
# An exact comparison might be slightly off, so we add 1s padding.
76
75
# Static files should generally not be modified in subsecond intervals, so this is perfectly safe.
77
- # This might replaced by a more sophisticated time comparison when it becomes available.
78
- if last_modified <= header_time + 1 .second
76
+ # This might be replaced by a more sophisticated time comparison when it becomes available.
77
+ if header_time && last_modified <= header_time + 1 .second
79
78
context.response.status_code = 304
80
79
return
81
80
end
You can’t perform that action at this time.
0 commit comments