Stream compression algorithm negotiation

pull/11782/head
Muxi Yan 8 years ago
parent e89c83a21b
commit 96e4978551
  1. 21
      src/core/ext/transport/chttp2/transport/hpack_parser.c

@ -1655,6 +1655,21 @@ static void force_client_rst_stream(grpc_exec_ctx *exec_ctx, void *sp,
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "final_rst"); GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "final_rst");
} }
static void parse_stream_compression_md(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
grpc_metadata_batch *initial_metadata) {
if (initial_metadata->idx.named.content_encoding != NULL) {
grpc_slice content_encoding =
GRPC_MDVALUE(initial_metadata->idx.named.content_encoding->md);
if (!grpc_slice_eq(content_encoding, GRPC_MDSTR_IDENTITY)) {
if (grpc_slice_eq(content_encoding, GRPC_MDSTR_GZIP)) {
s->stream_compression_recv_enabled = true;
}
}
}
}
grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx, grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
void *hpack_parser, void *hpack_parser,
grpc_chttp2_transport *t, grpc_chttp2_transport *t,
@ -1684,6 +1699,12 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Too many trailer frames"); "Too many trailer frames");
} }
/* Process stream compression md element if it exists */
if (s->header_frames_received ==
0) { /* Only acts on initial metadata */
parse_stream_compression_md(exec_ctx, t, s,
&s->metadata_buffer[0].batch);
}
s->published_metadata[s->header_frames_received] = s->published_metadata[s->header_frames_received] =
GRPC_METADATA_PUBLISHED_FROM_WIRE; GRPC_METADATA_PUBLISHED_FROM_WIRE;
maybe_complete_funcs[s->header_frames_received](exec_ctx, t, s); maybe_complete_funcs[s->header_frames_received](exec_ctx, t, s);

Loading…
Cancel
Save