caching: Fully parse and handle request and response cache-control headers#11727
caching: Fully parse and handle request and response cache-control headers#11727htuch merged 39 commits intoenvoyproxy:masterfrom
Conversation
…ponse headers completely Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…l parsers Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
… headers to find out if a cache entry requires revalidation - revalidation not yet implemented Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
"public" response cache-control directives Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…eControl structs Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…imilar class names Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…headers correctly according to RFC7234 Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…t's constructor Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…r is production-ready Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…lter) checks for request no-store directives Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…Utils and HttpCache Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
|
@toddmgreer I addressed all your comments except those related to |
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…factors to improve readability & Fixed a bug that occurred in SimpleHttpCache tests because LookupRequest did not own the RequestCacheControl object Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…heHeaderUtils Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…and minimal optimizations Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
|
@toddmgreer all comments resolved. |
|
/azp run envoy-presubmit |
|
Commenter does not have sufficient privileges for PR 11727 in repo envoyproxy/envoy |
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
|
/retest |
|
🐴 hold your horses - no failures detected, yet. |
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
|
@yosrym93 do you mind fixing format? |
|
@junr03 It was the legacy codec problem, I merged master, it should be fixed. |
|
Yes, in particular I want @htuch to look at the asserts. |
| // Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate | ||
| // Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format | ||
| // Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format | ||
| static const char* rfc7231_date_formats[] = {"%a, %d %b %Y %H:%M:%S GMT", |
There was a problem hiding this comment.
Is GMT an example time zone or compulsory in this datetime format?
There was a problem hiding this comment.
This function was originally written by @toddmgreer in source/extensions/filters/http/cache/http_cache_utils.cc , I just moved it to this file. I think he has the answer to this.
There was a problem hiding this comment.
Compulsory.
See https://httpwg.org/specs/rfc7231.html#http.date, particularly the ABNF grammar.
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
htuch
left a comment
There was a problem hiding this comment.
LGTM modulo the nit and also bumping up coverage a bit. See https://storage.googleapis.com/envoy-pr/11727/coverage/source/extensions/filters/http/cache/cache_headers_utils.cc.gcov.html (and more generally the cache tree in https://storage.googleapis.com/envoy-pr/11727/coverage/source/extensions/filters/http/cache/index.html). Even debug lines should be exercised somehow.
/wait
|
@htuch I am fixing the const local variables now. For the coverage, the whole cache tree has low coverage before this PR (still WIP), this PR actually raises coverage by about 4-5% IIRC. I intend to start working on a separate PR to improve coverage & tests generally for this soon. |
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
htuch
left a comment
There was a problem hiding this comment.
LGTM, thanks! Looking forward to the coverage improvements.
…aders (envoyproxy#11727) Request and response cache-control headers are fully parsed in CacheHeadersUtils. isCacheableResponse in the CacheFilter now uses parsed cache-control headers to check if a received response can be cached. HttpCache now uses parsed cache-control headers to check if a cached response requires validation before it is served. Cache entries validation is not yet implemented. Signed-off-by: Yosry Ahmed yosryahmed@google.com Risk Level: Low Testing: Unit testing Docs Changes: N/A Release Notes: N/A Fixes envoyproxy#9833 Signed-off-by: Yosry Ahmed <yosryahmed@google.com> Signed-off-by: Kevin Baichoo <kbaichoo@google.com>
Commit Message: CacheFilter fully parses and handles request and response cache-control headers
Additional Description:
Request and response cache-control headers are fully parsed in
CacheHeadersUtils.isCacheableResponsein theCacheFilternow uses parsed cache-control headers to check if a received response can be cached.HttpCachenow uses parsed cache-control headers to check if a cached response requires validation before it is served. Cache entries validation is not yet implemented.Signed-off-by: Yosry Ahmed yosryahmed@google.com
Risk Level: Low
Testing: Unit testing
Docs Changes: N/A
Release Notes: N/A
Fixes #9833