ds9 1.3.3 → 1.4.0
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/ext/ds9/ds9.c +11 -8
- data/ext/ds9/ds9.h +1 -0
- data/ext/ds9/ds9_option.c +153 -0
- data/ext/ds9/ds9_option.h +19 -0
- data/lib/ds9.rb +3 -2
- data/lib/ds9/version.rb +1 -1
- data/test/test_ds9_option.rb +87 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee1e610bf18252586cdc9870329bec845a845666
|
4
|
+
data.tar.gz: 5554cbbb9f42c3a017a482509b083d2ef23d3cec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c412989f68af4025bb659c040f7953d5fab107aa3613616f16afb48e5e4147543ac2e04b86a1930e518d45924abcd6a2079ce63eaf033ab017ee7b8ea98dff7c
|
7
|
+
data.tar.gz: ea9aa79692a1d0a8a879d16a85199561b1e46672629d5d5c66bc59707d287d94a7197768b76d9fad5be4428b0f7a49b8d8e22b428c14fe128099f6c59569c98e
|
data/ext/ds9/ds9.c
CHANGED
@@ -349,10 +349,11 @@ static VALUE allocate_session(VALUE klass)
|
|
349
349
|
return TypedData_Wrap_Struct(klass, &ds9_session_type, 0);
|
350
350
|
}
|
351
351
|
|
352
|
-
static VALUE client_init_internals(VALUE self, VALUE cb)
|
352
|
+
static VALUE client_init_internals(VALUE self, VALUE cb, VALUE opt)
|
353
353
|
{
|
354
354
|
nghttp2_session_callbacks *callbacks;
|
355
355
|
nghttp2_session *session;
|
356
|
+
nghttp2_option *option;
|
356
357
|
nghttp2_mem mem = {
|
357
358
|
NULL,
|
358
359
|
wrap_xmalloc,
|
@@ -362,17 +363,18 @@ static VALUE client_init_internals(VALUE self, VALUE cb)
|
|
362
363
|
};
|
363
364
|
|
364
365
|
TypedData_Get_Struct(cb, nghttp2_session_callbacks, &ds9_callbacks_type, callbacks);
|
365
|
-
|
366
|
-
nghttp2_session_client_new3(&session, callbacks, (void *)self,
|
366
|
+
option = UnwrapDS9Option(opt);
|
367
|
+
nghttp2_session_client_new3(&session, callbacks, (void *)self, option, &mem);
|
367
368
|
DATA_PTR(self) = session;
|
368
369
|
|
369
370
|
return self;
|
370
371
|
}
|
371
372
|
|
372
|
-
static VALUE server_init_internals(VALUE self, VALUE cb)
|
373
|
+
static VALUE server_init_internals(VALUE self, VALUE cb, VALUE opt)
|
373
374
|
{
|
374
375
|
nghttp2_session_callbacks *callbacks;
|
375
376
|
nghttp2_session *session;
|
377
|
+
nghttp2_option *option;
|
376
378
|
nghttp2_mem mem = {
|
377
379
|
NULL,
|
378
380
|
wrap_xmalloc,
|
@@ -382,8 +384,8 @@ static VALUE server_init_internals(VALUE self, VALUE cb)
|
|
382
384
|
};
|
383
385
|
|
384
386
|
TypedData_Get_Struct(cb, nghttp2_session_callbacks, &ds9_callbacks_type, callbacks);
|
385
|
-
|
386
|
-
nghttp2_session_server_new3(&session, callbacks, (void *)self,
|
387
|
+
option = UnwrapDS9Option(opt);
|
388
|
+
nghttp2_session_server_new3(&session, callbacks, (void *)self, option, &mem);
|
387
389
|
DATA_PTR(self) = session;
|
388
390
|
|
389
391
|
return self;
|
@@ -1010,6 +1012,7 @@ void Init_ds9(void)
|
|
1010
1012
|
mDS9 = rb_define_module("DS9");
|
1011
1013
|
|
1012
1014
|
Init_ds9_frames(mDS9);
|
1015
|
+
Init_ds9_option(mDS9);
|
1013
1016
|
|
1014
1017
|
rb_define_const(mDS9, "PROTO_VERSION_ID", rb_str_new(NGHTTP2_PROTO_VERSION_ID, NGHTTP2_PROTO_VERSION_ID_LEN));
|
1015
1018
|
|
@@ -1066,8 +1069,8 @@ void Init_ds9(void)
|
|
1066
1069
|
|
1067
1070
|
rb_define_private_method(cDS9Session, "submit_request", session_submit_request, 2);
|
1068
1071
|
rb_define_private_method(cDS9Session, "make_callbacks", make_callbacks, 0);
|
1069
|
-
rb_define_private_method(cDS9Client, "init_internals", client_init_internals,
|
1070
|
-
rb_define_private_method(cDS9Server, "init_internals", server_init_internals,
|
1072
|
+
rb_define_private_method(cDS9Client, "init_internals", client_init_internals, 2);
|
1073
|
+
rb_define_private_method(cDS9Server, "init_internals", server_init_internals, 2);
|
1071
1074
|
|
1072
1075
|
rb_define_method(cDS9Server, "submit_response", server_submit_response, 2);
|
1073
1076
|
rb_define_method(cDS9Server, "submit_push_promise", server_submit_push_promise, 2);
|
data/ext/ds9/ds9.h
CHANGED
@@ -0,0 +1,153 @@
|
|
1
|
+
#include <ds9_option.h>
|
2
|
+
|
3
|
+
VALUE cDS9Option;
|
4
|
+
|
5
|
+
static VALUE allocate_option(VALUE klass)
|
6
|
+
{
|
7
|
+
nghttp2_option *option;
|
8
|
+
|
9
|
+
nghttp2_option_new(&option);
|
10
|
+
|
11
|
+
return TypedData_Wrap_Struct(klass, &ds9_option_type, option);
|
12
|
+
}
|
13
|
+
|
14
|
+
static VALUE option_set_no_auto_ping_ack(VALUE self)
|
15
|
+
{
|
16
|
+
nghttp2_option *option;
|
17
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
18
|
+
|
19
|
+
nghttp2_option_set_no_auto_ping_ack(option, 1);
|
20
|
+
|
21
|
+
return self;
|
22
|
+
}
|
23
|
+
|
24
|
+
static VALUE option_set_no_auto_window_update(VALUE self)
|
25
|
+
{
|
26
|
+
nghttp2_option *option;
|
27
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
28
|
+
|
29
|
+
nghttp2_option_set_no_auto_window_update(option, 1);
|
30
|
+
|
31
|
+
return self;
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE option_set_no_closed_streams(VALUE self)
|
35
|
+
{
|
36
|
+
nghttp2_option *option;
|
37
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
38
|
+
|
39
|
+
nghttp2_option_set_no_closed_streams(option, 1);
|
40
|
+
|
41
|
+
return self;
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE option_set_no_http_messaging(VALUE self)
|
45
|
+
{
|
46
|
+
nghttp2_option *option;
|
47
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
48
|
+
|
49
|
+
nghttp2_option_set_no_http_messaging(option, 1);
|
50
|
+
|
51
|
+
return self;
|
52
|
+
}
|
53
|
+
|
54
|
+
static VALUE option_set_no_recv_client_magic(VALUE self)
|
55
|
+
{
|
56
|
+
nghttp2_option *option;
|
57
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
58
|
+
|
59
|
+
nghttp2_option_set_no_recv_client_magic(option, 1);
|
60
|
+
|
61
|
+
return self;
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
static VALUE option_set_builtin_recv_extension_type(VALUE self, VALUE size)
|
66
|
+
{
|
67
|
+
nghttp2_option *option;
|
68
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
69
|
+
|
70
|
+
nghttp2_option_set_builtin_recv_extension_type(option, NUM2INT(size));
|
71
|
+
|
72
|
+
return self;
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE option_set_max_deflate_dynamic_table_size(VALUE self, VALUE size)
|
76
|
+
{
|
77
|
+
nghttp2_option *option;
|
78
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
79
|
+
|
80
|
+
nghttp2_option_set_max_deflate_dynamic_table_size(option, NUM2INT(size));
|
81
|
+
|
82
|
+
return self;
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE option_set_max_send_header_block_length(VALUE self, VALUE size)
|
86
|
+
{
|
87
|
+
nghttp2_option *option;
|
88
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
89
|
+
|
90
|
+
nghttp2_option_set_max_send_header_block_length(option, NUM2INT(size));
|
91
|
+
|
92
|
+
return self;
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE option_set_max_reserved_remote_streams(VALUE self, VALUE size)
|
96
|
+
{
|
97
|
+
nghttp2_option *option;
|
98
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
99
|
+
|
100
|
+
nghttp2_option_set_max_reserved_remote_streams(option, NUM2INT(size));
|
101
|
+
|
102
|
+
return self;
|
103
|
+
}
|
104
|
+
|
105
|
+
static VALUE option_set_peer_max_concurrent_streams(VALUE self, VALUE size)
|
106
|
+
{
|
107
|
+
nghttp2_option *option;
|
108
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
109
|
+
|
110
|
+
nghttp2_option_set_peer_max_concurrent_streams(option, NUM2INT(size));
|
111
|
+
|
112
|
+
return self;
|
113
|
+
}
|
114
|
+
|
115
|
+
static VALUE option_set_user_recv_extension_type(VALUE self, VALUE size)
|
116
|
+
{
|
117
|
+
nghttp2_option *option;
|
118
|
+
TypedData_Get_Struct(self, nghttp2_option, &ds9_option_type, option);
|
119
|
+
|
120
|
+
nghttp2_option_set_user_recv_extension_type(option, NUM2INT(size));
|
121
|
+
|
122
|
+
return self;
|
123
|
+
}
|
124
|
+
|
125
|
+
nghttp2_option* UnwrapDS9Option(VALUE opt)
|
126
|
+
{
|
127
|
+
nghttp2_option* option = NULL;
|
128
|
+
|
129
|
+
if (!NIL_P(opt)) {
|
130
|
+
TypedData_Get_Struct(opt, nghttp2_option, &ds9_option_type, option);
|
131
|
+
}
|
132
|
+
|
133
|
+
return option;
|
134
|
+
}
|
135
|
+
|
136
|
+
void Init_ds9_option(VALUE mDS9)
|
137
|
+
{
|
138
|
+
cDS9Option = rb_define_class_under(mDS9, "Option", rb_cData);
|
139
|
+
rb_define_alloc_func(cDS9Option, allocate_option);
|
140
|
+
|
141
|
+
rb_define_method(cDS9Option, "set_no_auto_ping_ack", option_set_no_auto_ping_ack, 0);
|
142
|
+
rb_define_method(cDS9Option, "set_no_auto_window_update", option_set_no_auto_window_update, 0);
|
143
|
+
rb_define_method(cDS9Option, "set_no_closed_streams", option_set_no_closed_streams, 0);
|
144
|
+
rb_define_method(cDS9Option, "set_no_http_messaging", option_set_no_http_messaging, 0);
|
145
|
+
rb_define_method(cDS9Option, "set_no_recv_client_magic", option_set_no_recv_client_magic, 0);
|
146
|
+
|
147
|
+
rb_define_method(cDS9Option, "set_builtin_recv_extension_type", option_set_builtin_recv_extension_type, 1);
|
148
|
+
rb_define_method(cDS9Option, "set_max_deflate_dynamic_table_size", option_set_max_deflate_dynamic_table_size, 1);
|
149
|
+
rb_define_method(cDS9Option, "set_max_send_header_block_length", option_set_max_send_header_block_length, 1);
|
150
|
+
rb_define_method(cDS9Option, "set_max_reserved_remote_streams", option_set_max_reserved_remote_streams, 1);
|
151
|
+
rb_define_method(cDS9Option, "set_peer_max_concurrent_streams", option_set_peer_max_concurrent_streams, 1);
|
152
|
+
rb_define_method(cDS9Option, "set_user_recv_extension_type", option_set_user_recv_extension_type, 1);
|
153
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#ifndef DS9_OPTION_H
|
2
|
+
#define DS9_OPTION_H
|
3
|
+
|
4
|
+
#include <ruby.h>
|
5
|
+
#include <nghttp2/nghttp2.h>
|
6
|
+
|
7
|
+
static const rb_data_type_t ds9_option_type = {
|
8
|
+
"DS9/option",
|
9
|
+
{0, (void (*)(void *))nghttp2_option_del, 0,},
|
10
|
+
0, 0,
|
11
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
12
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
13
|
+
#endif
|
14
|
+
};
|
15
|
+
|
16
|
+
void Init_ds9_option(VALUE mDS9);
|
17
|
+
nghttp2_option* UnwrapDS9Option(VALUE opt);
|
18
|
+
|
19
|
+
#endif
|
data/lib/ds9.rb
CHANGED
data/lib/ds9/version.rb
CHANGED
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestMeme < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@option = DS9::Option.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_set_no_auto_ping_ack
|
9
|
+
assert @option.set_no_auto_ping_ack
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_set_no_auto_window_update
|
13
|
+
assert @option.set_no_auto_window_update
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_set_no_closed_streams
|
17
|
+
assert @option.set_no_closed_streams
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_set_no_http_messaging
|
21
|
+
assert @option.set_no_http_messaging
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_set_no_recv_client_magic
|
25
|
+
assert @option.set_no_recv_client_magic
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_set_builtin_recv_extension_type
|
29
|
+
assert @option.set_builtin_recv_extension_type(1)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_set_builtin_recv_extension_type_with_not_num
|
33
|
+
assert_raises TypeError do
|
34
|
+
assert @option.set_builtin_recv_extension_type('invalid')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_set_max_deflate_dynamic_table_size
|
39
|
+
assert @option.set_max_deflate_dynamic_table_size(1)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_set_max_deflate_dynamic_table_size_with_not_num
|
43
|
+
assert_raises TypeError do
|
44
|
+
@option.set_max_deflate_dynamic_table_size('invalid')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_set_max_send_header_block_length
|
49
|
+
assert @option.set_max_send_header_block_length(1)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_set_max_send_header_block_length_with_not_num
|
53
|
+
assert_raises TypeError do
|
54
|
+
assert @option.set_max_send_header_block_length('invalid')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_set_max_reserved_remote_streams
|
59
|
+
assert @option.set_max_reserved_remote_streams(100)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_set_max_reserved_remote_streams_not_num
|
63
|
+
assert_raises TypeError do
|
64
|
+
@option.set_max_reserved_remote_streams('invalid')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_set_peer_max_concurrent_streams
|
69
|
+
assert @option.set_peer_max_concurrent_streams(1)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_set_peer_max_concurrent_stream_with_not_num
|
73
|
+
assert_raises TypeError do
|
74
|
+
assert @option.set_peer_max_concurrent_streams('invalid')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_set_user_recv_extension_type
|
79
|
+
assert @option.set_user_recv_extension_type(1)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_set_user_recv_extension_type_with_not_num
|
83
|
+
assert_raises TypeError do
|
84
|
+
assert @option.set_user_recv_extension_type('invalid')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ds9
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -104,12 +104,15 @@ files:
|
|
104
104
|
- ext/ds9/ds9.c
|
105
105
|
- ext/ds9/ds9.h
|
106
106
|
- ext/ds9/ds9_frames.c
|
107
|
+
- ext/ds9/ds9_option.c
|
108
|
+
- ext/ds9/ds9_option.h
|
107
109
|
- ext/ds9/extconf.rb
|
108
110
|
- lib/ds9.rb
|
109
111
|
- lib/ds9/version.rb
|
110
112
|
- test/helper.rb
|
111
113
|
- test/test_client.rb
|
112
114
|
- test/test_ds9.rb
|
115
|
+
- test/test_ds9_option.rb
|
113
116
|
- test/test_server.rb
|
114
117
|
homepage: https://github.com/tenderlove/ds9
|
115
118
|
licenses:
|
@@ -133,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
136
|
version: '0'
|
134
137
|
requirements: []
|
135
138
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.6.14
|
139
|
+
rubygems_version: 2.6.14.1
|
137
140
|
signing_key:
|
138
141
|
specification_version: 4
|
139
142
|
summary: This library allows you to write HTTP/2 clients and servers
|