grpc 1.22.0 → 1.23.0
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 +487 -649
- data/include/grpc/grpc_security.h +25 -0
- data/include/grpc/impl/codegen/grpc_types.h +11 -2
- data/include/grpc/impl/codegen/port_platform.h +12 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +4 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +477 -182
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +25 -16
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +11 -6
- data/src/core/ext/filters/client_channel/connector.h +10 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +9 -10
- data/src/core/ext/filters/client_channel/lb_policy.cc +2 -17
- data/src/core/ext/filters/client_channel/lb_policy.h +36 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +22 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +86 -52
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +7 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +73 -72
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +8 -12
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +25 -101
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +5 -5
- data/src/core/ext/filters/client_channel/parse_address.cc +29 -26
- data/src/core/ext/filters/client_channel/resolver.h +3 -11
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +405 -82
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +44 -51
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +0 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +11 -6
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +130 -65
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +8 -3
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +31 -14
- data/src/core/ext/filters/client_channel/resolver_factory.h +4 -0
- data/src/core/ext/filters/client_channel/resolver_registry.cc +11 -0
- data/src/core/ext/filters/client_channel/resolver_registry.h +3 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +10 -49
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +1 -14
- data/src/core/ext/filters/client_channel/retry_throttle.h +2 -3
- data/src/core/ext/filters/client_channel/subchannel.cc +65 -58
- data/src/core/ext/filters/client_channel/subchannel.h +65 -45
- data/src/core/ext/filters/client_channel/subchannel_interface.h +15 -30
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +262 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +4 -5
- data/src/core/ext/filters/http/client_authority_filter.cc +2 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +140 -152
- data/src/core/ext/filters/max_age/max_age_filter.cc +3 -3
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +3 -4
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +63 -38
- data/src/core/ext/transport/chttp2/transport/context_list.cc +3 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +8 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +7 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +37 -22
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +136 -81
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +8 -0
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +7 -166
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +41 -15
- data/src/core/ext/transport/chttp2/transport/internal.h +13 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +35 -22
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +28 -18
- data/src/core/ext/transport/chttp2/transport/writing.cc +1 -0
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
- data/src/core/lib/channel/channelz.cc +80 -33
- data/src/core/lib/channel/channelz.h +28 -13
- data/src/core/lib/compression/compression.cc +1 -2
- data/src/core/lib/compression/compression_args.cc +13 -6
- data/src/core/lib/compression/compression_args.h +3 -2
- data/src/core/lib/compression/compression_internal.cc +1 -1
- data/src/core/lib/gpr/env_linux.cc +10 -21
- data/src/core/lib/gpr/env_posix.cc +0 -5
- data/src/core/lib/gpr/string.cc +7 -2
- data/src/core/lib/gpr/string.h +1 -0
- data/src/core/lib/gpr/sync_posix.cc +0 -129
- data/src/core/lib/gprpp/debug_location.h +3 -2
- data/src/core/lib/gprpp/fork.cc +14 -21
- data/src/core/lib/gprpp/fork.h +15 -4
- data/src/core/lib/gprpp/host_port.cc +118 -0
- data/src/core/lib/{gpr → gprpp}/host_port.h +27 -11
- data/src/core/lib/gprpp/map.h +25 -0
- data/src/core/lib/gprpp/memory.h +26 -9
- data/src/core/lib/gprpp/ref_counted.h +63 -21
- data/src/core/lib/gprpp/string_view.h +143 -0
- data/src/core/lib/gprpp/thd.h +10 -1
- data/src/core/lib/gprpp/thd_posix.cc +25 -0
- data/src/core/lib/gprpp/thd_windows.cc +9 -1
- data/src/core/lib/http/httpcli_security_connector.cc +3 -1
- data/src/core/lib/iomgr/cfstream_handle.cc +6 -1
- data/src/core/lib/iomgr/cfstream_handle.h +8 -2
- data/src/core/lib/iomgr/combiner.cc +4 -4
- data/src/core/lib/iomgr/error.cc +18 -8
- data/src/core/lib/iomgr/error.h +2 -0
- data/src/core/lib/iomgr/ev_posix.cc +4 -2
- data/src/core/lib/iomgr/executor.cc +4 -1
- data/src/core/lib/iomgr/executor/mpmcqueue.cc +183 -0
- data/src/core/lib/iomgr/executor/mpmcqueue.h +178 -0
- data/src/core/lib/iomgr/executor/threadpool.cc +138 -0
- data/src/core/lib/iomgr/executor/threadpool.h +153 -0
- data/src/core/lib/iomgr/fork_posix.cc +4 -2
- data/src/core/lib/iomgr/iocp_windows.cc +2 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +14 -0
- data/src/core/lib/iomgr/iomgr_uv.cc +3 -0
- data/src/core/lib/iomgr/lockfree_event.cc +3 -3
- data/src/core/lib/iomgr/resolve_address_custom.cc +16 -20
- data/src/core/lib/iomgr/resolve_address_posix.cc +8 -10
- data/src/core/lib/iomgr/resolve_address_windows.cc +6 -8
- data/src/core/lib/iomgr/sockaddr_utils.cc +5 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +0 -1
- data/src/core/lib/iomgr/socket_windows.h +1 -1
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +7 -6
- data/src/core/lib/iomgr/tcp_client_custom.cc +1 -0
- data/src/core/lib/iomgr/tcp_custom.cc +4 -0
- data/src/core/lib/iomgr/tcp_posix.cc +8 -2
- data/src/core/lib/iomgr/tcp_server_custom.cc +1 -0
- data/src/core/lib/iomgr/tcp_server_windows.cc +1 -1
- data/src/core/lib/iomgr/tcp_windows.cc +7 -7
- data/src/core/lib/iomgr/timer_custom.cc +1 -0
- data/src/core/lib/iomgr/timer_manager.cc +0 -29
- data/src/core/lib/security/credentials/credentials.cc +84 -0
- data/src/core/lib/security/credentials/credentials.h +58 -2
- data/src/core/lib/security/credentials/jwt/json_token.cc +6 -2
- data/src/core/lib/security/credentials/jwt/json_token.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +245 -24
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +16 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +3 -2
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +21 -25
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +3 -2
- data/src/core/lib/security/security_connector/security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +19 -19
- data/src/core/lib/security/security_connector/ssl_utils.cc +26 -31
- data/src/core/lib/security/security_connector/ssl_utils.h +11 -8
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +16 -20
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +4 -3
- data/src/core/lib/security/transport/client_auth_filter.cc +1 -2
- data/src/core/lib/security/util/json_util.cc +19 -5
- data/src/core/lib/security/util/json_util.h +3 -1
- data/src/core/lib/slice/slice.cc +69 -50
- data/src/core/lib/slice/slice_buffer.cc +6 -5
- data/src/core/lib/slice/slice_hash_table.h +3 -7
- data/src/core/lib/slice/slice_intern.cc +130 -39
- data/src/core/lib/slice/slice_internal.h +8 -0
- data/src/core/lib/slice/slice_utils.h +120 -0
- data/src/core/lib/slice/slice_weak_hash_table.h +2 -7
- data/src/core/lib/surface/call.cc +8 -3
- data/src/core/lib/surface/channel.cc +31 -8
- data/src/core/lib/surface/completion_queue.cc +17 -7
- data/src/core/lib/surface/init_secure.cc +4 -1
- data/src/core/lib/surface/lame_client.cc +2 -2
- data/src/core/lib/surface/server.cc +34 -35
- data/src/core/lib/surface/server.h +8 -17
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/byte_stream.cc +3 -5
- data/src/core/lib/transport/byte_stream.h +1 -2
- data/src/core/lib/transport/error_utils.cc +10 -1
- data/src/core/lib/transport/metadata.cc +202 -35
- data/src/core/lib/transport/metadata.h +81 -6
- data/src/core/lib/transport/static_metadata.cc +1257 -465
- data/src/core/lib/transport/static_metadata.h +190 -347
- data/src/core/lib/transport/timeout_encoding.cc +7 -0
- data/src/core/lib/transport/timeout_encoding.h +3 -2
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +0 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +2 -7
- data/src/core/tsi/ssl_transport_security.cc +35 -43
- data/src/core/tsi/ssl_transport_security.h +2 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +1 -1
- data/src/ruby/lib/grpc/grpc.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +39 -33
- data/src/core/lib/gpr/host_port.cc +0 -98
@@ -44,6 +44,9 @@ static int64_t round_up_to_three_sig_figs(int64_t x) {
|
|
44
44
|
/* encode our minimum viable timeout value */
|
45
45
|
static void enc_tiny(char* buffer) { memcpy(buffer, "1n", 3); }
|
46
46
|
|
47
|
+
/* encode our maximum timeout value, about 1157 days */
|
48
|
+
static void enc_huge(char* buffer) { memcpy(buffer, "99999999S", 10); }
|
49
|
+
|
47
50
|
static void enc_ext(char* buffer, int64_t value, char ext) {
|
48
51
|
int n = int64_ttoa(value, buffer);
|
49
52
|
buffer[n] = ext;
|
@@ -51,6 +54,7 @@ static void enc_ext(char* buffer, int64_t value, char ext) {
|
|
51
54
|
}
|
52
55
|
|
53
56
|
static void enc_seconds(char* buffer, int64_t sec) {
|
57
|
+
sec = round_up_to_three_sig_figs(sec);
|
54
58
|
if (sec % 3600 == 0) {
|
55
59
|
enc_ext(buffer, sec / 3600, 'H');
|
56
60
|
} else if (sec % 60 == 0) {
|
@@ -74,10 +78,13 @@ static void enc_millis(char* buffer, int64_t x) {
|
|
74
78
|
}
|
75
79
|
|
76
80
|
void grpc_http2_encode_timeout(grpc_millis timeout, char* buffer) {
|
81
|
+
const grpc_millis kMaxTimeout = 99999999000;
|
77
82
|
if (timeout <= 0) {
|
78
83
|
enc_tiny(buffer);
|
79
84
|
} else if (timeout < 1000 * GPR_MS_PER_SEC) {
|
80
85
|
enc_millis(buffer, timeout);
|
86
|
+
} else if (timeout >= kMaxTimeout) {
|
87
|
+
enc_huge(buffer);
|
81
88
|
} else {
|
82
89
|
enc_seconds(buffer,
|
83
90
|
timeout / GPR_MS_PER_SEC + (timeout % GPR_MS_PER_SEC != 0));
|
@@ -27,10 +27,11 @@
|
|
27
27
|
#include "src/core/lib/gpr/string.h"
|
28
28
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
29
29
|
|
30
|
-
#define GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE
|
30
|
+
#define GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE 10
|
31
31
|
|
32
32
|
/* Encode/decode timeouts to the GRPC over HTTP/2 format;
|
33
|
-
encoding may round up arbitrarily
|
33
|
+
encoding may round up arbitrarily. If the timeout is larger than about 1157
|
34
|
+
days, it will be capped and "99999999S" will be sent on the wire. */
|
34
35
|
void grpc_http2_encode_timeout(grpc_millis timeout, char* buffer);
|
35
36
|
int grpc_http2_decode_timeout(const grpc_slice& text, grpc_millis* timeout);
|
36
37
|
|
@@ -46,6 +46,8 @@ void grpc_resolver_dns_native_init(void);
|
|
46
46
|
void grpc_resolver_dns_native_shutdown(void);
|
47
47
|
void grpc_resolver_sockaddr_init(void);
|
48
48
|
void grpc_resolver_sockaddr_shutdown(void);
|
49
|
+
void grpc_client_idle_filter_init(void);
|
50
|
+
void grpc_client_idle_filter_shutdown(void);
|
49
51
|
void grpc_max_age_filter_init(void);
|
50
52
|
void grpc_max_age_filter_shutdown(void);
|
51
53
|
void grpc_message_size_filter_init(void);
|
@@ -82,6 +84,8 @@ void grpc_register_built_in_plugins(void) {
|
|
82
84
|
grpc_resolver_dns_native_shutdown);
|
83
85
|
grpc_register_plugin(grpc_resolver_sockaddr_init,
|
84
86
|
grpc_resolver_sockaddr_shutdown);
|
87
|
+
grpc_register_plugin(grpc_client_idle_filter_init,
|
88
|
+
grpc_client_idle_filter_shutdown);
|
85
89
|
grpc_register_plugin(grpc_max_age_filter_init,
|
86
90
|
grpc_max_age_filter_shutdown);
|
87
91
|
grpc_register_plugin(grpc_message_size_filter_init,
|
@@ -67,13 +67,8 @@ class SslSessionLRUCache : public grpc_core::RefCounted<SslSessionLRUCache> {
|
|
67
67
|
SslSessionPtr Get(const char* key);
|
68
68
|
|
69
69
|
private:
|
70
|
-
|
71
|
-
|
72
|
-
friend T* grpc_core::New(Args&&... args);
|
73
|
-
|
74
|
-
// So Delete() can call our private dtor.
|
75
|
-
template <typename T>
|
76
|
-
friend void grpc_core::Delete(T*);
|
70
|
+
GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW
|
71
|
+
GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE
|
77
72
|
|
78
73
|
class Node;
|
79
74
|
|
@@ -233,11 +233,10 @@ static void ssl_info_callback(const SSL* ssl, int where, int ret) {
|
|
233
233
|
|
234
234
|
/* Returns 1 if name looks like an IP address, 0 otherwise.
|
235
235
|
This is a very rough heuristic, and only handles IPv6 in hexadecimal form. */
|
236
|
-
static int looks_like_ip_address(
|
237
|
-
size_t i;
|
236
|
+
static int looks_like_ip_address(grpc_core::StringView name) {
|
238
237
|
size_t dot_count = 0;
|
239
238
|
size_t num_size = 0;
|
240
|
-
for (i = 0; i <
|
239
|
+
for (size_t i = 0; i < name.size(); ++i) {
|
241
240
|
if (name[i] == ':') {
|
242
241
|
/* IPv6 Address in hexadecimal form, : is not allowed in DNS names. */
|
243
242
|
return 1;
|
@@ -1506,52 +1505,46 @@ static void tsi_ssl_server_handshaker_factory_destroy(
|
|
1506
1505
|
gpr_free(self);
|
1507
1506
|
}
|
1508
1507
|
|
1509
|
-
static int does_entry_match_name(
|
1510
|
-
|
1511
|
-
|
1512
|
-
const char* name_subdomain = nullptr;
|
1513
|
-
size_t name_length = strlen(name);
|
1514
|
-
size_t name_subdomain_length;
|
1515
|
-
if (entry_length == 0) return 0;
|
1508
|
+
static int does_entry_match_name(grpc_core::StringView entry,
|
1509
|
+
grpc_core::StringView name) {
|
1510
|
+
if (entry.empty()) return 0;
|
1516
1511
|
|
1517
1512
|
/* Take care of '.' terminations. */
|
1518
|
-
if (name
|
1519
|
-
|
1513
|
+
if (name.back() == '.') {
|
1514
|
+
name.remove_suffix(1);
|
1520
1515
|
}
|
1521
|
-
if (entry
|
1522
|
-
|
1523
|
-
if (
|
1516
|
+
if (entry.back() == '.') {
|
1517
|
+
entry.remove_suffix(1);
|
1518
|
+
if (entry.empty()) return 0;
|
1524
1519
|
}
|
1525
1520
|
|
1526
|
-
if (
|
1527
|
-
strncmp(name, entry, entry_length) == 0) {
|
1521
|
+
if (name == entry) {
|
1528
1522
|
return 1; /* Perfect match. */
|
1529
1523
|
}
|
1530
|
-
if (entry
|
1524
|
+
if (entry.front() != '*') return 0;
|
1531
1525
|
|
1532
1526
|
/* Wildchar subdomain matching. */
|
1533
|
-
if (
|
1527
|
+
if (entry.size() < 3 || entry[1] != '.') { /* At least *.x */
|
1534
1528
|
gpr_log(GPR_ERROR, "Invalid wildchar entry.");
|
1535
1529
|
return 0;
|
1536
1530
|
}
|
1537
|
-
|
1538
|
-
if (
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1531
|
+
size_t name_subdomain_pos = name.find('.');
|
1532
|
+
if (name_subdomain_pos == grpc_core::StringView::npos) return 0;
|
1533
|
+
if (name_subdomain_pos >= name.size() - 2) return 0;
|
1534
|
+
grpc_core::StringView name_subdomain =
|
1535
|
+
name.substr(name_subdomain_pos + 1); /* Starts after the dot. */
|
1536
|
+
entry.remove_prefix(2); /* Remove *. */
|
1537
|
+
size_t dot = name_subdomain.find('.');
|
1538
|
+
if (dot == grpc_core::StringView::npos || dot == name_subdomain.size() - 1) {
|
1539
|
+
grpc_core::UniquePtr<char> name_subdomain_cstr(name_subdomain.dup());
|
1540
|
+
gpr_log(GPR_ERROR, "Invalid toplevel subdomain: %s",
|
1541
|
+
name_subdomain_cstr.get());
|
1548
1542
|
return 0;
|
1549
1543
|
}
|
1550
|
-
if (name_subdomain
|
1551
|
-
|
1544
|
+
if (name_subdomain.back() == '.') {
|
1545
|
+
name_subdomain.remove_suffix(1);
|
1552
1546
|
}
|
1553
|
-
return (
|
1554
|
-
strncmp(entry, name_subdomain, entry_length) == 0);
|
1547
|
+
return !entry.empty() && name_subdomain == entry;
|
1555
1548
|
}
|
1556
1549
|
|
1557
1550
|
static int ssl_server_handshaker_factory_servername_callback(SSL* ssl, int* ap,
|
@@ -1919,7 +1912,8 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
|
|
1919
1912
|
|
1920
1913
|
/* --- tsi_ssl utils. --- */
|
1921
1914
|
|
1922
|
-
int tsi_ssl_peer_matches_name(const tsi_peer* peer,
|
1915
|
+
int tsi_ssl_peer_matches_name(const tsi_peer* peer,
|
1916
|
+
grpc_core::StringView name) {
|
1923
1917
|
size_t i = 0;
|
1924
1918
|
size_t san_count = 0;
|
1925
1919
|
const tsi_peer_property* cn_property = nullptr;
|
@@ -1933,13 +1927,10 @@ int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name) {
|
|
1933
1927
|
TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY) == 0) {
|
1934
1928
|
san_count++;
|
1935
1929
|
|
1936
|
-
|
1937
|
-
|
1930
|
+
grpc_core::StringView entry(property->value.data, property->value.length);
|
1931
|
+
if (!like_ip && does_entry_match_name(entry, name)) {
|
1938
1932
|
return 1;
|
1939
|
-
} else if (like_ip &&
|
1940
|
-
strncmp(name, property->value.data, property->value.length) ==
|
1941
|
-
0 &&
|
1942
|
-
strlen(name) == property->value.length) {
|
1933
|
+
} else if (like_ip && name == entry) {
|
1943
1934
|
/* IP Addresses are exact matches only. */
|
1944
1935
|
return 1;
|
1945
1936
|
}
|
@@ -1951,8 +1942,9 @@ int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name) {
|
|
1951
1942
|
|
1952
1943
|
/* If there's no SAN, try the CN, but only if its not like an IP Address */
|
1953
1944
|
if (san_count == 0 && cn_property != nullptr && !like_ip) {
|
1954
|
-
if (does_entry_match_name(cn_property->value.data,
|
1955
|
-
|
1945
|
+
if (does_entry_match_name(grpc_core::StringView(cn_property->value.data,
|
1946
|
+
cn_property->value.length),
|
1947
|
+
name)) {
|
1956
1948
|
return 1;
|
1957
1949
|
}
|
1958
1950
|
}
|
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include "src/core/lib/gprpp/string_view.h"
|
24
25
|
#include "src/core/tsi/transport_security_interface.h"
|
25
26
|
|
26
27
|
/* Value for the TSI_CERTIFICATE_TYPE_PEER_PROPERTY property for X509 certs. */
|
@@ -306,7 +307,7 @@ void tsi_ssl_server_handshaker_factory_unref(
|
|
306
307
|
- handle mixed case.
|
307
308
|
- handle %encoded chars.
|
308
309
|
- handle public suffix wildchar more strictly (e.g. *.co.uk) */
|
309
|
-
int tsi_ssl_peer_matches_name(const tsi_peer* peer,
|
310
|
+
int tsi_ssl_peer_matches_name(const tsi_peer* peer, grpc_core::StringView name);
|
310
311
|
|
311
312
|
/* --- Testing support. ---
|
312
313
|
|
@@ -134,6 +134,7 @@ grpc_service_account_jwt_access_credentials_create_type grpc_service_account_jwt
|
|
134
134
|
grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
|
135
135
|
grpc_access_token_credentials_create_type grpc_access_token_credentials_create_import;
|
136
136
|
grpc_google_iam_credentials_create_type grpc_google_iam_credentials_create_import;
|
137
|
+
grpc_sts_credentials_create_type grpc_sts_credentials_create_import;
|
137
138
|
grpc_metadata_credentials_create_from_plugin_type grpc_metadata_credentials_create_from_plugin_import;
|
138
139
|
grpc_secure_channel_create_type grpc_secure_channel_create_import;
|
139
140
|
grpc_server_credentials_release_type grpc_server_credentials_release_import;
|
@@ -404,6 +405,7 @@ void grpc_rb_load_imports(HMODULE library) {
|
|
404
405
|
grpc_google_refresh_token_credentials_create_import = (grpc_google_refresh_token_credentials_create_type) GetProcAddress(library, "grpc_google_refresh_token_credentials_create");
|
405
406
|
grpc_access_token_credentials_create_import = (grpc_access_token_credentials_create_type) GetProcAddress(library, "grpc_access_token_credentials_create");
|
406
407
|
grpc_google_iam_credentials_create_import = (grpc_google_iam_credentials_create_type) GetProcAddress(library, "grpc_google_iam_credentials_create");
|
408
|
+
grpc_sts_credentials_create_import = (grpc_sts_credentials_create_type) GetProcAddress(library, "grpc_sts_credentials_create");
|
407
409
|
grpc_metadata_credentials_create_from_plugin_import = (grpc_metadata_credentials_create_from_plugin_type) GetProcAddress(library, "grpc_metadata_credentials_create_from_plugin");
|
408
410
|
grpc_secure_channel_create_import = (grpc_secure_channel_create_type) GetProcAddress(library, "grpc_secure_channel_create");
|
409
411
|
grpc_server_credentials_release_import = (grpc_server_credentials_release_type) GetProcAddress(library, "grpc_server_credentials_release");
|
@@ -377,6 +377,9 @@ extern grpc_access_token_credentials_create_type grpc_access_token_credentials_c
|
|
377
377
|
typedef grpc_call_credentials*(*grpc_google_iam_credentials_create_type)(const char* authorization_token, const char* authority_selector, void* reserved);
|
378
378
|
extern grpc_google_iam_credentials_create_type grpc_google_iam_credentials_create_import;
|
379
379
|
#define grpc_google_iam_credentials_create grpc_google_iam_credentials_create_import
|
380
|
+
typedef grpc_call_credentials*(*grpc_sts_credentials_create_type)(const grpc_sts_credentials_options* options, void* reserved);
|
381
|
+
extern grpc_sts_credentials_create_type grpc_sts_credentials_create_import;
|
382
|
+
#define grpc_sts_credentials_create grpc_sts_credentials_create_import
|
380
383
|
typedef grpc_call_credentials*(*grpc_metadata_credentials_create_from_plugin_type)(grpc_metadata_credentials_plugin plugin, void* reserved);
|
381
384
|
extern grpc_metadata_credentials_create_from_plugin_type grpc_metadata_credentials_create_from_plugin_import;
|
382
385
|
#define grpc_metadata_credentials_create_from_plugin grpc_metadata_credentials_create_from_plugin_import
|
@@ -210,7 +210,7 @@ module GRPC
|
|
210
210
|
# A server arguments hash to be passed down to the underlying core server
|
211
211
|
#
|
212
212
|
# * interceptors:
|
213
|
-
#
|
213
|
+
# An array of GRPC::ServerInterceptor objects that will be used for
|
214
214
|
# intercepting server handlers to provide extra functionality.
|
215
215
|
# Interceptors are an EXPERIMENTAL API.
|
216
216
|
#
|
data/src/ruby/lib/grpc/grpc.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gRPC Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: src/ruby/bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -365,6 +365,7 @@ files:
|
|
365
365
|
- src/core/ext/filters/client_channel/subchannel_interface.h
|
366
366
|
- src/core/ext/filters/client_channel/subchannel_pool_interface.cc
|
367
367
|
- src/core/ext/filters/client_channel/subchannel_pool_interface.h
|
368
|
+
- src/core/ext/filters/client_idle/client_idle_filter.cc
|
368
369
|
- src/core/ext/filters/deadline/deadline_filter.cc
|
369
370
|
- src/core/ext/filters/deadline/deadline_filter.h
|
370
371
|
- src/core/ext/filters/http/client/http_client_filter.cc
|
@@ -503,8 +504,6 @@ files:
|
|
503
504
|
- src/core/lib/gpr/env_linux.cc
|
504
505
|
- src/core/lib/gpr/env_posix.cc
|
505
506
|
- src/core/lib/gpr/env_windows.cc
|
506
|
-
- src/core/lib/gpr/host_port.cc
|
507
|
-
- src/core/lib/gpr/host_port.h
|
508
507
|
- src/core/lib/gpr/log.cc
|
509
508
|
- src/core/lib/gpr/log_android.cc
|
510
509
|
- src/core/lib/gpr/log_linux.cc
|
@@ -552,6 +551,8 @@ files:
|
|
552
551
|
- src/core/lib/gprpp/global_config_env.cc
|
553
552
|
- src/core/lib/gprpp/global_config_env.h
|
554
553
|
- src/core/lib/gprpp/global_config_generic.h
|
554
|
+
- src/core/lib/gprpp/host_port.cc
|
555
|
+
- src/core/lib/gprpp/host_port.h
|
555
556
|
- src/core/lib/gprpp/inlined_vector.h
|
556
557
|
- src/core/lib/gprpp/manual_constructor.h
|
557
558
|
- src/core/lib/gprpp/map.h
|
@@ -561,6 +562,7 @@ files:
|
|
561
562
|
- src/core/lib/gprpp/pair.h
|
562
563
|
- src/core/lib/gprpp/ref_counted.h
|
563
564
|
- src/core/lib/gprpp/ref_counted_ptr.h
|
565
|
+
- src/core/lib/gprpp/string_view.h
|
564
566
|
- src/core/lib/gprpp/sync.h
|
565
567
|
- src/core/lib/gprpp/thd.h
|
566
568
|
- src/core/lib/gprpp/thd_posix.cc
|
@@ -609,6 +611,10 @@ files:
|
|
609
611
|
- src/core/lib/iomgr/exec_ctx.h
|
610
612
|
- src/core/lib/iomgr/executor.cc
|
611
613
|
- src/core/lib/iomgr/executor.h
|
614
|
+
- src/core/lib/iomgr/executor/mpmcqueue.cc
|
615
|
+
- src/core/lib/iomgr/executor/mpmcqueue.h
|
616
|
+
- src/core/lib/iomgr/executor/threadpool.cc
|
617
|
+
- src/core/lib/iomgr/executor/threadpool.h
|
612
618
|
- src/core/lib/iomgr/fork_posix.cc
|
613
619
|
- src/core/lib/iomgr/fork_windows.cc
|
614
620
|
- src/core/lib/iomgr/gethostname.h
|
@@ -1625,39 +1631,39 @@ signing_key:
|
|
1625
1631
|
specification_version: 4
|
1626
1632
|
summary: GRPC system in Ruby
|
1627
1633
|
test_files:
|
1628
|
-
- src/ruby/spec/error_sanity_spec.rb
|
1629
|
-
- src/ruby/spec/channel_spec.rb
|
1630
|
-
- src/ruby/spec/server_spec.rb
|
1631
|
-
- src/ruby/spec/client_server_spec.rb
|
1632
|
-
- src/ruby/spec/pb/health/checker_spec.rb
|
1633
|
-
- src/ruby/spec/pb/codegen/package_option_spec.rb
|
1634
|
-
- src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
|
1635
|
-
- src/ruby/spec/pb/duplicate/codegen_spec.rb
|
1636
|
-
- src/ruby/spec/call_credentials_spec.rb
|
1637
|
-
- src/ruby/spec/support/helpers.rb
|
1638
|
-
- src/ruby/spec/support/services.rb
|
1639
|
-
- src/ruby/spec/errors_spec.rb
|
1640
|
-
- src/ruby/spec/google_rpc_status_utils_spec.rb
|
1641
1634
|
- src/ruby/spec/server_credentials_spec.rb
|
1642
|
-
- src/ruby/spec/compression_options_spec.rb
|
1643
|
-
- src/ruby/spec/client_auth_spec.rb
|
1644
|
-
- src/ruby/spec/call_spec.rb
|
1645
|
-
- src/ruby/spec/testdata/README
|
1646
|
-
- src/ruby/spec/testdata/client.pem
|
1647
|
-
- src/ruby/spec/testdata/server1.key
|
1648
|
-
- src/ruby/spec/testdata/ca.pem
|
1649
|
-
- src/ruby/spec/testdata/client.key
|
1650
|
-
- src/ruby/spec/testdata/server1.pem
|
1651
1635
|
- src/ruby/spec/channel_connection_spec.rb
|
1652
|
-
- src/ruby/spec/spec_helper.rb
|
1653
|
-
- src/ruby/spec/time_consts_spec.rb
|
1654
1636
|
- src/ruby/spec/channel_credentials_spec.rb
|
1655
|
-
- src/ruby/spec/
|
1656
|
-
- src/ruby/spec/
|
1637
|
+
- src/ruby/spec/google_rpc_status_utils_spec.rb
|
1638
|
+
- src/ruby/spec/testdata/client.key
|
1639
|
+
- src/ruby/spec/testdata/server1.pem
|
1640
|
+
- src/ruby/spec/testdata/ca.pem
|
1641
|
+
- src/ruby/spec/testdata/server1.key
|
1642
|
+
- src/ruby/spec/testdata/README
|
1643
|
+
- src/ruby/spec/testdata/client.pem
|
1644
|
+
- src/ruby/spec/client_auth_spec.rb
|
1645
|
+
- src/ruby/spec/call_credentials_spec.rb
|
1646
|
+
- src/ruby/spec/compression_options_spec.rb
|
1647
|
+
- src/ruby/spec/server_spec.rb
|
1648
|
+
- src/ruby/spec/call_spec.rb
|
1649
|
+
- src/ruby/spec/errors_spec.rb
|
1657
1650
|
- src/ruby/spec/generic/server_interceptors_spec.rb
|
1658
|
-
- src/ruby/spec/generic/rpc_server_spec.rb
|
1659
|
-
- src/ruby/spec/generic/service_spec.rb
|
1660
|
-
- src/ruby/spec/generic/client_stub_spec.rb
|
1661
1651
|
- src/ruby/spec/generic/interceptor_registry_spec.rb
|
1662
1652
|
- src/ruby/spec/generic/rpc_desc_spec.rb
|
1653
|
+
- src/ruby/spec/generic/rpc_server_spec.rb
|
1654
|
+
- src/ruby/spec/generic/client_interceptors_spec.rb
|
1663
1655
|
- src/ruby/spec/generic/active_call_spec.rb
|
1656
|
+
- src/ruby/spec/generic/service_spec.rb
|
1657
|
+
- src/ruby/spec/generic/client_stub_spec.rb
|
1658
|
+
- src/ruby/spec/generic/rpc_server_pool_spec.rb
|
1659
|
+
- src/ruby/spec/channel_spec.rb
|
1660
|
+
- src/ruby/spec/error_sanity_spec.rb
|
1661
|
+
- src/ruby/spec/spec_helper.rb
|
1662
|
+
- src/ruby/spec/client_server_spec.rb
|
1663
|
+
- src/ruby/spec/pb/health/checker_spec.rb
|
1664
|
+
- src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
|
1665
|
+
- src/ruby/spec/pb/codegen/package_option_spec.rb
|
1666
|
+
- src/ruby/spec/pb/duplicate/codegen_spec.rb
|
1667
|
+
- src/ruby/spec/time_consts_spec.rb
|
1668
|
+
- src/ruby/spec/support/helpers.rb
|
1669
|
+
- src/ruby/spec/support/services.rb
|
@@ -1,98 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2015 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#include <grpc/support/port_platform.h>
|
20
|
-
|
21
|
-
#include "src/core/lib/gpr/host_port.h"
|
22
|
-
|
23
|
-
#include <string.h>
|
24
|
-
|
25
|
-
#include <grpc/support/alloc.h>
|
26
|
-
#include <grpc/support/log.h>
|
27
|
-
#include <grpc/support/string_util.h>
|
28
|
-
|
29
|
-
#include "src/core/lib/gpr/string.h"
|
30
|
-
|
31
|
-
int gpr_join_host_port(char** out, const char* host, int port) {
|
32
|
-
if (host[0] != '[' && strchr(host, ':') != nullptr) {
|
33
|
-
/* IPv6 literals must be enclosed in brackets. */
|
34
|
-
return gpr_asprintf(out, "[%s]:%d", host, port);
|
35
|
-
} else {
|
36
|
-
/* Ordinary non-bracketed host:port. */
|
37
|
-
return gpr_asprintf(out, "%s:%d", host, port);
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
int gpr_split_host_port(const char* name, char** host, char** port) {
|
42
|
-
const char* host_start;
|
43
|
-
size_t host_len;
|
44
|
-
const char* port_start;
|
45
|
-
|
46
|
-
*host = nullptr;
|
47
|
-
*port = nullptr;
|
48
|
-
|
49
|
-
if (name[0] == '[') {
|
50
|
-
/* Parse a bracketed host, typically an IPv6 literal. */
|
51
|
-
const char* rbracket = strchr(name, ']');
|
52
|
-
if (rbracket == nullptr) {
|
53
|
-
/* Unmatched [ */
|
54
|
-
return 0;
|
55
|
-
}
|
56
|
-
if (rbracket[1] == '\0') {
|
57
|
-
/* ]<end> */
|
58
|
-
port_start = nullptr;
|
59
|
-
} else if (rbracket[1] == ':') {
|
60
|
-
/* ]:<port?> */
|
61
|
-
port_start = rbracket + 2;
|
62
|
-
} else {
|
63
|
-
/* ]<invalid> */
|
64
|
-
return 0;
|
65
|
-
}
|
66
|
-
host_start = name + 1;
|
67
|
-
host_len = static_cast<size_t>(rbracket - host_start);
|
68
|
-
if (memchr(host_start, ':', host_len) == nullptr) {
|
69
|
-
/* Require all bracketed hosts to contain a colon, because a hostname or
|
70
|
-
IPv4 address should never use brackets. */
|
71
|
-
return 0;
|
72
|
-
}
|
73
|
-
} else {
|
74
|
-
const char* colon = strchr(name, ':');
|
75
|
-
if (colon != nullptr && strchr(colon + 1, ':') == nullptr) {
|
76
|
-
/* Exactly 1 colon. Split into host:port. */
|
77
|
-
host_start = name;
|
78
|
-
host_len = static_cast<size_t>(colon - name);
|
79
|
-
port_start = colon + 1;
|
80
|
-
} else {
|
81
|
-
/* 0 or 2+ colons. Bare hostname or IPv6 litearal. */
|
82
|
-
host_start = name;
|
83
|
-
host_len = strlen(name);
|
84
|
-
port_start = nullptr;
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
/* Allocate return values. */
|
89
|
-
*host = static_cast<char*>(gpr_malloc(host_len + 1));
|
90
|
-
memcpy(*host, host_start, host_len);
|
91
|
-
(*host)[host_len] = '\0';
|
92
|
-
|
93
|
-
if (port_start != nullptr) {
|
94
|
-
*port = gpr_strdup(port_start);
|
95
|
-
}
|
96
|
-
|
97
|
-
return 1;
|
98
|
-
}
|