Merge pull request #9531 from dgquintas/compression_implicit_encoding
make grpc-encoding:identity implicit
This commit is contained in:
commit
1ca0dc2a9b
|
|
@ -105,7 +105,6 @@ static grpc_error *process_send_initial_metadata(
|
|||
static grpc_error *process_send_initial_metadata(
|
||||
grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||
grpc_metadata_batch *initial_metadata) {
|
||||
grpc_error *error;
|
||||
call_data *calld = elem->call_data;
|
||||
channel_data *channeld = elem->channel_data;
|
||||
/* Parse incoming request for compression. If any, it'll be available
|
||||
|
|
@ -144,10 +143,13 @@ static grpc_error *process_send_initial_metadata(
|
|||
calld->has_compression_algorithm = 1; /* GPR_TRUE */
|
||||
}
|
||||
|
||||
grpc_error *error = GRPC_ERROR_NONE;
|
||||
/* hint compression algorithm */
|
||||
error = grpc_metadata_batch_add_tail(
|
||||
exec_ctx, initial_metadata, &calld->compression_algorithm_storage,
|
||||
grpc_compression_encoding_mdelem(calld->compression_algorithm));
|
||||
if (calld->compression_algorithm != GRPC_COMPRESS_NONE) {
|
||||
error = grpc_metadata_batch_add_tail(
|
||||
exec_ctx, initial_metadata, &calld->compression_algorithm_storage,
|
||||
grpc_compression_encoding_mdelem(calld->compression_algorithm));
|
||||
}
|
||||
|
||||
if (error != GRPC_ERROR_NONE) return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,9 @@
|
|||
#define HTTP1_DETAIL_MSG "Trying to connect an http1.x server"
|
||||
|
||||
/* TODO(zyc) Check the content of incomming data instead of using this length */
|
||||
#define EXPECTED_INCOMING_DATA_LENGTH (size_t)310
|
||||
/* The 'bad' server will start sending responses after reading this amount of
|
||||
* data from the client. */
|
||||
#define SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD (size_t)200
|
||||
|
||||
struct rpc_state {
|
||||
char *target;
|
||||
|
|
@ -134,8 +136,10 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
|||
}
|
||||
|
||||
gpr_log(GPR_DEBUG, "got %" PRIuPTR " bytes, expected %" PRIuPTR " bytes",
|
||||
state.incoming_data_length, EXPECTED_INCOMING_DATA_LENGTH);
|
||||
if (state.incoming_data_length >= EXPECTED_INCOMING_DATA_LENGTH) {
|
||||
state.incoming_data_length,
|
||||
SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD);
|
||||
if (state.incoming_data_length >=
|
||||
SERVER_INCOMING_DATA_LENGTH_LOWER_THRESHOLD) {
|
||||
handle_write(exec_ctx);
|
||||
} else {
|
||||
grpc_endpoint_read(exec_ctx, state.tcp, &state.temp_incoming_buffer,
|
||||
|
|
|
|||
Loading…
Reference in New Issue