grpc 1.1.2 → 1.2.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +1257 -404
- data/etc/roots.pem +189 -102
- data/include/grpc/census.h +7 -7
- data/include/grpc/compression.h +4 -4
- data/include/grpc/grpc.h +13 -7
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +26 -9
- data/include/grpc/impl/codegen/grpc_types.h +39 -30
- data/include/grpc/impl/codegen/slice.h +24 -6
- data/include/grpc/impl/codegen/sync.h +8 -0
- data/include/grpc/load_reporting.h +63 -0
- data/include/grpc/slice.h +37 -1
- data/include/grpc/slice_buffer.h +7 -0
- data/include/grpc/support/alloc.h +3 -0
- data/include/grpc/support/useful.h +3 -0
- data/src/core/ext/census/gen/census.pb.h +1 -1
- data/src/core/ext/census/gen/trace_context.pb.c +9 -36
- data/src/core/ext/census/gen/trace_context.pb.h +20 -26
- data/src/core/ext/census/grpc_filter.c +3 -5
- data/src/core/ext/census/trace_context.c +1 -1
- data/src/core/ext/census/trace_context.h +3 -0
- data/src/core/ext/census/trace_label.h +61 -0
- data/src/core/ext/census/trace_propagation.h +63 -0
- data/src/core/ext/census/trace_status.h +45 -0
- data/src/core/ext/census/trace_string.h +50 -0
- data/src/core/ext/census/tracing.c +31 -11
- data/src/core/ext/census/tracing.h +124 -0
- data/src/core/ext/client_channel/client_channel.c +456 -368
- data/src/core/ext/client_channel/client_channel.h +4 -0
- data/src/core/ext/client_channel/client_channel_plugin.c +6 -1
- data/src/core/ext/client_channel/connector.c +3 -3
- data/src/core/ext/client_channel/connector.h +4 -3
- data/src/core/ext/client_channel/http_connect_handshaker.c +62 -72
- data/src/core/ext/client_channel/http_connect_handshaker.h +7 -10
- data/src/core/ext/client_channel/http_proxy.c +125 -0
- data/src/core/ext/client_channel/http_proxy.h +39 -0
- data/src/core/ext/client_channel/lb_policy.c +56 -35
- data/src/core/ext/client_channel/lb_policy.h +46 -39
- data/src/core/ext/client_channel/lb_policy_factory.h +1 -0
- data/src/core/ext/client_channel/parse_address.c +32 -6
- data/src/core/ext/client_channel/proxy_mapper.c +63 -0
- data/src/core/ext/client_channel/proxy_mapper.h +89 -0
- data/src/core/ext/client_channel/proxy_mapper_registry.c +133 -0
- data/src/core/ext/client_channel/proxy_mapper_registry.h +59 -0
- data/src/core/ext/client_channel/resolver.c +16 -9
- data/src/core/ext/client_channel/resolver.h +23 -12
- data/src/core/ext/client_channel/resolver_factory.h +1 -0
- data/src/core/ext/client_channel/resolver_registry.c +15 -11
- data/src/core/ext/client_channel/resolver_registry.h +5 -3
- data/src/core/ext/client_channel/subchannel.c +44 -27
- data/src/core/ext/client_channel/subchannel.h +6 -2
- data/src/core/ext/client_channel/uri_parser.c +26 -14
- data/src/core/ext/client_channel/uri_parser.h +3 -1
- data/src/core/ext/lb_policy/grpclb/grpclb.c +220 -209
- data/src/core/ext/lb_policy/grpclb/grpclb_channel.h +56 -0
- data/src/core/ext/lb_policy/grpclb/grpclb_channel_secure.c +107 -0
- data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +3 -6
- data/src/core/ext/lb_policy/pick_first/pick_first.c +71 -116
- data/src/core/ext/lb_policy/round_robin/round_robin.c +52 -67
- data/src/core/ext/load_reporting/load_reporting.c +20 -0
- data/src/core/ext/load_reporting/load_reporting.h +1 -16
- data/src/core/ext/load_reporting/load_reporting_filter.c +28 -54
- data/src/core/ext/resolver/dns/native/dns_resolver.c +31 -45
- data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +20 -29
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +11 -8
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +11 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +143 -46
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +12 -50
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +1 -1
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +1 -1
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +7 -7
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +1 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +1 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +0 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +606 -374
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +17 -5
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +9 -13
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +12 -11
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +5 -6
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +100 -53
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +126 -70
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +13 -7
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +22 -19
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +6 -6
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +23 -11
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +6 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +169 -42
- data/src/core/ext/transport/chttp2/transport/parsing.c +98 -41
- data/src/core/ext/transport/chttp2/transport/stream_lists.c +29 -14
- data/src/core/ext/transport/chttp2/transport/writing.c +137 -15
- data/src/core/lib/channel/channel_stack.c +14 -44
- data/src/core/lib/channel/channel_stack.h +10 -17
- data/src/core/lib/channel/channel_stack_builder.c +2 -3
- data/src/core/lib/channel/compress_filter.c +54 -46
- data/src/core/lib/channel/connected_channel.c +4 -4
- data/src/core/lib/channel/connected_channel.h +5 -0
- data/src/core/lib/channel/context.h +3 -0
- data/src/core/lib/channel/deadline_filter.c +61 -61
- data/src/core/lib/channel/deadline_filter.h +8 -5
- data/src/core/lib/channel/handshaker.c +47 -7
- data/src/core/lib/channel/handshaker.h +21 -3
- data/src/core/lib/channel/http_client_filter.c +149 -99
- data/src/core/lib/channel/http_server_filter.c +163 -147
- data/src/core/lib/channel/message_size_filter.c +15 -10
- data/src/core/lib/compression/algorithm_metadata.h +4 -4
- data/src/core/lib/compression/compression.c +17 -23
- data/src/core/lib/http/httpcli.c +3 -2
- data/src/core/lib/http/httpcli.h +2 -1
- data/src/core/lib/http/httpcli_security_connector.c +2 -3
- data/src/core/lib/http/parser.c +2 -2
- data/src/core/lib/iomgr/closure.c +6 -3
- data/src/core/lib/iomgr/closure.h +4 -2
- data/src/core/lib/iomgr/combiner.c +35 -5
- data/src/core/lib/iomgr/combiner.h +21 -2
- data/src/core/lib/iomgr/endpoint.c +3 -2
- data/src/core/lib/iomgr/endpoint.h +3 -2
- data/src/core/lib/iomgr/error.c +60 -94
- data/src/core/lib/iomgr/error.h +7 -10
- data/src/core/lib/iomgr/error_internal.h +54 -0
- data/src/core/lib/iomgr/ev_epoll_linux.c +253 -109
- data/src/core/lib/iomgr/ev_poll_posix.c +61 -29
- data/src/core/lib/iomgr/ev_posix.c +7 -8
- data/src/core/lib/iomgr/ev_posix.h +4 -4
- data/src/core/lib/iomgr/exec_ctx.c +11 -6
- data/src/core/lib/iomgr/exec_ctx.h +11 -14
- data/src/core/lib/iomgr/executor.c +2 -2
- data/src/core/lib/iomgr/load_file.c +1 -1
- data/src/core/lib/iomgr/network_status_tracker.c +5 -81
- data/src/core/lib/iomgr/pollset.h +1 -3
- data/src/core/lib/iomgr/pollset_set.h +2 -1
- data/src/core/lib/iomgr/pollset_set_uv.c +2 -1
- data/src/core/lib/iomgr/pollset_set_windows.c +2 -1
- data/src/core/lib/iomgr/pollset_uv.c +25 -11
- data/src/core/lib/iomgr/pollset_windows.c +0 -11
- data/src/core/lib/iomgr/resolve_address_uv.c +50 -2
- data/src/core/lib/iomgr/resource_quota.c +41 -11
- data/src/core/lib/iomgr/resource_quota.h +6 -0
- data/src/core/lib/iomgr/sockaddr_utils.c +33 -17
- data/src/core/lib/iomgr/sockaddr_utils.h +4 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +2 -3
- data/src/core/lib/iomgr/tcp_client_uv.c +1 -3
- data/src/core/lib/iomgr/tcp_client_windows.c +21 -6
- data/src/core/lib/iomgr/tcp_posix.c +4 -5
- data/src/core/lib/iomgr/tcp_server_posix.c +269 -94
- data/src/core/lib/iomgr/tcp_server_windows.c +1 -1
- data/src/core/lib/iomgr/tcp_uv.c +11 -5
- data/src/core/lib/iomgr/tcp_windows.c +20 -7
- data/src/core/lib/iomgr/timer_generic.c +15 -22
- data/src/core/lib/iomgr/timer_generic.h +1 -1
- data/src/core/lib/iomgr/timer_uv.c +10 -6
- data/src/core/lib/iomgr/timer_uv.h +1 -1
- data/src/core/lib/iomgr/udp_server.c +45 -6
- data/src/core/lib/iomgr/udp_server.h +7 -1
- data/src/core/lib/iomgr/unix_sockets_posix.c +11 -1
- data/src/core/lib/json/json.c +1 -2
- data/src/core/lib/profiling/basic_timers.c +17 -3
- data/src/core/lib/security/context/security_context.c +3 -10
- data/src/core/lib/security/credentials/composite/composite_credentials.c +4 -8
- data/src/core/lib/security/credentials/credentials.c +48 -2
- data/src/core/lib/security/credentials/credentials.h +13 -0
- data/src/core/lib/security/credentials/credentials_metadata.c +1 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.c +6 -8
- data/src/core/lib/security/credentials/fake/fake_credentials.h +15 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +3 -3
- data/src/core/lib/security/credentials/iam/iam_credentials.c +1 -2
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +5 -8
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +3 -5
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +15 -13
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +2 -4
- data/src/core/lib/security/transport/client_auth_filter.c +72 -47
- data/src/core/lib/security/transport/lb_targets_info.c +70 -0
- data/src/core/lib/security/transport/lb_targets_info.h +47 -0
- data/src/core/lib/security/transport/secure_endpoint.c +3 -3
- data/src/core/lib/security/transport/security_connector.c +125 -28
- data/src/core/lib/security/transport/security_connector.h +4 -3
- data/src/core/lib/security/transport/security_handshaker.c +13 -9
- data/src/core/lib/security/transport/server_auth_filter.c +31 -40
- data/src/core/lib/security/util/b64.c +1 -1
- data/src/core/lib/slice/slice.c +110 -20
- data/src/core/lib/slice/slice_buffer.c +92 -39
- data/src/core/lib/{transport/mdstr_hash_table.c → slice/slice_hash_table.c} +40 -33
- data/src/core/lib/{transport/mdstr_hash_table.h → slice/slice_hash_table.h} +21 -21
- data/src/core/lib/slice/slice_intern.c +346 -0
- data/src/core/lib/slice/slice_internal.h +15 -0
- data/src/core/lib/slice/slice_string_helpers.c +5 -0
- data/src/core/lib/slice/slice_string_helpers.h +5 -0
- data/src/core/lib/support/alloc.c +26 -1
- data/src/core/lib/support/cmdline.c +2 -4
- data/src/core/lib/support/cpu_posix.c +2 -7
- data/src/core/lib/support/histogram.c +1 -2
- data/src/core/lib/support/log_posix.c +8 -4
- data/src/core/lib/support/spinlock.h +52 -0
- data/src/core/lib/support/subprocess_posix.c +1 -2
- data/src/core/lib/support/sync.c +7 -1
- data/src/core/lib/support/sync_posix.c +9 -0
- data/src/core/lib/support/time_windows.c +7 -1
- data/src/core/lib/surface/call.c +647 -629
- data/src/core/lib/surface/call.h +4 -1
- data/src/core/lib/surface/call_details.c +8 -2
- data/src/core/lib/surface/call_log_batch.c +17 -6
- data/src/core/lib/surface/channel.c +49 -59
- data/src/core/lib/surface/channel.h +5 -6
- data/src/core/lib/surface/completion_queue.c +16 -45
- data/src/core/lib/surface/completion_queue.h +0 -3
- data/src/core/lib/surface/init.c +6 -2
- data/src/core/lib/surface/init_secure.c +1 -1
- data/src/core/lib/surface/lame_client.c +14 -4
- data/src/core/lib/surface/server.c +79 -82
- data/src/core/lib/surface/validate_metadata.c +46 -15
- data/src/core/lib/surface/validate_metadata.h +43 -0
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.c +104 -0
- data/src/core/lib/transport/bdp_estimator.h +76 -0
- data/src/core/lib/transport/connectivity_state.c +33 -13
- data/src/core/lib/transport/connectivity_state.h +15 -5
- data/src/core/lib/transport/error_utils.c +124 -0
- data/src/core/lib/transport/error_utils.h +56 -0
- data/src/core/{ext/transport/chttp2 → lib}/transport/http2_errors.h +18 -18
- data/src/core/lib/transport/metadata.c +259 -503
- data/src/core/lib/transport/metadata.h +69 -68
- data/src/core/lib/transport/metadata_batch.c +183 -63
- data/src/core/lib/transport/metadata_batch.h +50 -26
- data/src/core/lib/transport/pid_controller.c +28 -8
- data/src/core/lib/transport/pid_controller.h +15 -2
- data/src/core/lib/transport/service_config.c +21 -18
- data/src/core/lib/transport/service_config.h +5 -5
- data/src/core/lib/transport/static_metadata.c +753 -112
- data/src/core/lib/transport/static_metadata.h +403 -264
- data/src/core/{ext/transport/chttp2 → lib}/transport/status_conversion.c +18 -20
- data/src/core/{ext/transport/chttp2 → lib}/transport/status_conversion.h +9 -10
- data/src/core/lib/transport/timeout_encoding.c +11 -9
- data/src/core/lib/transport/timeout_encoding.h +3 -1
- data/src/core/lib/transport/transport.c +47 -87
- data/src/core/lib/transport/transport.h +20 -25
- data/src/core/lib/transport/transport_op_string.c +7 -19
- data/src/core/lib/tsi/fake_transport_security.c +2 -4
- data/src/core/lib/tsi/ssl_transport_security.c +7 -16
- data/src/core/lib/tsi/transport_security.c +2 -4
- data/src/ruby/ext/grpc/extconf.rb +4 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +7 -0
- data/src/ruby/ext/grpc/rb_byte_buffer.h +3 -0
- data/src/ruby/ext/grpc/rb_call.c +47 -46
- data/src/ruby/ext/grpc/rb_channel.c +21 -6
- data/src/ruby/ext/grpc/rb_compression_options.c +9 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +36 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +59 -8
- data/src/ruby/ext/grpc/rb_server.c +6 -4
- data/src/ruby/lib/grpc/generic/client_stub.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +33 -9
@@ -74,8 +74,8 @@ typedef struct {
|
|
74
74
|
|
75
75
|
/* entry tables for keys & elems: these tables track values that have been
|
76
76
|
seen and *may* be in the decompressor table */
|
77
|
-
|
78
|
-
grpc_mdelem
|
77
|
+
grpc_slice entries_keys[GRPC_CHTTP2_HPACKC_NUM_VALUES];
|
78
|
+
grpc_mdelem entries_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
|
79
79
|
uint32_t indices_keys[GRPC_CHTTP2_HPACKC_NUM_VALUES];
|
80
80
|
uint32_t indices_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
|
81
81
|
|
@@ -50,9 +50,13 @@
|
|
50
50
|
#include <grpc/support/useful.h>
|
51
51
|
|
52
52
|
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
|
53
|
-
#include "src/core/ext/transport/chttp2/transport/http2_errors.h"
|
54
53
|
#include "src/core/lib/profiling/timers.h"
|
54
|
+
#include "src/core/lib/slice/slice_internal.h"
|
55
55
|
#include "src/core/lib/support/string.h"
|
56
|
+
#include "src/core/lib/transport/http2_errors.h"
|
57
|
+
|
58
|
+
/* TODO(ctiller): remove before submission */
|
59
|
+
#include "src/core/lib/slice/slice_string_helpers.h"
|
56
60
|
|
57
61
|
extern int grpc_http_trace;
|
58
62
|
|
@@ -668,8 +672,22 @@ static const uint8_t inverse_base64[256] = {
|
|
668
672
|
|
669
673
|
/* emission helpers */
|
670
674
|
static grpc_error *on_hdr(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p,
|
671
|
-
grpc_mdelem
|
675
|
+
grpc_mdelem md, int add_to_table) {
|
676
|
+
if (grpc_http_trace && !GRPC_MDELEM_IS_INTERNED(md)) {
|
677
|
+
char *k = grpc_slice_to_c_string(GRPC_MDKEY(md));
|
678
|
+
char *v = grpc_slice_to_c_string(GRPC_MDVALUE(md));
|
679
|
+
gpr_log(
|
680
|
+
GPR_DEBUG,
|
681
|
+
"Decode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
|
682
|
+
k, v, GRPC_MDELEM_IS_INTERNED(md), GRPC_MDELEM_STORAGE(md),
|
683
|
+
grpc_slice_is_interned(GRPC_MDKEY(md)),
|
684
|
+
grpc_slice_is_interned(GRPC_MDVALUE(md)));
|
685
|
+
gpr_free(k);
|
686
|
+
gpr_free(v);
|
687
|
+
}
|
672
688
|
if (add_to_table) {
|
689
|
+
GPR_ASSERT(GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_INTERNED ||
|
690
|
+
GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC);
|
673
691
|
grpc_error *err = grpc_chttp2_hptbl_add(exec_ctx, &p->table, md);
|
674
692
|
if (err != GRPC_ERROR_NONE) return err;
|
675
693
|
}
|
@@ -681,10 +699,28 @@ static grpc_error *on_hdr(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p,
|
|
681
699
|
return GRPC_ERROR_NONE;
|
682
700
|
}
|
683
701
|
|
684
|
-
static
|
685
|
-
|
686
|
-
|
687
|
-
|
702
|
+
static grpc_slice take_string(grpc_exec_ctx *exec_ctx,
|
703
|
+
grpc_chttp2_hpack_parser *p,
|
704
|
+
grpc_chttp2_hpack_parser_string *str,
|
705
|
+
bool intern) {
|
706
|
+
grpc_slice s;
|
707
|
+
if (!str->copied) {
|
708
|
+
if (intern) {
|
709
|
+
s = grpc_slice_intern(str->data.referenced);
|
710
|
+
grpc_slice_unref_internal(exec_ctx, str->data.referenced);
|
711
|
+
} else {
|
712
|
+
s = str->data.referenced;
|
713
|
+
}
|
714
|
+
str->copied = true;
|
715
|
+
str->data.referenced = grpc_empty_slice();
|
716
|
+
} else if (intern) {
|
717
|
+
s = grpc_slice_intern(grpc_slice_from_static_buffer(
|
718
|
+
str->data.copied.str, str->data.copied.length));
|
719
|
+
} else {
|
720
|
+
s = grpc_slice_from_copied_buffer(str->data.copied.str,
|
721
|
+
str->data.copied.length);
|
722
|
+
}
|
723
|
+
str->data.copied.length = 0;
|
688
724
|
return s;
|
689
725
|
}
|
690
726
|
|
@@ -771,8 +807,8 @@ static grpc_error *finish_indexed_field(grpc_exec_ctx *exec_ctx,
|
|
771
807
|
grpc_chttp2_hpack_parser *p,
|
772
808
|
const uint8_t *cur,
|
773
809
|
const uint8_t *end) {
|
774
|
-
grpc_mdelem
|
775
|
-
if (md
|
810
|
+
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
811
|
+
if (GRPC_MDISNULL(md)) {
|
776
812
|
return grpc_error_set_int(
|
777
813
|
grpc_error_set_int(GRPC_ERROR_CREATE("Invalid HPACK index received"),
|
778
814
|
GRPC_ERROR_INT_INDEX, (intptr_t)p->index),
|
@@ -813,12 +849,13 @@ static grpc_error *finish_lithdr_incidx(grpc_exec_ctx *exec_ctx,
|
|
813
849
|
grpc_chttp2_hpack_parser *p,
|
814
850
|
const uint8_t *cur,
|
815
851
|
const uint8_t *end) {
|
816
|
-
grpc_mdelem
|
817
|
-
GPR_ASSERT(md
|
818
|
-
grpc_error *err = on_hdr(
|
819
|
-
|
820
|
-
|
821
|
-
|
852
|
+
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
853
|
+
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
|
854
|
+
grpc_error *err = on_hdr(
|
855
|
+
exec_ctx, p,
|
856
|
+
grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
|
857
|
+
take_string(exec_ctx, p, &p->value, true)),
|
858
|
+
1);
|
822
859
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
823
860
|
return parse_begin(exec_ctx, p, cur, end);
|
824
861
|
}
|
@@ -828,10 +865,11 @@ static grpc_error *finish_lithdr_incidx_v(grpc_exec_ctx *exec_ctx,
|
|
828
865
|
grpc_chttp2_hpack_parser *p,
|
829
866
|
const uint8_t *cur,
|
830
867
|
const uint8_t *end) {
|
831
|
-
grpc_error *err = on_hdr(
|
832
|
-
|
833
|
-
|
834
|
-
|
868
|
+
grpc_error *err = on_hdr(
|
869
|
+
exec_ctx, p,
|
870
|
+
grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
|
871
|
+
take_string(exec_ctx, p, &p->value, true)),
|
872
|
+
1);
|
835
873
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
836
874
|
return parse_begin(exec_ctx, p, cur, end);
|
837
875
|
}
|
@@ -881,12 +919,13 @@ static grpc_error *finish_lithdr_notidx(grpc_exec_ctx *exec_ctx,
|
|
881
919
|
grpc_chttp2_hpack_parser *p,
|
882
920
|
const uint8_t *cur,
|
883
921
|
const uint8_t *end) {
|
884
|
-
grpc_mdelem
|
885
|
-
GPR_ASSERT(md
|
886
|
-
grpc_error *err = on_hdr(
|
887
|
-
|
888
|
-
|
889
|
-
|
922
|
+
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
923
|
+
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
|
924
|
+
grpc_error *err = on_hdr(
|
925
|
+
exec_ctx, p,
|
926
|
+
grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
|
927
|
+
take_string(exec_ctx, p, &p->value, false)),
|
928
|
+
0);
|
890
929
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
891
930
|
return parse_begin(exec_ctx, p, cur, end);
|
892
931
|
}
|
@@ -896,10 +935,11 @@ static grpc_error *finish_lithdr_notidx_v(grpc_exec_ctx *exec_ctx,
|
|
896
935
|
grpc_chttp2_hpack_parser *p,
|
897
936
|
const uint8_t *cur,
|
898
937
|
const uint8_t *end) {
|
899
|
-
grpc_error *err = on_hdr(
|
900
|
-
|
901
|
-
|
902
|
-
|
938
|
+
grpc_error *err = on_hdr(
|
939
|
+
exec_ctx, p,
|
940
|
+
grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
|
941
|
+
take_string(exec_ctx, p, &p->value, false)),
|
942
|
+
0);
|
903
943
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
904
944
|
return parse_begin(exec_ctx, p, cur, end);
|
905
945
|
}
|
@@ -949,12 +989,13 @@ static grpc_error *finish_lithdr_nvridx(grpc_exec_ctx *exec_ctx,
|
|
949
989
|
grpc_chttp2_hpack_parser *p,
|
950
990
|
const uint8_t *cur,
|
951
991
|
const uint8_t *end) {
|
952
|
-
grpc_mdelem
|
953
|
-
GPR_ASSERT(md
|
954
|
-
grpc_error *err = on_hdr(
|
955
|
-
|
956
|
-
|
957
|
-
|
992
|
+
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
993
|
+
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
|
994
|
+
grpc_error *err = on_hdr(
|
995
|
+
exec_ctx, p,
|
996
|
+
grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
|
997
|
+
take_string(exec_ctx, p, &p->value, false)),
|
998
|
+
0);
|
958
999
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
959
1000
|
return parse_begin(exec_ctx, p, cur, end);
|
960
1001
|
}
|
@@ -964,10 +1005,11 @@ static grpc_error *finish_lithdr_nvridx_v(grpc_exec_ctx *exec_ctx,
|
|
964
1005
|
grpc_chttp2_hpack_parser *p,
|
965
1006
|
const uint8_t *cur,
|
966
1007
|
const uint8_t *end) {
|
967
|
-
grpc_error *err = on_hdr(
|
968
|
-
|
969
|
-
|
970
|
-
|
1008
|
+
grpc_error *err = on_hdr(
|
1009
|
+
exec_ctx, p,
|
1010
|
+
grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
|
1011
|
+
take_string(exec_ctx, p, &p->value, false)),
|
1012
|
+
0);
|
971
1013
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
972
1014
|
return parse_begin(exec_ctx, p, cur, end);
|
973
1015
|
}
|
@@ -1261,14 +1303,15 @@ static grpc_error *parse_string_prefix(grpc_exec_ctx *exec_ctx,
|
|
1261
1303
|
static void append_bytes(grpc_chttp2_hpack_parser_string *str,
|
1262
1304
|
const uint8_t *data, size_t length) {
|
1263
1305
|
if (length == 0) return;
|
1264
|
-
if (length + str->length > str->capacity) {
|
1265
|
-
GPR_ASSERT(str->length + length <= UINT32_MAX);
|
1266
|
-
str->capacity = (uint32_t)(str->length + length);
|
1267
|
-
str->str =
|
1306
|
+
if (length + str->data.copied.length > str->data.copied.capacity) {
|
1307
|
+
GPR_ASSERT(str->data.copied.length + length <= UINT32_MAX);
|
1308
|
+
str->data.copied.capacity = (uint32_t)(str->data.copied.length + length);
|
1309
|
+
str->data.copied.str =
|
1310
|
+
gpr_realloc(str->data.copied.str, str->data.copied.capacity);
|
1268
1311
|
}
|
1269
|
-
memcpy(str->str + str->length, data, length);
|
1270
|
-
GPR_ASSERT(length <= UINT32_MAX - str->length);
|
1271
|
-
str->length += (uint32_t)length;
|
1312
|
+
memcpy(str->data.copied.str + str->data.copied.length, data, length);
|
1313
|
+
GPR_ASSERT(length <= UINT32_MAX - str->data.copied.length);
|
1314
|
+
str->data.copied.length += (uint32_t)length;
|
1272
1315
|
}
|
1273
1316
|
|
1274
1317
|
static grpc_error *append_string(grpc_exec_ctx *exec_ctx,
|
@@ -1351,11 +1394,9 @@ static grpc_error *append_string(grpc_exec_ctx *exec_ctx,
|
|
1351
1394
|
exec_ctx, p, cur, end, GRPC_ERROR_CREATE("Should never reach here")));
|
1352
1395
|
}
|
1353
1396
|
|
1354
|
-
/* append a null terminator to a string */
|
1355
1397
|
static grpc_error *finish_str(grpc_exec_ctx *exec_ctx,
|
1356
1398
|
grpc_chttp2_hpack_parser *p, const uint8_t *cur,
|
1357
1399
|
const uint8_t *end) {
|
1358
|
-
uint8_t terminator = 0;
|
1359
1400
|
uint8_t decoded[2];
|
1360
1401
|
uint32_t bits;
|
1361
1402
|
grpc_chttp2_hpack_parser_string *str = p->parsing.str;
|
@@ -1396,8 +1437,6 @@ static grpc_error *finish_str(grpc_exec_ctx *exec_ctx,
|
|
1396
1437
|
append_bytes(str, decoded, 2);
|
1397
1438
|
break;
|
1398
1439
|
}
|
1399
|
-
append_bytes(str, &terminator, 1);
|
1400
|
-
p->parsing.str->length--; /* don't actually count the null terminator */
|
1401
1440
|
return GRPC_ERROR_NONE;
|
1402
1441
|
}
|
1403
1442
|
|
@@ -1472,8 +1511,18 @@ static grpc_error *begin_parse_string(grpc_exec_ctx *exec_ctx,
|
|
1472
1511
|
const uint8_t *cur, const uint8_t *end,
|
1473
1512
|
uint8_t binary,
|
1474
1513
|
grpc_chttp2_hpack_parser_string *str) {
|
1514
|
+
if (!p->huff && binary == NOT_BINARY && (end - cur) >= (intptr_t)p->strlen &&
|
1515
|
+
p->current_slice_refcount != NULL) {
|
1516
|
+
str->copied = false;
|
1517
|
+
str->data.referenced.refcount = p->current_slice_refcount;
|
1518
|
+
str->data.referenced.data.refcounted.bytes = (uint8_t *)cur;
|
1519
|
+
str->data.referenced.data.refcounted.length = p->strlen;
|
1520
|
+
grpc_slice_ref_internal(str->data.referenced);
|
1521
|
+
return parse_next(exec_ctx, p, cur + p->strlen, end);
|
1522
|
+
}
|
1475
1523
|
p->strgot = 0;
|
1476
|
-
str->
|
1524
|
+
str->copied = true;
|
1525
|
+
str->data.copied.length = 0;
|
1477
1526
|
p->parsing.str = str;
|
1478
1527
|
p->huff_state = 0;
|
1479
1528
|
p->binary = binary;
|
@@ -1490,21 +1539,22 @@ static grpc_error *parse_key_string(grpc_exec_ctx *exec_ctx,
|
|
1490
1539
|
/* check if a key represents a binary header or not */
|
1491
1540
|
|
1492
1541
|
static bool is_binary_literal_header(grpc_chttp2_hpack_parser *p) {
|
1493
|
-
return grpc_is_binary_header(
|
1542
|
+
return grpc_is_binary_header(
|
1543
|
+
p->key.copied ? grpc_slice_from_static_buffer(p->key.data.copied.str,
|
1544
|
+
p->key.data.copied.length)
|
1545
|
+
: p->key.data.referenced);
|
1494
1546
|
}
|
1495
1547
|
|
1496
1548
|
static grpc_error *is_binary_indexed_header(grpc_chttp2_hpack_parser *p,
|
1497
1549
|
bool *is) {
|
1498
|
-
grpc_mdelem
|
1499
|
-
if (
|
1550
|
+
grpc_mdelem elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
1551
|
+
if (GRPC_MDISNULL(elem)) {
|
1500
1552
|
return grpc_error_set_int(
|
1501
1553
|
grpc_error_set_int(GRPC_ERROR_CREATE("Invalid HPACK index received"),
|
1502
1554
|
GRPC_ERROR_INT_INDEX, (intptr_t)p->index),
|
1503
1555
|
GRPC_ERROR_INT_SIZE, (intptr_t)p->table.num_ents);
|
1504
1556
|
}
|
1505
|
-
*is = grpc_is_binary_header(
|
1506
|
-
(const char *)GRPC_SLICE_START_PTR(elem->key->slice),
|
1507
|
-
GRPC_SLICE_LENGTH(elem->key->slice));
|
1557
|
+
*is = grpc_is_binary_header(GRPC_MDKEY(elem));
|
1508
1558
|
return GRPC_ERROR_NONE;
|
1509
1559
|
}
|
1510
1560
|
|
@@ -1539,12 +1589,14 @@ void grpc_chttp2_hpack_parser_init(grpc_exec_ctx *exec_ctx,
|
|
1539
1589
|
p->on_header = NULL;
|
1540
1590
|
p->on_header_user_data = NULL;
|
1541
1591
|
p->state = parse_begin;
|
1542
|
-
p->key.
|
1543
|
-
p->key.
|
1544
|
-
p->key.
|
1545
|
-
p->
|
1546
|
-
p->value.
|
1547
|
-
p->value.
|
1592
|
+
p->key.data.referenced = grpc_empty_slice();
|
1593
|
+
p->key.data.copied.str = NULL;
|
1594
|
+
p->key.data.copied.capacity = 0;
|
1595
|
+
p->key.data.copied.length = 0;
|
1596
|
+
p->value.data.referenced = grpc_empty_slice();
|
1597
|
+
p->value.data.copied.str = NULL;
|
1598
|
+
p->value.data.copied.capacity = 0;
|
1599
|
+
p->value.data.copied.length = 0;
|
1548
1600
|
p->dynamic_table_update_allowed = 2;
|
1549
1601
|
p->last_error = GRPC_ERROR_NONE;
|
1550
1602
|
grpc_chttp2_hptbl_init(exec_ctx, &p->table);
|
@@ -1559,19 +1611,24 @@ void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx *exec_ctx,
|
|
1559
1611
|
grpc_chttp2_hpack_parser *p) {
|
1560
1612
|
grpc_chttp2_hptbl_destroy(exec_ctx, &p->table);
|
1561
1613
|
GRPC_ERROR_UNREF(p->last_error);
|
1562
|
-
|
1563
|
-
|
1614
|
+
grpc_slice_unref_internal(exec_ctx, p->key.data.referenced);
|
1615
|
+
grpc_slice_unref_internal(exec_ctx, p->value.data.referenced);
|
1616
|
+
gpr_free(p->key.data.copied.str);
|
1617
|
+
gpr_free(p->value.data.copied.str);
|
1564
1618
|
}
|
1565
1619
|
|
1566
1620
|
grpc_error *grpc_chttp2_hpack_parser_parse(grpc_exec_ctx *exec_ctx,
|
1567
1621
|
grpc_chttp2_hpack_parser *p,
|
1568
|
-
|
1569
|
-
const uint8_t *end) {
|
1622
|
+
grpc_slice slice) {
|
1570
1623
|
/* TODO(ctiller): limit the distance of end from beg, and perform multiple
|
1571
1624
|
steps in the event of a large chunk of data to limit
|
1572
1625
|
stack space usage when no tail call optimization is
|
1573
1626
|
available */
|
1574
|
-
|
1627
|
+
p->current_slice_refcount = slice.refcount;
|
1628
|
+
grpc_error *error = p->state(exec_ctx, p, GRPC_SLICE_START_PTR(slice),
|
1629
|
+
GRPC_SLICE_END_PTR(slice));
|
1630
|
+
p->current_slice_refcount = NULL;
|
1631
|
+
return error;
|
1575
1632
|
}
|
1576
1633
|
|
1577
1634
|
typedef void (*maybe_complete_func_type)(grpc_exec_ctx *exec_ctx,
|
@@ -1587,7 +1644,7 @@ static void force_client_rst_stream(grpc_exec_ctx *exec_ctx, void *sp,
|
|
1587
1644
|
grpc_chttp2_transport *t = s->t;
|
1588
1645
|
if (!s->write_closed) {
|
1589
1646
|
grpc_slice_buffer_add(
|
1590
|
-
&t->qbuf, grpc_chttp2_rst_stream_create(s->id,
|
1647
|
+
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR,
|
1591
1648
|
&s->stats.outgoing));
|
1592
1649
|
grpc_chttp2_initiate_write(exec_ctx, t, false, "force_rst_stream");
|
1593
1650
|
grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, true, GRPC_ERROR_NONE);
|
@@ -1605,8 +1662,7 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
|
|
1605
1662
|
if (s != NULL) {
|
1606
1663
|
s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
|
1607
1664
|
}
|
1608
|
-
grpc_error *error = grpc_chttp2_hpack_parser_parse(
|
1609
|
-
exec_ctx, parser, GRPC_SLICE_START_PTR(slice), GRPC_SLICE_END_PTR(slice));
|
1665
|
+
grpc_error *error = grpc_chttp2_hpack_parser_parse(exec_ctx, parser, slice);
|
1610
1666
|
if (error != GRPC_ERROR_NONE) {
|
1611
1667
|
GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
|
1612
1668
|
return error;
|
@@ -49,14 +49,20 @@ typedef grpc_error *(*grpc_chttp2_hpack_parser_state)(
|
|
49
49
|
const uint8_t *end);
|
50
50
|
|
51
51
|
typedef struct {
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
bool copied;
|
53
|
+
struct {
|
54
|
+
grpc_slice referenced;
|
55
|
+
struct {
|
56
|
+
char *str;
|
57
|
+
uint32_t length;
|
58
|
+
uint32_t capacity;
|
59
|
+
} copied;
|
60
|
+
} data;
|
55
61
|
} grpc_chttp2_hpack_parser_string;
|
56
62
|
|
57
63
|
struct grpc_chttp2_hpack_parser {
|
58
64
|
/* user specified callback for each header output */
|
59
|
-
void (*on_header)(grpc_exec_ctx *exec_ctx, void *user_data, grpc_mdelem
|
65
|
+
void (*on_header)(grpc_exec_ctx *exec_ctx, void *user_data, grpc_mdelem md);
|
60
66
|
void *on_header_user_data;
|
61
67
|
|
62
68
|
grpc_error *last_error;
|
@@ -67,6 +73,8 @@ struct grpc_chttp2_hpack_parser {
|
|
67
73
|
const grpc_chttp2_hpack_parser_state *next_state;
|
68
74
|
/* what to do after skipping prioritization data */
|
69
75
|
grpc_chttp2_hpack_parser_state after_prioritization;
|
76
|
+
/* the refcount of the slice that we're currently parsing */
|
77
|
+
grpc_slice_refcount *current_slice_refcount;
|
70
78
|
/* the value we're currently parsing */
|
71
79
|
union {
|
72
80
|
uint32_t *value;
|
@@ -106,11 +114,9 @@ void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx *exec_ctx,
|
|
106
114
|
|
107
115
|
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser *p);
|
108
116
|
|
109
|
-
/* returns 1 on success, 0 on error */
|
110
117
|
grpc_error *grpc_chttp2_hpack_parser_parse(grpc_exec_ctx *exec_ctx,
|
111
118
|
grpc_chttp2_hpack_parser *p,
|
112
|
-
|
113
|
-
const uint8_t *end);
|
119
|
+
grpc_slice slice);
|
114
120
|
|
115
121
|
/* wraps grpc_chttp2_hpack_parser_parse to provide a frame level parser for
|
116
122
|
the transport */
|
@@ -190,8 +190,11 @@ void grpc_chttp2_hptbl_init(grpc_exec_ctx *exec_ctx, grpc_chttp2_hptbl *tbl) {
|
|
190
190
|
tbl->ents = gpr_malloc(sizeof(*tbl->ents) * tbl->cap_entries);
|
191
191
|
memset(tbl->ents, 0, sizeof(*tbl->ents) * tbl->cap_entries);
|
192
192
|
for (i = 1; i <= GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
|
193
|
-
tbl->static_ents[i - 1] =
|
194
|
-
exec_ctx,
|
193
|
+
tbl->static_ents[i - 1] = grpc_mdelem_from_slices(
|
194
|
+
exec_ctx,
|
195
|
+
grpc_slice_intern(grpc_slice_from_static_string(static_table[i].key)),
|
196
|
+
grpc_slice_intern(
|
197
|
+
grpc_slice_from_static_string(static_table[i].value)));
|
195
198
|
}
|
196
199
|
}
|
197
200
|
|
@@ -208,8 +211,8 @@ void grpc_chttp2_hptbl_destroy(grpc_exec_ctx *exec_ctx,
|
|
208
211
|
gpr_free(tbl->ents);
|
209
212
|
}
|
210
213
|
|
211
|
-
grpc_mdelem
|
212
|
-
|
214
|
+
grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl *tbl,
|
215
|
+
uint32_t tbl_index) {
|
213
216
|
/* Static table comes first, just return an entry from it */
|
214
217
|
if (tbl_index <= GRPC_CHTTP2_LAST_STATIC_ENTRY) {
|
215
218
|
return tbl->static_ents[tbl_index - 1];
|
@@ -222,14 +225,14 @@ grpc_mdelem *grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl *tbl,
|
|
222
225
|
return tbl->ents[offset];
|
223
226
|
}
|
224
227
|
/* Invalid entry: return error */
|
225
|
-
return
|
228
|
+
return GRPC_MDNULL;
|
226
229
|
}
|
227
230
|
|
228
231
|
/* Evict one element from the table */
|
229
232
|
static void evict1(grpc_exec_ctx *exec_ctx, grpc_chttp2_hptbl *tbl) {
|
230
|
-
grpc_mdelem
|
231
|
-
size_t elem_bytes = GRPC_SLICE_LENGTH(first_ent
|
232
|
-
GRPC_SLICE_LENGTH(first_ent
|
233
|
+
grpc_mdelem first_ent = tbl->ents[tbl->first_ent];
|
234
|
+
size_t elem_bytes = GRPC_SLICE_LENGTH(GRPC_MDKEY(first_ent)) +
|
235
|
+
GRPC_SLICE_LENGTH(GRPC_MDVALUE(first_ent)) +
|
233
236
|
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
|
234
237
|
GPR_ASSERT(elem_bytes <= tbl->mem_used);
|
235
238
|
tbl->mem_used -= (uint32_t)elem_bytes;
|
@@ -239,7 +242,7 @@ static void evict1(grpc_exec_ctx *exec_ctx, grpc_chttp2_hptbl *tbl) {
|
|
239
242
|
}
|
240
243
|
|
241
244
|
static void rebuild_ents(grpc_chttp2_hptbl *tbl, uint32_t new_cap) {
|
242
|
-
grpc_mdelem
|
245
|
+
grpc_mdelem *ents = gpr_malloc(sizeof(*ents) * new_cap);
|
243
246
|
uint32_t i;
|
244
247
|
|
245
248
|
for (i = 0; i < tbl->num_ents; i++) {
|
@@ -301,10 +304,10 @@ grpc_error *grpc_chttp2_hptbl_set_current_table_size(grpc_exec_ctx *exec_ctx,
|
|
301
304
|
}
|
302
305
|
|
303
306
|
grpc_error *grpc_chttp2_hptbl_add(grpc_exec_ctx *exec_ctx,
|
304
|
-
grpc_chttp2_hptbl *tbl, grpc_mdelem
|
307
|
+
grpc_chttp2_hptbl *tbl, grpc_mdelem md) {
|
305
308
|
/* determine how many bytes of buffer this entry represents */
|
306
|
-
size_t elem_bytes = GRPC_SLICE_LENGTH(md
|
307
|
-
GRPC_SLICE_LENGTH(md
|
309
|
+
size_t elem_bytes = GRPC_SLICE_LENGTH(GRPC_MDKEY(md)) +
|
310
|
+
GRPC_SLICE_LENGTH(GRPC_MDVALUE(md)) +
|
308
311
|
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
|
309
312
|
|
310
313
|
if (tbl->current_table_bytes > tbl->max_bytes) {
|
@@ -352,16 +355,16 @@ grpc_error *grpc_chttp2_hptbl_add(grpc_exec_ctx *exec_ctx,
|
|
352
355
|
}
|
353
356
|
|
354
357
|
grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
|
355
|
-
const grpc_chttp2_hptbl *tbl, grpc_mdelem
|
358
|
+
const grpc_chttp2_hptbl *tbl, grpc_mdelem md) {
|
356
359
|
grpc_chttp2_hptbl_find_result r = {0, 0};
|
357
360
|
uint32_t i;
|
358
361
|
|
359
362
|
/* See if the string is in the static table */
|
360
363
|
for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
|
361
|
-
grpc_mdelem
|
362
|
-
if (md
|
364
|
+
grpc_mdelem ent = tbl->static_ents[i];
|
365
|
+
if (!grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDKEY(ent))) continue;
|
363
366
|
r.index = i + 1u;
|
364
|
-
r.has_value = md
|
367
|
+
r.has_value = grpc_slice_eq(GRPC_MDVALUE(md), GRPC_MDVALUE(ent));
|
365
368
|
if (r.has_value) return r;
|
366
369
|
}
|
367
370
|
|
@@ -369,10 +372,10 @@ grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
|
|
369
372
|
for (i = 0; i < tbl->num_ents; i++) {
|
370
373
|
uint32_t idx =
|
371
374
|
(uint32_t)(tbl->num_ents - i + GRPC_CHTTP2_LAST_STATIC_ENTRY);
|
372
|
-
grpc_mdelem
|
373
|
-
if (md
|
375
|
+
grpc_mdelem ent = tbl->ents[(tbl->first_ent + i) % tbl->cap_entries];
|
376
|
+
if (!grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDKEY(ent))) continue;
|
374
377
|
r.index = idx;
|
375
|
-
r.has_value = md
|
378
|
+
r.has_value = grpc_slice_eq(GRPC_MDVALUE(md), GRPC_MDVALUE(ent));
|
376
379
|
if (r.has_value) return r;
|
377
380
|
}
|
378
381
|
|