grpc 1.83.1-x86_64-linux-gnu → 1.84.0.pre1-x86_64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/src/ruby/ext/grpc/rb_call.c +26 -15
- data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
- 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/3.2/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.3/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.4/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/4.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/test/client.rb +5 -4
- data/src/ruby/spec/call_spec.rb +14 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a1e1b5d8e74f8b9675b91ed9672854f23e9e2bb4b43826f03e73e9214bc92f36
|
|
4
|
+
data.tar.gz: 163c727170861482d980500e744425b95feeb2f58e4ed2d12f8c3f18d802c607
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 19fee8ef4fa22670546e61e905fd05d38643b4c8a24270c0ec1a6bca63f9fac8ec7a2038bb285c3a12373177b346a9fcd213a301be7993b02b00d0de216524b7
|
|
7
|
+
data.tar.gz: bb5c2a304f0bb19a701d157ba4b43222a2cbdd4f853bc2c4e4bff8fe880aa04233f0861a02626f1a4fa0f69b6eb27c81d0acc6402b08a36056dbd9ed607a4d1b
|
data/src/ruby/ext/grpc/rb_call.c
CHANGED
|
@@ -401,7 +401,6 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
|
|
|
401
401
|
long i;
|
|
402
402
|
grpc_slice key_slice;
|
|
403
403
|
grpc_slice value_slice;
|
|
404
|
-
char* tmp_str = NULL;
|
|
405
404
|
|
|
406
405
|
if (TYPE(key) == T_SYMBOL) {
|
|
407
406
|
key_slice = grpc_slice_from_static_string(rb_id2name(SYM2ID(key)));
|
|
@@ -415,9 +414,11 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
|
|
|
415
414
|
}
|
|
416
415
|
|
|
417
416
|
if (!grpc_header_key_is_legal(key_slice)) {
|
|
418
|
-
|
|
417
|
+
grpc_slice_unref(key_slice);
|
|
419
418
|
rb_raise(rb_eArgError,
|
|
420
|
-
"'%
|
|
419
|
+
"'%" PRIsVALUE
|
|
420
|
+
"' is an invalid header key, must match [a-z0-9-_.]+",
|
|
421
|
+
key);
|
|
421
422
|
return ST_STOP;
|
|
422
423
|
}
|
|
423
424
|
|
|
@@ -429,18 +430,25 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
|
|
|
429
430
|
array_length = RARRAY_LEN(val);
|
|
430
431
|
/* If the value is an array, add capacity for each value in the array */
|
|
431
432
|
for (i = 0; i < array_length; i++) {
|
|
432
|
-
|
|
433
|
-
|
|
433
|
+
VALUE val_entry = rb_ary_entry(val, i);
|
|
434
|
+
if (TYPE(val_entry) != T_STRING) {
|
|
435
|
+
grpc_slice_unref(key_slice);
|
|
436
|
+
rb_raise(rb_eTypeError, "Header values in array must be strings");
|
|
437
|
+
return ST_STOP;
|
|
438
|
+
}
|
|
439
|
+
value_slice = grpc_slice_from_copied_buffer(RSTRING_PTR(val_entry),
|
|
440
|
+
RSTRING_LEN(val_entry));
|
|
434
441
|
if (!grpc_is_binary_header(key_slice) &&
|
|
435
442
|
!grpc_header_nonbin_value_is_legal(value_slice)) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
rb_raise(rb_eArgError,
|
|
439
|
-
|
|
443
|
+
grpc_slice_unref(value_slice);
|
|
444
|
+
grpc_slice_unref(key_slice);
|
|
445
|
+
rb_raise(rb_eArgError,
|
|
446
|
+
"Header value '%" PRIsVALUE "' has invalid characters",
|
|
447
|
+
val_entry);
|
|
440
448
|
return ST_STOP;
|
|
441
449
|
}
|
|
442
450
|
GRPC_RUBY_ASSERT(md_ary->count < md_ary->capacity);
|
|
443
|
-
md_ary->metadata[md_ary->count].key = key_slice;
|
|
451
|
+
md_ary->metadata[md_ary->count].key = grpc_slice_ref(key_slice);
|
|
444
452
|
md_ary->metadata[md_ary->count].value = value_slice;
|
|
445
453
|
md_ary->count += 1;
|
|
446
454
|
}
|
|
@@ -449,20 +457,23 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
|
|
|
449
457
|
grpc_slice_from_copied_buffer(RSTRING_PTR(val), RSTRING_LEN(val));
|
|
450
458
|
if (!grpc_is_binary_header(key_slice) &&
|
|
451
459
|
!grpc_header_nonbin_value_is_legal(value_slice)) {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
rb_raise(rb_eArgError,
|
|
455
|
-
|
|
460
|
+
grpc_slice_unref(value_slice);
|
|
461
|
+
grpc_slice_unref(key_slice);
|
|
462
|
+
rb_raise(rb_eArgError,
|
|
463
|
+
"Header value '%" PRIsVALUE "' has invalid characters", val);
|
|
456
464
|
return ST_STOP;
|
|
457
465
|
}
|
|
458
466
|
GRPC_RUBY_ASSERT(md_ary->count < md_ary->capacity);
|
|
459
|
-
md_ary->metadata[md_ary->count].key = key_slice;
|
|
467
|
+
md_ary->metadata[md_ary->count].key = grpc_slice_ref(key_slice);
|
|
460
468
|
md_ary->metadata[md_ary->count].value = value_slice;
|
|
461
469
|
md_ary->count += 1;
|
|
462
470
|
} else {
|
|
471
|
+
grpc_slice_unref(key_slice);
|
|
463
472
|
rb_raise(rb_eArgError, "Header values must be of type string or array");
|
|
464
473
|
return ST_STOP;
|
|
465
474
|
}
|
|
475
|
+
/* Release the local reference; each entry now owns its own ref. */
|
|
476
|
+
grpc_slice_unref(key_slice);
|
|
466
477
|
return ST_CONTINUE;
|
|
467
478
|
}
|
|
468
479
|
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
#include "rb_completion_queue.h"
|
|
22
22
|
|
|
23
23
|
#include <grpc/grpc.h>
|
|
24
|
+
#include <grpc/support/atm.h>
|
|
24
25
|
#include <grpc/support/log.h>
|
|
25
26
|
#include <grpc/support/time.h>
|
|
26
27
|
#include <ruby/thread.h>
|
|
@@ -35,7 +36,7 @@ typedef struct next_call_stack {
|
|
|
35
36
|
grpc_event event;
|
|
36
37
|
gpr_timespec timeout;
|
|
37
38
|
void* tag;
|
|
38
|
-
|
|
39
|
+
gpr_atm interrupted;
|
|
39
40
|
} next_call_stack;
|
|
40
41
|
|
|
41
42
|
/* Calls grpc_completion_queue_pluck without holding the ruby GIL */
|
|
@@ -49,7 +50,7 @@ static void* grpc_rb_completion_queue_pluck_no_gil(void* param) {
|
|
|
49
50
|
next_call->cq, next_call->tag, deadline, NULL);
|
|
50
51
|
if (next_call->event.type != GRPC_QUEUE_TIMEOUT) break;
|
|
51
52
|
if (gpr_time_cmp(deadline, next_call->timeout) > 0) break;
|
|
52
|
-
if (next_call->interrupted) break;
|
|
53
|
+
if (gpr_atm_acq_load(&next_call->interrupted)) break;
|
|
53
54
|
}
|
|
54
55
|
return NULL;
|
|
55
56
|
}
|
|
@@ -66,7 +67,7 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue* cq) {
|
|
|
66
67
|
|
|
67
68
|
static void unblock_func(void* param) {
|
|
68
69
|
next_call_stack* const next_call = (next_call_stack*)param;
|
|
69
|
-
next_call->interrupted
|
|
70
|
+
gpr_atm_rel_store(&next_call->interrupted, 1);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/* Does the same thing as grpc_completion_queue_pluck, while properly releasing
|
|
@@ -85,12 +86,12 @@ grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
|
|
|
85
86
|
* this is necessary. */
|
|
86
87
|
grpc_absl_log_str(GPR_DEBUG, "CQ pluck loop begin: ", reason);
|
|
87
88
|
do {
|
|
88
|
-
next_call.interrupted
|
|
89
|
+
gpr_atm_rel_store(&next_call.interrupted, 0);
|
|
89
90
|
rb_thread_call_without_gvl(grpc_rb_completion_queue_pluck_no_gil,
|
|
90
91
|
(void*)&next_call, unblock_func,
|
|
91
92
|
(void*)&next_call);
|
|
92
93
|
if (next_call.event.type != GRPC_QUEUE_TIMEOUT) break;
|
|
93
|
-
} while (next_call.interrupted);
|
|
94
|
+
} while (gpr_atm_acq_load(&next_call.interrupted));
|
|
94
95
|
grpc_absl_log_str(GPR_DEBUG, "CQ pluck loop done: ", reason);
|
|
95
96
|
return next_call.event;
|
|
96
97
|
}
|
|
@@ -44,6 +44,7 @@ grpc_compression_options_disable_algorithm_type grpc_compression_options_disable
|
|
|
44
44
|
grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import;
|
|
45
45
|
grpc_service_account_jwt_access_credentials_create_type grpc_service_account_jwt_access_credentials_create_import;
|
|
46
46
|
grpc_external_account_credentials_create_type grpc_external_account_credentials_create_import;
|
|
47
|
+
grpc_gdch_service_account_credentials_create_type grpc_gdch_service_account_credentials_create_import;
|
|
47
48
|
grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
|
|
48
49
|
grpc_access_token_credentials_create_type grpc_access_token_credentials_create_import;
|
|
49
50
|
grpc_google_iam_credentials_create_type grpc_google_iam_credentials_create_import;
|
|
@@ -333,6 +334,7 @@ void grpc_rb_load_imports(HMODULE library) {
|
|
|
333
334
|
grpc_compression_options_is_algorithm_enabled_import = (grpc_compression_options_is_algorithm_enabled_type) GetProcAddress(library, "grpc_compression_options_is_algorithm_enabled");
|
|
334
335
|
grpc_service_account_jwt_access_credentials_create_import = (grpc_service_account_jwt_access_credentials_create_type) GetProcAddress(library, "grpc_service_account_jwt_access_credentials_create");
|
|
335
336
|
grpc_external_account_credentials_create_import = (grpc_external_account_credentials_create_type) GetProcAddress(library, "grpc_external_account_credentials_create");
|
|
337
|
+
grpc_gdch_service_account_credentials_create_import = (grpc_gdch_service_account_credentials_create_type) GetProcAddress(library, "grpc_gdch_service_account_credentials_create");
|
|
336
338
|
grpc_google_refresh_token_credentials_create_import = (grpc_google_refresh_token_credentials_create_type) GetProcAddress(library, "grpc_google_refresh_token_credentials_create");
|
|
337
339
|
grpc_access_token_credentials_create_import = (grpc_access_token_credentials_create_type) GetProcAddress(library, "grpc_access_token_credentials_create");
|
|
338
340
|
grpc_google_iam_credentials_create_import = (grpc_google_iam_credentials_create_type) GetProcAddress(library, "grpc_google_iam_credentials_create");
|
|
@@ -108,6 +108,9 @@ extern grpc_service_account_jwt_access_credentials_create_type grpc_service_acco
|
|
|
108
108
|
typedef grpc_call_credentials*(*grpc_external_account_credentials_create_type)(const char* json_string, const char* scopes_string);
|
|
109
109
|
extern grpc_external_account_credentials_create_type grpc_external_account_credentials_create_import;
|
|
110
110
|
#define grpc_external_account_credentials_create grpc_external_account_credentials_create_import
|
|
111
|
+
typedef grpc_call_credentials*(*grpc_gdch_service_account_credentials_create_type)(const char* json_string, const char* audience_string);
|
|
112
|
+
extern grpc_gdch_service_account_credentials_create_type grpc_gdch_service_account_credentials_create_import;
|
|
113
|
+
#define grpc_gdch_service_account_credentials_create grpc_gdch_service_account_credentials_create_import
|
|
111
114
|
typedef grpc_call_credentials*(*grpc_google_refresh_token_credentials_create_type)(const char* json_refresh_token, void* reserved);
|
|
112
115
|
extern grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
|
|
113
116
|
#define grpc_google_refresh_token_credentials_create grpc_google_refresh_token_credentials_create_import
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/src/ruby/pb/test/client.rb
CHANGED
|
@@ -31,6 +31,7 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
31
31
|
$LOAD_PATH.unshift(pb_dir) unless $LOAD_PATH.include?(pb_dir)
|
|
32
32
|
|
|
33
33
|
require 'optparse'
|
|
34
|
+
require 'json'
|
|
34
35
|
require 'logger'
|
|
35
36
|
|
|
36
37
|
require_relative '../../lib/grpc'
|
|
@@ -319,7 +320,7 @@ class NamedTests
|
|
|
319
320
|
return
|
|
320
321
|
end
|
|
321
322
|
json_key = File.read(ENV[AUTH_ENV])
|
|
322
|
-
wanted_email =
|
|
323
|
+
wanted_email = JSON.parse(json_key)['client_email']
|
|
323
324
|
resp = perform_large_unary(fill_username: true,
|
|
324
325
|
fill_oauth_scope: true)
|
|
325
326
|
assert("#{__callee__}: bad username") { wanted_email == resp.username }
|
|
@@ -330,7 +331,7 @@ class NamedTests
|
|
|
330
331
|
|
|
331
332
|
def jwt_token_creds
|
|
332
333
|
json_key = File.read(ENV[AUTH_ENV])
|
|
333
|
-
wanted_email =
|
|
334
|
+
wanted_email = JSON.parse(json_key)['client_email']
|
|
334
335
|
resp = perform_large_unary(fill_username: true)
|
|
335
336
|
assert("#{__callee__}: bad username") { wanted_email == resp.username }
|
|
336
337
|
end
|
|
@@ -347,7 +348,7 @@ class NamedTests
|
|
|
347
348
|
resp = perform_large_unary(fill_username: true,
|
|
348
349
|
fill_oauth_scope: true)
|
|
349
350
|
json_key = File.read(ENV[AUTH_ENV])
|
|
350
|
-
wanted_email =
|
|
351
|
+
wanted_email = JSON.parse(json_key)['client_email']
|
|
351
352
|
assert("#{__callee__}: bad username") { wanted_email == resp.username }
|
|
352
353
|
assert("#{__callee__}: bad oauth scope") do
|
|
353
354
|
@args.oauth_scope.include?(resp.oauth_scope)
|
|
@@ -366,7 +367,7 @@ class NamedTests
|
|
|
366
367
|
fill_oauth_scope: true,
|
|
367
368
|
credentials: call_creds)
|
|
368
369
|
json_key = File.read(ENV[AUTH_ENV])
|
|
369
|
-
wanted_email =
|
|
370
|
+
wanted_email = JSON.parse(json_key)['client_email']
|
|
370
371
|
assert("#{__callee__}: bad username") { wanted_email == resp.username }
|
|
371
372
|
assert("#{__callee__}: bad oauth scope") do
|
|
372
373
|
@args.oauth_scope.include?(resp.oauth_scope)
|
data/src/ruby/spec/call_spec.rb
CHANGED
|
@@ -181,6 +181,20 @@ describe GRPC::Core::Call do
|
|
|
181
181
|
end
|
|
182
182
|
end
|
|
183
183
|
|
|
184
|
+
describe '#run_batch with array-valued metadata' do
|
|
185
|
+
it 'does not crash with long key and array value' do
|
|
186
|
+
make_test_call do |call|
|
|
187
|
+
long_key = 'x-grpc-test-echo-initial' # 24 bytes (> 23)
|
|
188
|
+
metadata = { long_key => %w[value-a value-b value-c] }
|
|
189
|
+
ops = {
|
|
190
|
+
GRPC::Core::CallOps::SEND_INITIAL_METADATA => metadata,
|
|
191
|
+
GRPC::Core::CallOps::SEND_CLOSE_FROM_CLIENT => nil
|
|
192
|
+
}
|
|
193
|
+
expect { call.run_batch(ops) }.to raise_error(GRPC::Core::CallError)
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
184
198
|
def make_test_call
|
|
185
199
|
call = @ch.create_call(nil, nil, 'phony_method', nil, deadline)
|
|
186
200
|
yield call
|
|
@@ -205,12 +205,9 @@ describe 'Server Interceptors' do
|
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
it 'should be invoked in FIFO order', server: true do
|
|
208
|
-
expect(interceptor).to receive(:request_response).ordered
|
|
209
|
-
|
|
210
|
-
expect(
|
|
211
|
-
.once.and_call_original
|
|
212
|
-
expect(interceptor3).to receive(:request_response).ordered
|
|
213
|
-
.once.and_call_original
|
|
208
|
+
expect(interceptor).to receive(:request_response).ordered.once.and_call_original
|
|
209
|
+
expect(interceptor2).to receive(:request_response).ordered.once.and_call_original
|
|
210
|
+
expect(interceptor3).to receive(:request_response).ordered.once.and_call_original
|
|
214
211
|
|
|
215
212
|
run_services_on_server(@server, services: [service]) do
|
|
216
213
|
stub = build_insecure_stub(EchoStub)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grpc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.84.0.pre1
|
|
5
5
|
platform: x86_64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- gRPC Authors
|
|
@@ -147,14 +147,14 @@ dependencies:
|
|
|
147
147
|
requirements:
|
|
148
148
|
- - "~>"
|
|
149
149
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: 1.
|
|
150
|
+
version: 1.12.0
|
|
151
151
|
type: :development
|
|
152
152
|
prerelease: false
|
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
154
154
|
requirements:
|
|
155
155
|
- - "~>"
|
|
156
156
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: 1.
|
|
157
|
+
version: 1.12.0
|
|
158
158
|
- !ruby/object:Gem::Dependency
|
|
159
159
|
name: rspec
|
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -375,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
375
375
|
- !ruby/object:Gem::Version
|
|
376
376
|
version: 3.3.22
|
|
377
377
|
requirements: []
|
|
378
|
-
rubygems_version: 4.0.
|
|
378
|
+
rubygems_version: 4.0.20
|
|
379
379
|
specification_version: 4
|
|
380
380
|
summary: GRPC system in Ruby
|
|
381
381
|
test_files:
|