Remove old backwards compatibility cronet compression workaround code (#27701)
diff --git a/BUILD b/BUILD
index 0fa0d20..2eb48ca 100644
--- a/BUILD
+++ b/BUILD
@@ -1862,8 +1862,6 @@
"grpc_transport_chttp2_server_insecure",
"grpc_transport_inproc",
"grpc_fault_injection_filter",
- "grpc_workaround_cronet_compression_filter",
- "grpc_server_backward_compatibility",
],
)
@@ -2138,23 +2136,6 @@
)
grpc_cc_library(
- name = "grpc_workaround_cronet_compression_filter",
- srcs = [
- "src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc",
- ],
- hdrs = [
- "src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h",
- ],
- language = "c++",
- deps = [
- "config",
- "gpr_base",
- "grpc_base",
- "grpc_server_backward_compatibility",
- ],
-)
-
-grpc_cc_library(
name = "grpc_codegen",
language = "c++",
public_hdrs = [
@@ -3905,21 +3886,6 @@
)
grpc_cc_library(
- name = "grpc_server_backward_compatibility",
- srcs = [
- "src/core/ext/filters/workarounds/workaround_utils.cc",
- ],
- hdrs = [
- "src/core/ext/filters/workarounds/workaround_utils.h",
- ],
- language = "c++",
- deps = [
- "gpr_base",
- "grpc_base",
- ],
-)
-
-grpc_cc_library(
name = "grpc++_core_stats",
srcs = [
"src/cpp/util/core_stats.cc",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0edafd..59e111d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1126,7 +1126,6 @@
test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
test/core/end2end/tests/streaming_error_response.cc
test/core/end2end/tests/trailing_metadata.cc
- test/core/end2end/tests/workaround_cronet_compression.cc
test/core/end2end/tests/write_buffering.cc
test/core/end2end/tests/write_buffering_at_end.cc
test/core/util/test_lb_policies.cc
@@ -1274,7 +1273,6 @@
test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
test/core/end2end/tests/streaming_error_response.cc
test/core/end2end/tests/trailing_metadata.cc
- test/core/end2end/tests/workaround_cronet_compression.cc
test/core/end2end/tests/write_buffering.cc
test/core/end2end/tests/write_buffering_at_end.cc
test/core/util/test_lb_policies.cc
@@ -1559,8 +1557,6 @@
src/core/ext/filters/http/server/http_server_filter.cc
src/core/ext/filters/max_age/max_age_filter.cc
src/core/ext/filters/message_size/message_size_filter.cc
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
- src/core/ext/filters/workarounds/workaround_utils.cc
src/core/ext/service_config/service_config.cc
src/core/ext/service_config/service_config_parser.cc
src/core/ext/transport/chttp2/alpn/alpn.cc
@@ -2393,8 +2389,6 @@
src/core/ext/filters/http/server/http_server_filter.cc
src/core/ext/filters/max_age/max_age_filter.cc
src/core/ext/filters/message_size/message_size_filter.cc
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
- src/core/ext/filters/workarounds/workaround_utils.cc
src/core/ext/service_config/service_config.cc
src/core/ext/service_config/service_config_parser.cc
src/core/ext/transport/chttp2/alpn/alpn.cc
diff --git a/Makefile b/Makefile
index e34989d..b0642e7 100644
--- a/Makefile
+++ b/Makefile
@@ -1117,8 +1117,6 @@
src/core/ext/filters/http/server/http_server_filter.cc \
src/core/ext/filters/max_age/max_age_filter.cc \
src/core/ext/filters/message_size/message_size_filter.cc \
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
- src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/service_config/service_config.cc \
src/core/ext/service_config/service_config_parser.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
@@ -1798,8 +1796,6 @@
src/core/ext/filters/http/server/http_server_filter.cc \
src/core/ext/filters/max_age/max_age_filter.cc \
src/core/ext/filters/message_size/message_size_filter.cc \
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
- src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/service_config/service_config.cc \
src/core/ext/service_config/service_config_parser.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml
index 89174d6..c508388 100644
--- a/build_autogenerated.yaml
+++ b/build_autogenerated.yaml
@@ -122,7 +122,6 @@
- test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
- test/core/end2end/tests/streaming_error_response.cc
- test/core/end2end/tests/trailing_metadata.cc
- - test/core/end2end/tests/workaround_cronet_compression.cc
- test/core/end2end/tests/write_buffering.cc
- test/core/end2end/tests/write_buffering_at_end.cc
- test/core/util/test_lb_policies.cc
@@ -250,7 +249,6 @@
- test/core/end2end/tests/stream_compression_ping_pong_streaming.cc
- test/core/end2end/tests/streaming_error_response.cc
- test/core/end2end/tests/trailing_metadata.cc
- - test/core/end2end/tests/workaround_cronet_compression.cc
- test/core/end2end/tests/write_buffering.cc
- test/core/end2end/tests/write_buffering_at_end.cc
- test/core/util/test_lb_policies.cc
@@ -492,8 +490,6 @@
- src/core/ext/filters/http/server/http_server_filter.h
- src/core/ext/filters/max_age/max_age_filter.h
- src/core/ext/filters/message_size/message_size_filter.h
- - src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
- - src/core/ext/filters/workarounds/workaround_utils.h
- src/core/ext/service_config/service_config.h
- src/core/ext/service_config/service_config_call_data.h
- src/core/ext/service_config/service_config_parser.h
@@ -1034,8 +1030,6 @@
- src/core/ext/filters/http/server/http_server_filter.cc
- src/core/ext/filters/max_age/max_age_filter.cc
- src/core/ext/filters/message_size/message_size_filter.cc
- - src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
- - src/core/ext/filters/workarounds/workaround_utils.cc
- src/core/ext/service_config/service_config.cc
- src/core/ext/service_config/service_config_parser.cc
- src/core/ext/transport/chttp2/alpn/alpn.cc
@@ -1739,8 +1733,6 @@
- src/core/ext/filters/http/server/http_server_filter.h
- src/core/ext/filters/max_age/max_age_filter.h
- src/core/ext/filters/message_size/message_size_filter.h
- - src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
- - src/core/ext/filters/workarounds/workaround_utils.h
- src/core/ext/service_config/service_config.h
- src/core/ext/service_config/service_config_call_data.h
- src/core/ext/service_config/service_config_parser.h
@@ -2006,8 +1998,6 @@
- src/core/ext/filters/http/server/http_server_filter.cc
- src/core/ext/filters/max_age/max_age_filter.cc
- src/core/ext/filters/message_size/message_size_filter.cc
- - src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
- - src/core/ext/filters/workarounds/workaround_utils.cc
- src/core/ext/service_config/service_config.cc
- src/core/ext/service_config/service_config_parser.cc
- src/core/ext/transport/chttp2/alpn/alpn.cc
diff --git a/config.m4 b/config.m4
index 29bbc9d..daafc0c 100644
--- a/config.m4
+++ b/config.m4
@@ -112,8 +112,6 @@
src/core/ext/filters/http/server/http_server_filter.cc \
src/core/ext/filters/max_age/max_age_filter.cc \
src/core/ext/filters/message_size/message_size_filter.cc \
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
- src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/service_config/service_config.cc \
src/core/ext/service_config/service_config_parser.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
@@ -1089,7 +1087,6 @@
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/server)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/max_age)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/message_size)
- PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/workarounds)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/service_config)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/alpn)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client)
diff --git a/config.w32 b/config.w32
index ad43eec..a795466 100644
--- a/config.w32
+++ b/config.w32
@@ -78,8 +78,6 @@
"src\\core\\ext\\filters\\http\\server\\http_server_filter.cc " +
"src\\core\\ext\\filters\\max_age\\max_age_filter.cc " +
"src\\core\\ext\\filters\\message_size\\message_size_filter.cc " +
- "src\\core\\ext\\filters\\workarounds\\workaround_cronet_compression_filter.cc " +
- "src\\core\\ext\\filters\\workarounds\\workaround_utils.cc " +
"src\\core\\ext\\service_config\\service_config.cc " +
"src\\core\\ext\\service_config\\service_config_parser.cc " +
"src\\core\\ext\\transport\\chttp2\\alpn\\alpn.cc " +
@@ -1088,7 +1086,6 @@
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http\\server");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\max_age");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\message_size");
- FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\workarounds");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\service_config");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2");
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index cc1bd93..10ff61b 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -265,8 +265,6 @@
'src/core/ext/filters/http/server/http_server_filter.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
- 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
- 'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/service_config/service_config.h',
'src/core/ext/service_config/service_config_call_data.h',
'src/core/ext/service_config/service_config_parser.h',
@@ -938,8 +936,6 @@
'src/core/ext/filters/http/server/http_server_filter.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
- 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
- 'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/service_config/service_config.h',
'src/core/ext/service_config/service_config_call_data.h',
'src/core/ext/service_config/service_config_parser.h',
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index a3f1a36..36435b3 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -317,10 +317,6 @@
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.cc',
'src/core/ext/filters/message_size/message_size_filter.h',
- 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
- 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
- 'src/core/ext/filters/workarounds/workaround_utils.cc',
- 'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/service_config/service_config.cc',
'src/core/ext/service_config/service_config.h',
'src/core/ext/service_config/service_config_call_data.h',
@@ -1513,8 +1509,6 @@
'src/core/ext/filters/http/server/http_server_filter.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
- 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
- 'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/service_config/service_config.h',
'src/core/ext/service_config/service_config_call_data.h',
'src/core/ext/service_config/service_config_parser.h',
@@ -2219,7 +2213,6 @@
'test/core/end2end/tests/stream_compression_ping_pong_streaming.cc',
'test/core/end2end/tests/streaming_error_response.cc',
'test/core/end2end/tests/trailing_metadata.cc',
- 'test/core/end2end/tests/workaround_cronet_compression.cc',
'test/core/end2end/tests/write_buffering.cc',
'test/core/end2end/tests/write_buffering_at_end.cc',
'test/core/util/cmdline.cc',
diff --git a/grpc.gemspec b/grpc.gemspec
index aa22989..be68619 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -238,10 +238,6 @@
s.files += %w( src/core/ext/filters/max_age/max_age_filter.h )
s.files += %w( src/core/ext/filters/message_size/message_size_filter.cc )
s.files += %w( src/core/ext/filters/message_size/message_size_filter.h )
- s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc )
- s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h )
- s.files += %w( src/core/ext/filters/workarounds/workaround_utils.cc )
- s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h )
s.files += %w( src/core/ext/service_config/service_config.cc )
s.files += %w( src/core/ext/service_config/service_config.h )
s.files += %w( src/core/ext/service_config/service_config_call_data.h )
diff --git a/grpc.gyp b/grpc.gyp
index c14b3c4..bea7d9e 100644
--- a/grpc.gyp
+++ b/grpc.gyp
@@ -276,7 +276,6 @@
'test/core/end2end/tests/stream_compression_ping_pong_streaming.cc',
'test/core/end2end/tests/streaming_error_response.cc',
'test/core/end2end/tests/trailing_metadata.cc',
- 'test/core/end2end/tests/workaround_cronet_compression.cc',
'test/core/end2end/tests/write_buffering.cc',
'test/core/end2end/tests/write_buffering_at_end.cc',
'test/core/util/test_lb_policies.cc',
@@ -392,7 +391,6 @@
'test/core/end2end/tests/stream_compression_ping_pong_streaming.cc',
'test/core/end2end/tests/streaming_error_response.cc',
'test/core/end2end/tests/trailing_metadata.cc',
- 'test/core/end2end/tests/workaround_cronet_compression.cc',
'test/core/end2end/tests/write_buffering.cc',
'test/core/end2end/tests/write_buffering_at_end.cc',
'test/core/util/test_lb_policies.cc',
@@ -559,8 +557,6 @@
'src/core/ext/filters/http/server/http_server_filter.cc',
'src/core/ext/filters/max_age/max_age_filter.cc',
'src/core/ext/filters/message_size/message_size_filter.cc',
- 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
- 'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/service_config/service_config.cc',
'src/core/ext/service_config/service_config_parser.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
@@ -1215,8 +1211,6 @@
'src/core/ext/filters/http/server/http_server_filter.cc',
'src/core/ext/filters/max_age/max_age_filter.cc',
'src/core/ext/filters/message_size/message_size_filter.cc',
- 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
- 'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/service_config/service_config.cc',
'src/core/ext/service_config/service_config_parser.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
diff --git a/package.xml b/package.xml
index 0f5f05c..8081edf 100644
--- a/package.xml
+++ b/package.xml
@@ -218,10 +218,6 @@
<file baseinstalldir="/" name="src/core/ext/filters/max_age/max_age_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/message_size/message_size_filter.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/message_size/message_size_filter.h" role="src" />
- <file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc" role="src" />
- <file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h" role="src" />
- <file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_utils.cc" role="src" />
- <file baseinstalldir="/" name="src/core/ext/filters/workarounds/workaround_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/service_config/service_config.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/service_config/service_config.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/service_config/service_config_call_data.h" role="src" />
diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
deleted file mode 100644
index 5149dbf..0000000
--- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
+++ /dev/null
@@ -1,217 +0,0 @@
-//
-// Copyright 2017 gRPC authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <grpc/support/port_platform.h>
-
-#include "src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h"
-
-#include <string.h>
-
-#include <grpc/support/alloc.h>
-
-#include "src/core/ext/filters/workarounds/workaround_utils.h"
-#include "src/core/lib/channel/channel_stack_builder.h"
-#include "src/core/lib/config/core_configuration.h"
-#include "src/core/lib/transport/metadata.h"
-
-namespace {
-struct call_data {
- // Receive closures are chained: we inject this closure as the
- // recv_initial_metadata_ready up-call on transport_stream_op, and remember to
- // call our next_recv_initial_metadata_ready member after handling it.
- grpc_closure recv_initial_metadata_ready;
- // Used by recv_initial_metadata_ready.
- grpc_metadata_batch* recv_initial_metadata;
- // Original recv_initial_metadata_ready callback, invoked after our own.
- grpc_closure* next_recv_initial_metadata_ready;
-
- // Marks whether the workaround is active
- bool workaround_active;
-};
-} // namespace
-
-// Find the user agent metadata element in the batch
-static bool get_user_agent_mdelem(const grpc_metadata_batch* batch,
- grpc_mdelem* md) {
- if (batch->legacy_index()->named.user_agent != nullptr) {
- *md = batch->legacy_index()->named.user_agent->md;
- return true;
- }
- return false;
-}
-
-// Callback invoked when we receive an initial metadata.
-static void recv_initial_metadata_ready(void* user_data,
- grpc_error_handle error) {
- grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
- call_data* calld = static_cast<call_data*>(elem->call_data);
-
- if (GRPC_ERROR_NONE == error) {
- grpc_mdelem md;
- if (get_user_agent_mdelem(calld->recv_initial_metadata, &md)) {
- grpc_workaround_user_agent_md* user_agent_md = grpc_parse_user_agent(md);
- if (user_agent_md
- ->workaround_active[GRPC_WORKAROUND_ID_CRONET_COMPRESSION]) {
- calld->workaround_active = true;
- }
- }
- }
-
- // Invoke the next callback.
- grpc_core::Closure::Run(DEBUG_LOCATION,
- calld->next_recv_initial_metadata_ready,
- GRPC_ERROR_REF(error));
-}
-
-// Start transport stream op.
-static void cronet_compression_start_transport_stream_op_batch(
- grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
- call_data* calld = static_cast<call_data*>(elem->call_data);
-
- // Inject callback for receiving initial metadata
- if (op->recv_initial_metadata) {
- calld->next_recv_initial_metadata_ready =
- op->payload->recv_initial_metadata.recv_initial_metadata_ready;
- op->payload->recv_initial_metadata.recv_initial_metadata_ready =
- &calld->recv_initial_metadata_ready;
- calld->recv_initial_metadata =
- op->payload->recv_initial_metadata.recv_initial_metadata;
- }
-
- if (op->send_message) {
- /* Send message happens after client's user-agent (initial metadata) is
- * received, so workaround_active must be set already */
- if (calld->workaround_active) {
- op->payload->send_message.send_message->set_flags(
- op->payload->send_message.send_message->flags() |
- GRPC_WRITE_NO_COMPRESS);
- }
- }
-
- // Chain to the next filter.
- grpc_call_next_op(elem, op);
-}
-
-// Constructor for call_data.
-static grpc_error_handle cronet_compression_init_call_elem(
- grpc_call_element* elem, const grpc_call_element_args* /*args*/) {
- call_data* calld = static_cast<call_data*>(elem->call_data);
- calld->next_recv_initial_metadata_ready = nullptr;
- calld->workaround_active = false;
- GRPC_CLOSURE_INIT(&calld->recv_initial_metadata_ready,
- recv_initial_metadata_ready, elem,
- grpc_schedule_on_exec_ctx);
- return GRPC_ERROR_NONE;
-}
-
-// Destructor for call_data.
-static void cronet_compression_destroy_call_elem(
- grpc_call_element* /*elem*/, const grpc_call_final_info* /*final_info*/,
- grpc_closure* /*ignored*/) {}
-
-// Constructor for channel_data.
-static grpc_error_handle cronet_compression_init_channel_elem(
- grpc_channel_element* /*elem*/, grpc_channel_element_args* /*args*/) {
- return GRPC_ERROR_NONE;
-}
-
-// Destructor for channel_data.
-static void cronet_compression_destroy_channel_elem(
- grpc_channel_element* /*elem*/) {}
-
-// Parse the user agent
-static bool parse_user_agent(grpc_mdelem md) {
- const char grpc_objc_specifier[] = "grpc-objc/";
- const size_t grpc_objc_specifier_len = sizeof(grpc_objc_specifier) - 1;
- const char cronet_specifier[] = "cronet_http";
- const size_t cronet_specifier_len = sizeof(cronet_specifier) - 1;
-
- char* user_agent_str = grpc_slice_to_c_string(GRPC_MDVALUE(md));
- bool grpc_objc_specifier_seen = false;
- bool cronet_specifier_seen = false;
- char *major_version_str = user_agent_str, *minor_version_str;
- long major_version = 0, minor_version = 0;
-
- char* head = strtok(user_agent_str, " ");
- while (head != nullptr) {
- if (!grpc_objc_specifier_seen &&
- 0 == strncmp(head, grpc_objc_specifier, grpc_objc_specifier_len)) {
- major_version_str = head + grpc_objc_specifier_len;
- grpc_objc_specifier_seen = true;
- } else if (grpc_objc_specifier_seen &&
- 0 == strncmp(head, cronet_specifier, cronet_specifier_len)) {
- cronet_specifier_seen = true;
- break;
- }
-
- head = strtok(nullptr, " ");
- }
- if (grpc_objc_specifier_seen) {
- major_version_str = strtok(major_version_str, ".");
- minor_version_str = strtok(nullptr, ".");
- major_version = atol(major_version_str);
- minor_version = atol(minor_version_str);
- }
-
- gpr_free(user_agent_str);
- return (grpc_objc_specifier_seen && cronet_specifier_seen &&
- (major_version < 1 || (major_version == 1 && minor_version <= 3)));
-}
-
-const grpc_channel_filter grpc_workaround_cronet_compression_filter = {
- cronet_compression_start_transport_stream_op_batch,
- grpc_channel_next_op,
- sizeof(call_data),
- cronet_compression_init_call_elem,
- grpc_call_stack_ignore_set_pollset_or_pollset_set,
- cronet_compression_destroy_call_elem,
- 0,
- cronet_compression_init_channel_elem,
- cronet_compression_destroy_channel_elem,
- grpc_channel_next_get_info,
- "workaround_cronet_compression"};
-
-static bool register_workaround_cronet_compression(
- grpc_channel_stack_builder* builder) {
- const grpc_channel_args* channel_args =
- grpc_channel_stack_builder_get_channel_arguments(builder);
- const grpc_arg* a = grpc_channel_args_find(
- channel_args, GRPC_ARG_WORKAROUND_CRONET_COMPRESSION);
- if (a == nullptr) {
- return true;
- }
- if (!grpc_channel_arg_get_bool(a, false)) {
- return true;
- }
- return grpc_channel_stack_builder_prepend_filter(
- builder, &grpc_workaround_cronet_compression_filter, nullptr, nullptr);
-}
-
-void grpc_workaround_cronet_compression_filter_init(void) {
- grpc_register_workaround(GRPC_WORKAROUND_ID_CRONET_COMPRESSION,
- parse_user_agent);
-}
-
-void grpc_workaround_cronet_compression_filter_shutdown(void) {}
-
-namespace grpc_core {
-void RegisterWorkaroundCronetCompressionFilter(
- CoreConfiguration::Builder* builder) {
- builder->channel_init()->RegisterStage(
- GRPC_SERVER_CHANNEL, GRPC_WORKAROUND_PRIORITY_HIGH,
- register_workaround_cronet_compression);
-}
-} // namespace grpc_core
diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
deleted file mode 100644
index 94d20f0..0000000
--- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// Copyright 2017 gRPC authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_CRONET_COMPRESSION_FILTER_H
-#define GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_CRONET_COMPRESSION_FILTER_H
-
-#include <grpc/support/port_platform.h>
-
-#include "src/core/lib/channel/channel_stack.h"
-
-extern const grpc_channel_filter grpc_workaround_cronet_compression_filter;
-
-#endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_CRONET_COMPRESSION_FILTER_H \
- */
diff --git a/src/core/ext/filters/workarounds/workaround_utils.cc b/src/core/ext/filters/workarounds/workaround_utils.cc
deleted file mode 100644
index 2a184ba..0000000
--- a/src/core/ext/filters/workarounds/workaround_utils.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Copyright 2017 gRPC authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <grpc/support/port_platform.h>
-
-#include "src/core/ext/filters/workarounds/workaround_utils.h"
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-
-user_agent_parser ua_parser[GRPC_MAX_WORKAROUND_ID];
-
-static void destroy_user_agent_md(void* user_agent_md) {
- gpr_free(user_agent_md);
-}
-
-grpc_workaround_user_agent_md* grpc_parse_user_agent(grpc_mdelem md) {
- grpc_workaround_user_agent_md* user_agent_md =
- static_cast<grpc_workaround_user_agent_md*>(
- grpc_mdelem_get_user_data(md, destroy_user_agent_md));
-
- if (nullptr != user_agent_md) {
- return user_agent_md;
- }
- user_agent_md = static_cast<grpc_workaround_user_agent_md*>(
- gpr_malloc(sizeof(grpc_workaround_user_agent_md)));
- for (int i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
- if (ua_parser[i]) {
- user_agent_md->workaround_active[i] = ua_parser[i](md);
- }
- }
- grpc_mdelem_set_user_data(md, destroy_user_agent_md, user_agent_md);
-
- return user_agent_md;
-}
-
-void grpc_register_workaround(uint32_t id, user_agent_parser parser) {
- GPR_ASSERT(id < GRPC_MAX_WORKAROUND_ID);
- ua_parser[id] = parser;
-}
diff --git a/src/core/ext/filters/workarounds/workaround_utils.h b/src/core/ext/filters/workarounds/workaround_utils.h
deleted file mode 100644
index f172ccc..0000000
--- a/src/core/ext/filters/workarounds/workaround_utils.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Copyright 2017 gRPC authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H
-#define GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H
-
-#include <grpc/support/port_platform.h>
-
-#include <grpc/support/workaround_list.h>
-
-#include "src/core/lib/transport/metadata.h"
-
-#define GRPC_WORKAROUND_PRIORITY_HIGH 10001
-#define GRPC_WORKAROUND_PROIRITY_LOW 9999
-
-typedef struct grpc_workaround_user_agent_md {
- bool workaround_active[GRPC_MAX_WORKAROUND_ID];
-} grpc_workaround_user_agent_md;
-
-grpc_workaround_user_agent_md* grpc_parse_user_agent(grpc_mdelem md);
-
-typedef bool (*user_agent_parser)(grpc_mdelem);
-
-void grpc_register_workaround(uint32_t id, user_agent_parser parser);
-
-#endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H */
diff --git a/src/core/plugin_registry/grpc_plugin_registry.cc b/src/core/plugin_registry/grpc_plugin_registry.cc
index bb10e65..965f1aa 100644
--- a/src/core/plugin_registry/grpc_plugin_registry.cc
+++ b/src/core/plugin_registry/grpc_plugin_registry.cc
@@ -49,8 +49,6 @@
void grpc_resolver_sockaddr_shutdown(void);
void grpc_message_size_filter_init(void);
void grpc_message_size_filter_shutdown(void);
-void grpc_workaround_cronet_compression_filter_init(void);
-void grpc_workaround_cronet_compression_filter_shutdown(void);
namespace grpc_core {
void FaultInjectionFilterInit(void);
void FaultInjectionFilterShutdown(void);
@@ -116,8 +114,6 @@
grpc_message_size_filter_shutdown);
grpc_register_plugin(grpc_core::FaultInjectionFilterInit,
grpc_core::FaultInjectionFilterShutdown);
- grpc_register_plugin(grpc_workaround_cronet_compression_filter_init,
- grpc_workaround_cronet_compression_filter_shutdown);
#ifndef GRPC_NO_XDS
grpc_register_plugin(grpc_core::XdsClientGlobalInit,
grpc_core::XdsClientGlobalShutdown);
@@ -155,8 +151,6 @@
extern void RegisterSecurityFilters(CoreConfiguration::Builder* builder);
extern void RegisterServiceConfigChannelArgFilter(
CoreConfiguration::Builder* builder);
-extern void RegisterWorkaroundCronetCompressionFilter(
- CoreConfiguration::Builder* builder);
void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
BuildClientChannelConfiguration(builder);
@@ -168,7 +162,6 @@
RegisterMaxAgeFilter(builder);
RegisterDeadlineFilter(builder);
RegisterMessageSizeFilter(builder);
- RegisterWorkaroundCronetCompressionFilter(builder);
RegisterServiceConfigChannelArgFilter(builder);
// Run last so it gets a consistent location.
// TODO(ctiller): Is this actually necessary?
diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc
index afd801f..e8a7556 100644
--- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc
+++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc
@@ -57,8 +57,6 @@
void ServiceConfigParserInit(void);
void ServiceConfigParserShutdown(void);
} // namespace grpc_core
-void grpc_workaround_cronet_compression_filter_init(void);
-void grpc_workaround_cronet_compression_filter_shutdown(void);
void grpc_register_built_in_plugins(void) {
grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown);
@@ -89,8 +87,6 @@
grpc_message_size_filter_shutdown);
grpc_register_plugin(grpc_core::FaultInjectionFilterInit,
grpc_core::FaultInjectionFilterShutdown);
- grpc_register_plugin(grpc_workaround_cronet_compression_filter_init,
- grpc_workaround_cronet_compression_filter_shutdown);
}
namespace grpc_core {
@@ -108,8 +104,6 @@
extern void RegisterSecurityFilters(CoreConfiguration::Builder* builder);
extern void RegisterServiceConfigChannelArgFilter(
CoreConfiguration::Builder* builder);
-extern void RegisterWorkaroundCronetCompressionFilter(
- CoreConfiguration::Builder* builder);
void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
BuildClientChannelConfiguration(builder);
@@ -120,7 +114,6 @@
RegisterMaxAgeFilter(builder);
RegisterDeadlineFilter(builder);
RegisterMessageSizeFilter(builder);
- RegisterWorkaroundCronetCompressionFilter(builder);
RegisterServiceConfigChannelArgFilter(builder);
// Run last so it gets a consistent location.
// TODO(ctiller): Is this actually necessary?
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index a6f8e42..78d76fe 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -87,8 +87,6 @@
'src/core/ext/filters/http/server/http_server_filter.cc',
'src/core/ext/filters/max_age/max_age_filter.cc',
'src/core/ext/filters/message_size/message_size_filter.cc',
- 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
- 'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/service_config/service_config.cc',
'src/core/ext/service_config/service_config_parser.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
diff --git a/test/core/end2end/end2end_nosec_tests.cc b/test/core/end2end/end2end_nosec_tests.cc
index 68c9c33..c13f3ac 100644
--- a/test/core/end2end/end2end_nosec_tests.cc
+++ b/test/core/end2end/end2end_nosec_tests.cc
@@ -201,8 +201,6 @@
extern void streaming_error_response_pre_init(void);
extern void trailing_metadata(grpc_end2end_test_config config);
extern void trailing_metadata_pre_init(void);
-extern void workaround_cronet_compression(grpc_end2end_test_config config);
-extern void workaround_cronet_compression_pre_init(void);
extern void write_buffering(grpc_end2end_test_config config);
extern void write_buffering_pre_init(void);
extern void write_buffering_at_end(grpc_end2end_test_config config);
@@ -297,7 +295,6 @@
stream_compression_ping_pong_streaming_pre_init();
streaming_error_response_pre_init();
trailing_metadata_pre_init();
- workaround_cronet_compression_pre_init();
write_buffering_pre_init();
write_buffering_at_end_pre_init();
}
@@ -396,7 +393,6 @@
stream_compression_ping_pong_streaming(config);
streaming_error_response(config);
trailing_metadata(config);
- workaround_cronet_compression(config);
write_buffering(config);
write_buffering_at_end(config);
return;
@@ -747,10 +743,6 @@
trailing_metadata(config);
continue;
}
- if (0 == strcmp("workaround_cronet_compression", argv[i])) {
- workaround_cronet_compression(config);
- continue;
- }
if (0 == strcmp("write_buffering", argv[i])) {
write_buffering(config);
continue;
diff --git a/test/core/end2end/end2end_tests.cc b/test/core/end2end/end2end_tests.cc
index 3908936..231e55c 100644
--- a/test/core/end2end/end2end_tests.cc
+++ b/test/core/end2end/end2end_tests.cc
@@ -205,8 +205,6 @@
extern void streaming_error_response_pre_init(void);
extern void trailing_metadata(grpc_end2end_test_config config);
extern void trailing_metadata_pre_init(void);
-extern void workaround_cronet_compression(grpc_end2end_test_config config);
-extern void workaround_cronet_compression_pre_init(void);
extern void write_buffering(grpc_end2end_test_config config);
extern void write_buffering_pre_init(void);
extern void write_buffering_at_end(grpc_end2end_test_config config);
@@ -303,7 +301,6 @@
stream_compression_ping_pong_streaming_pre_init();
streaming_error_response_pre_init();
trailing_metadata_pre_init();
- workaround_cronet_compression_pre_init();
write_buffering_pre_init();
write_buffering_at_end_pre_init();
}
@@ -404,7 +401,6 @@
stream_compression_ping_pong_streaming(config);
streaming_error_response(config);
trailing_metadata(config);
- workaround_cronet_compression(config);
write_buffering(config);
write_buffering_at_end(config);
return;
@@ -763,10 +759,6 @@
trailing_metadata(config);
continue;
}
- if (0 == strcmp("workaround_cronet_compression", argv[i])) {
- workaround_cronet_compression(config);
- continue;
- }
if (0 == strcmp("write_buffering", argv[i])) {
write_buffering(config);
continue;
diff --git a/test/core/end2end/fixtures/h2_full+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc
deleted file mode 100644
index 55a7354..0000000
--- a/test/core/end2end/fixtures/h2_full+workarounds.cc
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <string.h>
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/sync.h>
-#include <grpc/support/workaround_list.h>
-
-#include "src/core/ext/filters/client_channel/client_channel.h"
-#include "src/core/ext/filters/http/server/http_server_filter.h"
-#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/connected_channel.h"
-#include "src/core/lib/gprpp/host_port.h"
-#include "src/core/lib/surface/channel.h"
-#include "src/core/lib/surface/server.h"
-#include "test/core/end2end/end2end_tests.h"
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.h"
-
-static char* workarounds_arg[GRPC_MAX_WORKAROUND_ID] = {
- const_cast<char*>(GRPC_ARG_WORKAROUND_CRONET_COMPRESSION)};
-
-struct fullstack_fixture_data {
- std::string localaddr;
-};
-
-static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
- grpc_channel_args* /*client_args*/, grpc_channel_args* /*server_args*/) {
- grpc_end2end_test_fixture f;
- int port = grpc_pick_unused_port_or_die();
- fullstack_fixture_data* ffd = new fullstack_fixture_data();
- memset(&f, 0, sizeof(f));
- ffd->localaddr = grpc_core::JoinHostPort("localhost", port);
- f.fixture_data = ffd;
- f.cq = grpc_completion_queue_create_for_next(nullptr);
- f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
- return f;
-}
-
-void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
- grpc_channel_args* client_args) {
- fullstack_fixture_data* ffd =
- static_cast<fullstack_fixture_data*>(f->fixture_data);
- f->client = grpc_insecure_channel_create(ffd->localaddr.c_str(), client_args,
- nullptr);
- GPR_ASSERT(f->client);
-}
-
-void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
- grpc_channel_args* server_args) {
- int i;
- grpc_core::ExecCtx exec_ctx;
- fullstack_fixture_data* ffd =
- static_cast<fullstack_fixture_data*>(f->fixture_data);
- grpc_arg args[GRPC_MAX_WORKAROUND_ID];
- for (i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
- args[i].key = workarounds_arg[i];
- args[i].type = GRPC_ARG_INTEGER;
- args[i].value.integer = 1;
- }
- grpc_channel_args* server_args_new =
- grpc_channel_args_copy_and_add(server_args, args, GRPC_MAX_WORKAROUND_ID);
- if (f->server) {
- grpc_server_destroy(f->server);
- }
- f->server = grpc_server_create(server_args_new, nullptr);
- grpc_server_register_completion_queue(f->server, f->cq, nullptr);
- GPR_ASSERT(
- grpc_server_add_insecure_http2_port(f->server, ffd->localaddr.c_str()));
- grpc_server_start(f->server);
- grpc_channel_args_destroy(server_args_new);
-}
-
-void chttp2_tear_down_fullstack(grpc_end2end_test_fixture* f) {
- fullstack_fixture_data* ffd =
- static_cast<fullstack_fixture_data*>(f->fixture_data);
- delete ffd;
-}
-
-/* All test configurations */
-static grpc_end2end_test_config configs[] = {
- {"chttp2/fullstack",
- FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
- FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
- FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER |
- FEATURE_MASK_SUPPORTS_WORKAROUNDS,
- nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack,
- chttp2_init_server_fullstack, chttp2_tear_down_fullstack},
-};
-
-int main(int argc, char** argv) {
- size_t i;
-
- grpc::testing::TestEnvironment env(argc, argv);
- grpc_end2end_tests_pre_init();
- grpc_init();
-
- for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) {
- grpc_end2end_tests(argc, argv, configs[i]);
- }
-
- grpc_shutdown();
-
- return 0;
-}
diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl
index 9886135..a2a9d2b 100755
--- a/test/core/end2end/generate_tests.bzl
+++ b/test/core/end2end/generate_tests.bzl
@@ -68,7 +68,6 @@
"h2_full": _fixture_options(),
"h2_full+pipe": _fixture_options(_platforms = ["linux"]),
"h2_full+trace": _fixture_options(tracing = True),
- "h2_full+workarounds": _fixture_options(),
"h2_http_proxy": _fixture_options(supports_proxy_auth = True),
"h2_insecure": _fixture_options(secure = True),
"h2_oauth2": _fixture_options(),
@@ -135,7 +134,6 @@
"h2_full": _fixture_options(secure = False),
"h2_full+pipe": _fixture_options(secure = False, _platforms = ["linux"], supports_msvc = False),
"h2_full+trace": _fixture_options(secure = False, tracing = True, supports_msvc = False),
- "h2_full+workarounds": _fixture_options(secure = False),
"h2_http_proxy": _fixture_options(secure = False, supports_proxy_auth = True),
"h2_proxy": _fixture_options(secure = False, includes_proxy = True),
"h2_sockpair_1byte": _fixture_options(
@@ -356,7 +354,6 @@
"authority_not_supported": _test_options(),
"filter_latency": _test_options(),
"filter_status_code": _test_options(),
- "workaround_cronet_compression": _test_options(),
"write_buffering": _test_options(needs_write_buffering = True),
"write_buffering_at_end": _test_options(needs_write_buffering = True),
}
diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc
deleted file mode 100644
index 0966dfe..0000000
--- a/test/core/end2end/tests/workaround_cronet_compression.cc
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-
-#include <grpc/byte_buffer.h>
-#include <grpc/byte_buffer_reader.h>
-#include <grpc/compression.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-#include <grpc/support/time.h>
-
-#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/compression/compression_args.h"
-#include "src/core/lib/surface/call.h"
-#include "src/core/lib/surface/call_test_only.h"
-#include "src/core/lib/transport/static_metadata.h"
-#include "test/core/end2end/cq_verifier.h"
-#include "test/core/end2end/end2end_tests.h"
-
-static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
-
-static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
- const char* test_name,
- grpc_channel_args* client_args,
- grpc_channel_args* server_args) {
- grpc_end2end_test_fixture f;
- gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
- f = config.create_fixture(client_args, server_args);
- config.init_server(&f, server_args);
- config.init_client(&f, client_args);
- return f;
-}
-
-static gpr_timespec n_seconds_from_now(int n) {
- return grpc_timeout_seconds_to_deadline(n);
-}
-
-static gpr_timespec five_seconds_from_now(void) {
- return n_seconds_from_now(5);
-}
-
-static void drain_cq(grpc_completion_queue* cq) {
- grpc_event ev;
- do {
- ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
- } while (ev.type != GRPC_QUEUE_SHUTDOWN);
-}
-
-static void shutdown_server(grpc_end2end_test_fixture* f) {
- if (!f->server) return;
- grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
- grpc_timeout_seconds_to_deadline(5),
- nullptr)
- .type == GRPC_OP_COMPLETE);
- grpc_server_destroy(f->server);
- f->server = nullptr;
-}
-
-static void shutdown_client(grpc_end2end_test_fixture* f) {
- if (!f->client) return;
- grpc_channel_destroy(f->client);
- f->client = nullptr;
-}
-
-static void end_test(grpc_end2end_test_fixture* f) {
- shutdown_server(f);
- shutdown_client(f);
-
- grpc_completion_queue_shutdown(f->cq);
- drain_cq(f->cq);
- grpc_completion_queue_destroy(f->cq);
- grpc_completion_queue_destroy(f->shutdown_cq);
-}
-
-static void request_with_payload_template(
- grpc_end2end_test_config config, const char* test_name,
- uint32_t client_send_flags_bitmask,
- grpc_compression_algorithm default_client_channel_compression_algorithm,
- grpc_compression_algorithm default_server_channel_compression_algorithm,
- grpc_compression_algorithm expected_algorithm_from_client,
- grpc_compression_algorithm expected_algorithm_from_server,
- grpc_metadata* client_init_metadata, bool set_server_level,
- grpc_compression_level server_compression_level, char* user_agent_override,
- bool decompress_in_core) {
- grpc_call* c;
- grpc_call* s;
- grpc_slice request_payload_slice;
- grpc_byte_buffer* request_payload;
- grpc_channel_args* client_args;
- grpc_channel_args* server_args;
- grpc_end2end_test_fixture f;
- grpc_op ops[6];
- grpc_op* op;
- grpc_metadata_array initial_metadata_recv;
- grpc_metadata_array trailing_metadata_recv;
- grpc_metadata_array request_metadata_recv;
- grpc_byte_buffer* request_payload_recv = nullptr;
- grpc_byte_buffer* response_payload;
- grpc_byte_buffer* response_payload_recv;
- grpc_call_details call_details;
- grpc_status_code status;
- grpc_call_error error;
- grpc_slice details;
- int was_cancelled = 2;
- cq_verifier* cqv;
- char request_str[1024];
- char response_str[1024];
-
- memset(request_str, 'x', 1023);
- request_str[1023] = '\0';
-
- memset(response_str, 'y', 1023);
- response_str[1023] = '\0';
-
- request_payload_slice = grpc_slice_from_copied_string(request_str);
- grpc_slice response_payload_slice =
- grpc_slice_from_copied_string(response_str);
-
- client_args = grpc_channel_args_set_channel_default_compression_algorithm(
- nullptr, default_client_channel_compression_algorithm);
- server_args = grpc_channel_args_set_channel_default_compression_algorithm(
- nullptr, default_server_channel_compression_algorithm);
- if (!decompress_in_core) {
- grpc_arg disable_decompression_in_core_arg =
- grpc_channel_arg_integer_create(
- const_cast<char*>(GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION), 0);
- grpc_channel_args* old_client_args = client_args;
- grpc_channel_args* old_server_args = server_args;
- client_args = grpc_channel_args_copy_and_add(
- client_args, &disable_decompression_in_core_arg, 1);
- server_args = grpc_channel_args_copy_and_add(
- server_args, &disable_decompression_in_core_arg, 1);
- grpc_channel_args_destroy(old_client_args);
- grpc_channel_args_destroy(old_server_args);
- }
-
- if (user_agent_override) {
- grpc_channel_args* client_args_old = client_args;
- grpc_arg arg;
- arg.key = const_cast<char*>(GRPC_ARG_PRIMARY_USER_AGENT_STRING);
- arg.type = GRPC_ARG_STRING;
- arg.value.string = user_agent_override;
- client_args = grpc_channel_args_copy_and_add(client_args_old, &arg, 1);
- grpc_channel_args_destroy(client_args_old);
- }
-
- f = begin_test(config, test_name, client_args, server_args);
- cqv = cq_verifier_create(f.cq);
-
- gpr_timespec deadline = five_seconds_from_now();
- c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
- grpc_slice_from_static_string("/foo"), nullptr,
- deadline, nullptr);
- GPR_ASSERT(c);
-
- grpc_metadata_array_init(&initial_metadata_recv);
- grpc_metadata_array_init(&trailing_metadata_recv);
- grpc_metadata_array_init(&request_metadata_recv);
- grpc_call_details_init(&call_details);
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_INITIAL_METADATA;
- if (client_init_metadata != nullptr) {
- op->data.send_initial_metadata.count = 1;
- op->data.send_initial_metadata.metadata = client_init_metadata;
- } else {
- op->data.send_initial_metadata.count = 0;
- }
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_RECV_INITIAL_METADATA;
- op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
- op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
- op->data.recv_status_on_client.status = &status;
- op->data.recv_status_on_client.status_details = &details;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(1),
- nullptr);
- GPR_ASSERT(GRPC_CALL_OK == error);
-
- error =
- grpc_server_request_call(f.server, &s, &call_details,
- &request_metadata_recv, f.cq, f.cq, tag(100));
- GPR_ASSERT(GRPC_CALL_OK == error);
- CQ_EXPECT_COMPLETION(cqv, tag(100), true);
- cq_verify(cqv);
-
- GPR_ASSERT(grpc_core::BitCount(
- grpc_call_test_only_get_encodings_accepted_by_peer(s)) ==
- GRPC_COMPRESS_ALGORITHMS_COUNT);
- GPR_ASSERT(
- grpc_core::GetBit(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_NONE) != 0);
- GPR_ASSERT(
- grpc_core::GetBit(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_DEFLATE) != 0);
- GPR_ASSERT(
- grpc_core::GetBit(grpc_call_test_only_get_encodings_accepted_by_peer(s),
- GRPC_COMPRESS_GZIP) != 0);
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_INITIAL_METADATA;
- op->data.send_initial_metadata.count = 0;
- if (set_server_level) {
- op->data.send_initial_metadata.maybe_compression_level.is_set = true;
- op->data.send_initial_metadata.maybe_compression_level.level =
- server_compression_level;
- }
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
- op->data.recv_close_on_server.cancelled = &was_cancelled;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops), tag(101),
- nullptr);
- GPR_ASSERT(GRPC_CALL_OK == error);
-
- for (int i = 0; i < 2; i++) {
- request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1);
- response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1);
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_MESSAGE;
- op->data.send_message.send_message = request_payload;
- op->flags = client_send_flags_bitmask;
- op->reserved = nullptr;
- op++;
- op->op = GRPC_OP_RECV_MESSAGE;
- op->data.recv_message.recv_message = &response_payload_recv;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(2),
- nullptr);
- GPR_ASSERT(GRPC_CALL_OK == error);
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_RECV_MESSAGE;
- op->data.recv_message.recv_message = &request_payload_recv;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops),
- tag(102), nullptr);
- GPR_ASSERT(GRPC_CALL_OK == error);
- CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
- cq_verify(cqv);
-
- GPR_ASSERT(request_payload_recv->type == GRPC_BB_RAW);
- GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, request_str));
- GPR_ASSERT(request_payload_recv->data.raw.compression ==
- (decompress_in_core ? GRPC_COMPRESS_NONE
- : expected_algorithm_from_client));
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_MESSAGE;
- op->data.send_message.send_message = response_payload;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops),
- tag(103), nullptr);
- GPR_ASSERT(GRPC_CALL_OK == error);
- CQ_EXPECT_COMPLETION(cqv, tag(103), 1);
- CQ_EXPECT_COMPLETION(cqv, tag(2), 1);
- cq_verify(cqv);
-
- GPR_ASSERT(response_payload_recv->type == GRPC_BB_RAW);
- GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, response_str));
- if (server_compression_level > GRPC_COMPRESS_LEVEL_NONE) {
- const grpc_compression_algorithm algo_for_server_level =
- grpc_call_compression_for_level(s, server_compression_level);
- GPR_ASSERT(
- response_payload_recv->data.raw.compression ==
- (decompress_in_core ? GRPC_COMPRESS_NONE : algo_for_server_level));
- } else {
- GPR_ASSERT(response_payload_recv->data.raw.compression ==
- (decompress_in_core ? GRPC_COMPRESS_NONE
- : expected_algorithm_from_server));
- }
-
- grpc_byte_buffer_destroy(request_payload);
- grpc_byte_buffer_destroy(response_payload);
- grpc_byte_buffer_destroy(request_payload_recv);
- grpc_byte_buffer_destroy(response_payload_recv);
- }
-
- grpc_slice_unref(request_payload_slice);
- grpc_slice_unref(response_payload_slice);
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(3),
- nullptr);
- GPR_ASSERT(GRPC_CALL_OK == error);
-
- memset(ops, 0, sizeof(ops));
- op = ops;
- op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
- op->data.send_status_from_server.trailing_metadata_count = 0;
- op->data.send_status_from_server.status = GRPC_STATUS_OK;
- grpc_slice status_details = grpc_slice_from_static_string("xyz");
- op->data.send_status_from_server.status_details = &status_details;
- op->flags = 0;
- op->reserved = nullptr;
- op++;
- error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops), tag(104),
- nullptr);
- GPR_ASSERT(GRPC_CALL_OK == error);
-
- CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
- CQ_EXPECT_COMPLETION(cqv, tag(3), 1);
- CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
- CQ_EXPECT_COMPLETION(cqv, tag(104), 1);
- cq_verify(cqv);
-
- GPR_ASSERT(status == GRPC_STATUS_OK);
- GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
- GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo"));
- GPR_ASSERT(was_cancelled == 0);
-
- grpc_slice_unref(details);
- grpc_metadata_array_destroy(&initial_metadata_recv);
- grpc_metadata_array_destroy(&trailing_metadata_recv);
- grpc_metadata_array_destroy(&request_metadata_recv);
- grpc_call_details_destroy(&call_details);
-
- grpc_call_unref(c);
- grpc_call_unref(s);
-
- cq_verifier_destroy(cqv);
- grpc_channel_args_destroy(client_args);
- grpc_channel_args_destroy(server_args);
- end_test(&f);
- config.tear_down_data(&f);
-}
-
-typedef struct workaround_cronet_compression_config {
- char* user_agent_override;
- grpc_compression_algorithm expected_algorithm_from_server;
-} workaround_cronet_compression_config;
-
-static workaround_cronet_compression_config workaround_configs[] = {
- {nullptr, GRPC_COMPRESS_GZIP},
- {const_cast<char*>(
- "grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)"),
- GRPC_COMPRESS_NONE},
- {const_cast<char*>(
- "grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)"),
- GRPC_COMPRESS_GZIP},
- {const_cast<char*>(
- "grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)"),
- GRPC_COMPRESS_GZIP}};
-static const size_t workaround_configs_num =
- sizeof(workaround_configs) / sizeof(*workaround_configs);
-
-static void test_workaround_cronet_compression(
- grpc_end2end_test_config config) {
- for (uint32_t i = 0; i < workaround_configs_num; i++) {
- request_with_payload_template(
- config, "test_invoke_request_with_compressed_payload", 0,
- GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP,
- workaround_configs[i].expected_algorithm_from_server, nullptr, false,
- /* ignored */ GRPC_COMPRESS_LEVEL_NONE,
- workaround_configs[i].user_agent_override, true);
- request_with_payload_template(
- config,
- "test_invoke_request_with_compressed_payload_with_compression_disabled",
- 0, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP,
- workaround_configs[i].expected_algorithm_from_server, nullptr, false,
- /* ignored */ GRPC_COMPRESS_LEVEL_NONE,
- workaround_configs[i].user_agent_override, false);
- }
-}
-
-void workaround_cronet_compression(grpc_end2end_test_config config) {
- if (config.feature_mask & FEATURE_MASK_SUPPORTS_WORKAROUNDS) {
- test_workaround_cronet_compression(config);
- }
-}
-
-void workaround_cronet_compression_pre_init(void) {}
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index c391c17..1f2619a 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -1175,10 +1175,6 @@
src/core/ext/filters/max_age/max_age_filter.h \
src/core/ext/filters/message_size/message_size_filter.cc \
src/core/ext/filters/message_size/message_size_filter.h \
-src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
-src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h \
-src/core/ext/filters/workarounds/workaround_utils.cc \
-src/core/ext/filters/workarounds/workaround_utils.h \
src/core/ext/service_config/service_config.cc \
src/core/ext/service_config/service_config.h \
src/core/ext/service_config/service_config_call_data.h \
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index 6a95e3a..86a239e 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -1002,10 +1002,6 @@
src/core/ext/filters/max_age/max_age_filter.h \
src/core/ext/filters/message_size/message_size_filter.cc \
src/core/ext/filters/message_size/message_size_filter.h \
-src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
-src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h \
-src/core/ext/filters/workarounds/workaround_utils.cc \
-src/core/ext/filters/workarounds/workaround_utils.h \
src/core/ext/service_config/service_config.cc \
src/core/ext/service_config/service_config.h \
src/core/ext/service_config/service_config_call_data.h \