-
Notifications
You must be signed in to change notification settings - Fork 5.5k
filter: Add an incomplete pluggable HTTP caching filter (CacheFilter). #7198
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
Closed
Closed
Changes from 9 commits
Commits
Show all changes
121 commits
Select commit
Hold shift + click to select a range
55ea9a2
Add 'age' and 'expires' inline headers to support HTTP caching (#868).
toddmgreer f1a89f4
Add an incomplete pluggable HTTP caching filter (CacheFilter). (#868)
toddmgreer d5bb1c5
Add cache/config to BUILD file.
toddmgreer 72f3bea
Fix formatting.
toddmgreer 0611bed
Fix spelling, and expand spellcheck's dictionary.
toddmgreer 3123971
Rename config_lib to config.
toddmgreer 424e5bc
Add some RFC terms to spelling_dictionary.txt.
toddmgreer d77ff8c
Address clang-tidy findings.
toddmgreer b144193
Remove cache_filter_test until it has actual tests to run.
toddmgreer ee2431a
Address first batch of comments. More to come.
toddmgreer f432612
Style cleanups requested in first review, and a few more unit tests.
toddmgreer 1ac7e7a
Comment helper functions.
toddmgreer 3bb2056
Use absl::flat_hash_map instead of std::unordered_map.
toddmgreer f490c86
Fix formatting and spelling.
toddmgreer bfdf8ee
Add scheme checks to isCacheableRequest; misc cleanup.
toddmgreer 1442b8c
Add cache-control parsing TODO, and fix eatLeadingDuration's arg type.
toddmgreer ef53f4c
Fix SystemTime subtraction underflow, and improve tests.
toddmgreer b4ceab6
Add owners.
toddmgreer 45a9f45
Merge remote-tracking branch 'upstream/master'
toddmgreer 7bf20cd
Fix formatting.
toddmgreer 963f433
Merge remote-tracking branch 'upstream/master'
toddmgreer d1b272d
Add an empty api_proto_package to please check_format.
toddmgreer 9231814
Delete redundant absl deps.
toddmgreer a1fdd9b
Merge remote-tracking branch 'upstream/master'
toddmgreer 4812257
Return '{}' instead of 'SystemTime()', per modernize-return-braced-in…
toddmgreer 4ffced5
Prevent creation of an HttpCacheFilter that isn't owned by a shared_p…
toddmgreer 6f3a221
Add CacheFilterFactory tests.
toddmgreer f2bf5cb
Fix formatting.
toddmgreer 828331b
Fix formatting.
toddmgreer eda41c7
Fix formatting, this time with the right version of clang-format.
toddmgreer 56f6434
Add tests for RawByteRange
capoferro 8cc9562
Add tests for AdjustedByteRange.
capoferro 3e16e8d
Label death tests appropriately
capoferro 11e1520
Add assert tests for request headers in LookupRequest
capoferro d076283
Add tests for fallback header 'expired'
capoferro afc4523
Add CacheFilter test.
toddmgreer 969ee2f
Fix incorrect naming style.
toddmgreer 68995c3
Merge commit '81460d8482b73ba70ea15b76163a7c645e2a7b96'
toddmgreer d5edfae
Format fix.
toddmgreer f3161a2
Merge commit '51757dca1df458c78e63cccc6e7d0f357082bff0'
toddmgreer 705c573
Remove death tests and unnecessary suite classes
capoferro 80d3438
Merge pull request #1 from capoferro/raw_byte_range_test
toddmgreer 024a072
Merge branch 'master' into master
toddmgreer 7444101
Add cache filter to HttpFilterNameValues.
toddmgreer db1d528
Use HttpFilterNameValues::Cache in CacheFilterFactory
toddmgreer b72afdf
Make CacheFilter Loggable.
toddmgreer 2697008
Use HeaderMap::ForwardedProto instead of Scheme in cache key, because…
toddmgreer a30a784
Add CacheFilter integration test.
toddmgreer c8dafa0
Fix formatting
toddmgreer 8ff6ae4
Merge branch 'master' of github.com:toddmgreer/envoy
toddmgreer 03e1908
buildozer and spelling fixes
toddmgreer 8d44962
Adapted to upstream changes:
toddmgreer 4d3d57e
Minor cleanups
toddmgreer 84a8532
Change AdjustByteRange to use C++-style half-open intervals instead o…
toddmgreer 463994a
Explain reason to use std::enable_shared_from_this.
toddmgreer 48f046b
Clarify and comment out range handling code that can't yet be reached.
toddmgreer 03d1156
Style fixes.
toddmgreer 473e8fe
Make Cache.name required.
toddmgreer 259b755
Handle unexpected onBody callbacks.
toddmgreer 0097e24
Make adjustByteRangeSet public, with unit tests.
toddmgreer 296a420
Use class instead of namespace in http_cache_utils, per reviewer requ…
toddmgreer e83d95a
Make CacheFilter's internal helper functions static members, per envo…
toddmgreer a0af25b
Add effectiveMaxAge tests.
toddmgreer e5c030e
Merge commit 'eb9e13626830ad46a9c754035db3fa81b32a8f82' into HEAD
toddmgreer a249ff6
Merge commit '2591deacb306ec665812b1cf18fcaee57247ffd1' into HEAD
toddmgreer 3a9406a
Adapt to HeaderMap changes.
toddmgreer 6f91e36
Adapt to proto rules changes.
toddmgreer c1bb3a3
Add security_posture and status.
toddmgreer aaf9ad9
Add placeholder .rst
toddmgreer 2b33348
Move from v3alpha to v2, per htuch.
toddmgreer 39064e8
Fix rst file
toddmgreer aebd8ca
Add to http_filter.rst
toddmgreer d24a316
Fix formatting
toddmgreer 7a05205
Revert accidentally reformatted codec_impl.cc (partial revert of 84a8…
toddmgreer 4d0209f
Merge branch 'master' into master
toddmgreer d50765c
Change query_strings whitelist/blacklist to use oneof, and rename for…
toddmgreer a82a214
Improve config docs.
toddmgreer 34b14c2
Uncomment unimplemented fields in cache.proto, since the formatting t…
toddmgreer 29d50d1
Fix wrong BUILD deps incantation
toddmgreer 02c012f
Add proto migration annotations
toddmgreer 8925c4f
Unify range TODO
toddmgreer eec7683
Add generated BUILD/proto files.
toddmgreer 3bfe116
Fix TODO formatting
toddmgreer f209aef
Use FALLTHRU macro
toddmgreer 12876b3
Simplified HttpTimeTest to make it clear that it checks the results o…
toddmgreer 064e083
Added _ to struct member variable names.
toddmgreer 1782f2c
Add integration test TODO to test unimplemented features.
toddmgreer 9e5c10f
Remove unneeded dictionary addition
toddmgreer cffcc02
Rename envoy::config::filter::http::cache::v2::Cache to envoy::config…
toddmgreer 9f4a1c6
Add overview doc.
toddmgreer c796d4d
Change v3alpha to v3
toddmgreer dc05534
Use api.v2.route.QueryParameterMatcher to specify query params for keys.
toddmgreer 118191f
Use StringMatcher for allowed_vary_headers.
toddmgreer a2a9ae6
Add an overview of writing a cache storage implementation
toddmgreer 0ce2a64
Highlight field names in comments
toddmgreer dd0703f
Comment out TODO comments.
toddmgreer 4304cbc
Only create date format strings once.
toddmgreer 05c0566
simplify decl w/ auto
toddmgreer 1bc5928
Minor doc improvements; use reverse DNS for cache storage implementat…
toddmgreer 6885b82
*-highlight "vary" in comments.
toddmgreer 3f128e3
Correct missed SimpleHttpCache to envoy.extensions.http.cache.simple …
toddmgreer 9b1c68a
Update source/extensions/filters/http/cache/http_cache.h
toddmgreer 4585b14
Addressing review comments from mattklien123
toddmgreer f09822b
Add typed_config, and use getAndCheckFactory.
toddmgreer dbbcbd1
Pass config into cache storage implementations.
toddmgreer 386c18b
Put CacheConfig in v3
toddmgreer adb947e
Elaborated on the effects of allowed_vary_headers.
toddmgreer 1903ae0
Fix test error due to no longer requiring CacheConfig.name
toddmgreer 4f26ac8
Reran tools/proto_format.sh fix
toddmgreer 2028b99
Update v2->v3
toddmgreer 56ebd02
Fix various v2->v3 issues
toddmgreer 8e10a41
bazel build -c fastbuild @envoy_api_canonical//envoy/... now works
toddmgreer 063ba6d
Revert v3 changes
toddmgreer 50d20a6
Revert "Update v2->v3"
toddmgreer fdbc1c5
Revert "Reran tools/proto_format.sh fix"
toddmgreer 353e8a8
Revert "Put CacheConfig in v3"
toddmgreer 4027ab3
Got 'tools/proto_format.sh fix' to run successfully.
toddmgreer 3ebf4f2
Merge remote-tracking branch 'upstream/master'
toddmgreer 1b73cf0
tools/proto_format.sh fix
toddmgreer 62d01c8
Adapt to upstream factory changes
toddmgreer c0223c3
Comment out rst docs about unenabled config fields, to avoid dangling…
toddmgreer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library_internal") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| api_proto_library_internal( | ||
| name = "cache", | ||
| srcs = ["cache.proto"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.config.filter.http.cache.v2alpha; | ||
|
|
||
| option java_package = "io.envoyproxy.envoy.config.filter.http.cache.v2alpha"; | ||
| option java_outer_classname = "CacheProto"; | ||
| option java_multiple_files = true; | ||
| // [#protodoc-title: HTTP Cache Filter] | ||
| // `Design<https://docs.google.com/document/d/1WPuim_GzhfdsnIj_tf-fIeutK0jO4aVQfVrLJFoLN3g/view>`_ | ||
| // [#proto-status: experimental] | ||
|
|
||
| message Cache { | ||
|
|
||
| // Name of cache implementation to use. | ||
| string name = 1; | ||
|
|
||
| // List of allowed Vary headers. These headers will be provided to caches in lookups, and the | ||
| // cache filter will only insert responses whose Vary headers (if any) are all in this list. For | ||
| // example, if an origin supplies "vary:user-agent" in a response, the response will only be | ||
| // inserted if "user-agent" is in this list. | ||
| repeated string allowed_vary_headers = 2; | ||
|
|
||
| message KeyCreatorParams { | ||
| // If true, exclude the URL scheme from the cache key. | ||
| bool exclude_scheme = 1; | ||
|
|
||
| // If true, exclude the host from the cache key. | ||
| bool exclude_host = 2; | ||
|
|
||
| // If true, treat query_string_keys as a whitelist. | ||
| // If false, treat query_string_keys as a blacklist. | ||
| bool query_string_keys_whitelist = 3; | ||
|
|
||
| // The list of query string keys, to be treated as a whitelist/blacklist | ||
| // depending on the value of query_string_keys_whitelist. | ||
| // If your origins ignore all but a few query params, list them here and set | ||
| // query_string_keys_whitelist to true. | ||
| // If your origins only pay attention to a few params, list them here and | ||
| // leave query_string_keys_whitelist as false. | ||
| // If your origins ignore the query string entirely, leave this empty and | ||
| // set query_string_keys_whitelist to true. | ||
| // If you don't know what query params your origins may pay attention to, | ||
| // leave both query_string fields at their false/empty defaults. | ||
| repeated string query_string_keys = 4; | ||
| } | ||
| KeyCreatorParams key_creator_params = 3; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| ## Pluggable HTTP cache filter | ||
|
|
||
| load( | ||
| "//bazel:envoy_build_system.bzl", | ||
| "envoy_cc_library", | ||
| "envoy_package", | ||
| "envoy_proto_library", | ||
| ) | ||
|
|
||
| envoy_package() | ||
|
|
||
| envoy_cc_library( | ||
| name = "cache_filter_lib", | ||
| srcs = ["cache_filter.cc"], | ||
| hdrs = ["cache_filter.h"], | ||
| deps = [ | ||
| ":http_cache_lib", | ||
| "//include/envoy/registry", | ||
| "//source/common/common:macros", | ||
| "//source/common/http:header_map_lib", | ||
| "//source/common/http:headers_lib", | ||
| "//source/common/protobuf", | ||
| "//source/extensions/filters/http/common:pass_through_filter_lib", | ||
| "@envoy_api//envoy/config/filter/http/cache/v2alpha:cache_cc", | ||
| ], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "config", | ||
| srcs = ["config.cc"], | ||
| hdrs = ["config.h"], | ||
| deps = [ | ||
| ":cache_filter_lib", | ||
| ":key_cc", | ||
| "//include/envoy/common:time_interface", | ||
| "//include/envoy/registry", | ||
| "//include/envoy/stats:stats_interface", | ||
| "//source/extensions/filters/http/common:factory_base_lib", | ||
| ], | ||
| ) | ||
|
|
||
| envoy_proto_library( | ||
| name = "key", | ||
| srcs = ["key.proto"], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "http_cache_lib", | ||
| srcs = ["http_cache.cc"], | ||
| hdrs = ["http_cache.h"], | ||
| deps = [ | ||
| ":http_cache_utils_lib", | ||
| ":key_cc", | ||
| "//include/envoy/buffer:buffer_interface", | ||
| "//include/envoy/common:time_interface", | ||
| "//include/envoy/http:header_map_interface", | ||
| "//source/common/common:assert_lib", | ||
| "//source/common/http:headers_lib", | ||
| "//source/common/protobuf:utility_lib", | ||
| ], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "http_cache_utils_lib", | ||
| srcs = ["http_cache_utils.cc"], | ||
| hdrs = ["http_cache_utils.h"], | ||
| deps = [ | ||
| "//include/envoy/http:header_map_interface", | ||
| "@com_google_absl//absl/algorithm:container", | ||
| "@com_google_absl//absl/strings", | ||
| "@com_google_absl//absl/time", | ||
| ], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "simple_http_cache_lib", | ||
| srcs = ["simple_http_cache.cc"], | ||
| hdrs = ["simple_http_cache.h"], | ||
| deps = [ | ||
| ":http_cache_lib", | ||
| "//include/envoy/registry", | ||
| "//include/envoy/runtime:runtime_interface", | ||
| "//source/common/buffer:buffer_lib", | ||
| "//source/common/common:macros", | ||
| "//source/common/common:thread_lib", | ||
| "//source/common/http:header_map_lib", | ||
| "//source/common/http:headers_lib", | ||
| "//source/common/protobuf", | ||
| "//source/extensions/filters/http/common:pass_through_filter_lib", | ||
| "@com_google_absl//absl/base:core_headers", | ||
| "@envoy_api//envoy/config/filter/http/cache/v2alpha:cache_cc", | ||
| ], | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.