-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[gzip]: allow gzip to work w/ http backend w/o content-lenght #14584
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ef3e731
[gzip]: allow gzip to work w/ http backend w/o content-lengt and/or t…
tehnerd 8e5f8c5
addressing comments
tehnerd 3793491
removing unused test params struct
tehnerd 8710f0a
Merge remote-tracking branch 'upstream/master' into fix_ws_w_compression
tehnerd 459a216
fixing merge issue
tehnerd 03976a4
moving back transfer-encoding tests for non chunked case
tehnerd 3c10ef8
addressing comments
tehnerd b2dfaa0
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd 1adea2c
adding integration test for connect proxy
tehnerd e0ab2b8
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd 9bbbd80
addressing comments
tehnerd d11a6e5
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd 775c591
addressing comments
tehnerd 8641490
addressing comments
tehnerd 9bfd2d3
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd 8a66e8d
fixing merge
tehnerd e226127
Merge branch 'main' of https://github.com/envoyproxy/envoy into fix_w…
tehnerd b9debc9
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd df4e677
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd 2aa410e
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd e8420e4
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd cc40eed
adding comments about compression integration tests in .h
tehnerd b35654a
fixing comments to itests
tehnerd 3e813bd
Merge remote-tracking branch 'upstream/main' into fix_ws_w_compression
tehnerd 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 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 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 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 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
#include "common/buffer/buffer_impl.h" | ||
#include "common/http/header_map_impl.h" | ||
#include "common/http/utility.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
|
@@ -156,7 +157,12 @@ Http::FilterHeadersStatus CompressorFilter::decodeHeaders(Http::RequestHeaderMap | |
} | ||
|
||
const auto& request_config = config_->requestDirectionConfig(); | ||
if (!end_stream && request_config.compressionEnabled() && | ||
const bool is_not_upgrade = | ||
!Http::Utility::isUpgrade(headers) || | ||
!Runtime::runtimeFeatureEnabled( | ||
"envoy.reloadable_features.enable_compression_without_content_length_header"); | ||
|
||
if (!end_stream && request_config.compressionEnabled() && is_not_upgrade && | ||
request_config.isMinimumContentLength(headers) && | ||
request_config.isContentTypeAllowed(headers) && | ||
!headers.getInline(request_content_encoding_handle.handle()) && | ||
|
@@ -221,7 +227,12 @@ Http::FilterHeadersStatus CompressorFilter::encodeHeaders(Http::ResponseHeaderMa | |
const auto& config = config_->responseDirectionConfig(); | ||
const bool isEnabledAndContentLengthBigEnough = | ||
config.compressionEnabled() && config.isMinimumContentLength(headers); | ||
const bool isCompressible = isEnabledAndContentLengthBigEnough && | ||
const bool is_not_upgrade = | ||
!Http::Utility::isUpgrade(headers) || | ||
!Runtime::runtimeFeatureEnabled( | ||
"envoy.reloadable_features.enable_compression_without_content_length_header"); | ||
Comment on lines
+230
to
+233
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. Alternatively split it into two different variables |
||
|
||
const bool isCompressible = isEnabledAndContentLengthBigEnough && is_not_upgrade && | ||
config.isContentTypeAllowed(headers) && | ||
!hasCacheControlNoTransform(headers) && isEtagAllowed(headers) && | ||
!headers.getInline(response_content_encoding_handle.handle()); | ||
|
@@ -506,7 +517,11 @@ bool CompressorFilterConfig::DirectionConfig::isMinimumContentLength( | |
} | ||
return is_minimum_content_length; | ||
} | ||
|
||
if (Runtime::runtimeFeatureEnabled( | ||
"envoy.reloadable_features.enable_compression_without_content_length_header")) { | ||
// return true to ignore the minimum length configuration if no content-length header is present | ||
return true; | ||
} | ||
return StringUtil::caseFindToken(headers.getTransferEncodingValue(), ",", | ||
Http::Headers::get().TransferEncodingValues.Chunked); | ||
alyssawilk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
This file contains 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems odd to have the value of
is_not_upgrade
be dependent on the runtime flag? Can we rename the variable to make a bit more sense?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idea was that we would drop runtime flag eventually and wont need to rename. if you feel strong about it - i will try to rework this part