rob05c commented on a change in pull request #2246: Add HitCount and FreshFor URL: https://github.com/apache/incubator-trafficcontrol/pull/2246#discussion_r188120447
########## File path: grove/web/util.go ########## @@ -198,3 +200,145 @@ func ParseHTTPDate(d string) (time.Time, bool) { // RemapTextKey is the plugin shared data key inserted by grovetccfg for the Remap Line of the Delivery Service in Traffic Control, Traffic Ops. const RemapTextKey = "remap_text" + +const Day = time.Hour * time.Duration(24) + +// GetHTTPDeltaSeconds is a helper function which gets an HTTP Delta Seconds from the given map (which is typically a `http.Header` or `CacheControl`. Returns false if the given key doesn't exist in the map, or if the value isn't a valid Delta Seconds per RFC2616ยง3.3.2. +func GetHTTPDeltaSeconds(m map[string][]string, key string) (time.Duration, bool) { Review comment: Is there a big reason these rules functions were moved? This function, and all the helper functions (`getCurrentAge`, `correctedInitialAge`, etc) are all very specifically implementing RFC 7234 and RFC 2616 rules. The `rules.go` file is intended to encapsulate those RFC rules, so someone doesn't think they can just change them to do what they need at the time. To make it more obvious "this file and these functions specifically implement the RFC". So, I'd kind of like to keep the Cache-Control RFC logic there. I've considered even giving `rules.go` its own package, for that reason. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services