iodine 0.7.34 → 0.7.35
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/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Rakefile +5 -6
- data/ext/iodine/iodine.c +12 -0
- data/ext/iodine/iodine_http.c +4 -3
- data/ext/iodine/iodine_mustache.c +12 -2
- data/iodine.gemspec +2 -0
- data/lib/iodine.rb +2 -2
- data/lib/iodine/version.rb +1 -1
- metadata +43 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f07c471ae04fb0a960e636a064b6d37bb6c122397a08cbcd6b8bfd346c0404c3
|
4
|
+
data.tar.gz: c5be46ad5c0c11905e302993ae5658aff5dd2d3e12a5a7aa2158000ae3bbed30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dccb90c6164381e2645514a4f1d5710c8edc94765f102fab56e27e4a5f91a598df7daeb3aa1519aa62e7f88c76fc87793f1a41ec6b7fcdb80ce206297afd9a5
|
7
|
+
data.tar.gz: 773ba1086531e10702ae59c27b7ef52d6ebf9fdc9616b7fe8dfe73b680ed5792705549bbb1aff3c21b32d3ae177aff1de40c8d7d7042afef358d7b9d404433a8
|
data/.travis.yml
CHANGED
@@ -24,7 +24,7 @@ addons:
|
|
24
24
|
script:
|
25
25
|
- echo CFLAGS = $CFLAGS
|
26
26
|
- echo cflags = $cflags
|
27
|
+
- bundle exec rake compile && bundle exec rspec --format documentation
|
27
28
|
- gem uninstall -x iodine
|
28
29
|
- rake build
|
29
30
|
- find pkg/iodine-*.gem -exec gem install -V {} +
|
30
|
-
- bundle exec rspec --format documentation
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ Please notice that this change log contains changes for upcoming releases as wel
|
|
6
6
|
|
7
7
|
## Changes:
|
8
8
|
|
9
|
+
#### Change log v.0.7.35
|
10
|
+
|
11
|
+
**Fix**: fix memory leak in the x-sendfile path where Ruby objects no longer in use would still be protected by iodine.
|
12
|
+
|
13
|
+
**Update**: (`iodine`) add the `Iodine.running?` method. Credit to Ian Ker-Seymer (@ianks) for PR #78.
|
14
|
+
|
9
15
|
#### Change log v.0.7.34
|
10
16
|
|
11
17
|
**Security**: (`facil.io`, `http`) updated to facil.io 0.7.3, incorporating it's bug fixes and security updates.
|
data/Rakefile
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
2
|
require "rake/extensiontask"
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
begin
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
rescue LoadError
|
9
8
|
end
|
10
9
|
|
11
|
-
task :default => [:compile, :
|
10
|
+
task :default => [:compile, :spec]
|
12
11
|
|
13
12
|
Rake::ExtensionTask.new "iodine" do |ext|
|
14
13
|
ext.lib_dir = "lib/iodine"
|
data/ext/iodine/iodine.c
CHANGED
@@ -302,6 +302,17 @@ static VALUE iodine_worker_is(VALUE self) {
|
|
302
302
|
return fio_is_master() ? Qtrue : Qfalse;
|
303
303
|
}
|
304
304
|
|
305
|
+
/**
|
306
|
+
* Returns `true` if Iodine is currently running a server
|
307
|
+
*/
|
308
|
+
static VALUE iodine_running(VALUE self) {
|
309
|
+
if (fio_is_running()) {
|
310
|
+
return Qtrue;
|
311
|
+
} else {
|
312
|
+
return Qfalse;
|
313
|
+
}
|
314
|
+
}
|
315
|
+
|
305
316
|
/* *****************************************************************************
|
306
317
|
CLI parser (Ruby's OptParser is more limiting than I knew...)
|
307
318
|
***************************************************************************** */
|
@@ -1292,6 +1303,7 @@ void Init_iodine(void) {
|
|
1292
1303
|
rb_define_module_function(IodineModule, "on_idle", iodine_sched_on_idle, 0);
|
1293
1304
|
rb_define_module_function(IodineModule, "master?", iodine_master_is, 0);
|
1294
1305
|
rb_define_module_function(IodineModule, "worker?", iodine_worker_is, 0);
|
1306
|
+
rb_define_module_function(IodineModule, "running?", iodine_running, 0);
|
1295
1307
|
rb_define_module_function(IodineModule, "listen", iodine_listen, 1);
|
1296
1308
|
rb_define_module_function(IodineModule, "connect", iodine_connect, 1);
|
1297
1309
|
|
data/ext/iodine/iodine_http.c
CHANGED
@@ -268,7 +268,7 @@ static int iodine_copy2env_task(FIOBJ o, void *env_) {
|
|
268
268
|
hname = HTTP_CONNECTION;
|
269
269
|
} else if (tmp.len == 4 && !memcmp("host", tmp.data, 4)) {
|
270
270
|
hname = HTTP_HOST;
|
271
|
-
} else if (tmp.len >
|
271
|
+
} else if (tmp.len > 123) {
|
272
272
|
char *buf = fio_malloc(tmp.len + 5);
|
273
273
|
memcpy(buf, "HTTP_", 5);
|
274
274
|
for (size_t i = 0; i < tmp.len; ++i) {
|
@@ -277,7 +277,7 @@ static int iodine_copy2env_task(FIOBJ o, void *env_) {
|
|
277
277
|
hname = rb_enc_str_new(buf, tmp.len + 5, IodineBinaryEncoding);
|
278
278
|
fio_free(buf);
|
279
279
|
} else {
|
280
|
-
char buf[
|
280
|
+
char buf[128];
|
281
281
|
memcpy(buf, "HTTP_", 5);
|
282
282
|
for (size_t i = 0; i < tmp.len; ++i) {
|
283
283
|
buf[i + 5] = (tmp.data[i] == '-') ? '_' : to_upper(tmp.data[i]);
|
@@ -695,7 +695,7 @@ static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
695
695
|
rb_hash_foreach(response_headers, for_each_header_data, (VALUE)(h));
|
696
696
|
IodineStore.remove(response_headers);
|
697
697
|
// send the file directly and finish
|
698
|
-
|
698
|
+
goto finish;
|
699
699
|
}
|
700
700
|
// review each header and write it to the response.
|
701
701
|
rb_hash_foreach(response_headers, for_each_header_data, (VALUE)(h));
|
@@ -707,6 +707,7 @@ static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
707
707
|
if (ruby2c_response_send(handle, rbresponse, env))
|
708
708
|
goto internal_error;
|
709
709
|
|
710
|
+
finish:
|
710
711
|
IodineStore.remove(rbresponse);
|
711
712
|
IodineStore.remove(env);
|
712
713
|
return NULL;
|
@@ -17,13 +17,20 @@ C <=> Ruby Data allocation
|
|
17
17
|
***************************************************************************** */
|
18
18
|
|
19
19
|
static size_t iodine_mustache_data_size(const void *c_) {
|
20
|
-
return sizeof(mustache_s *)
|
20
|
+
return sizeof(mustache_s *) +
|
21
|
+
(((mustache_s **)c_)[0]
|
22
|
+
? (((mustache_s **)c_)[0]->u.read_only.data_length +
|
23
|
+
(((mustache_s **)c_)[0]->u.read_only.intruction_count *
|
24
|
+
sizeof(struct mustache__instruction_s)))
|
25
|
+
: 0);
|
21
26
|
(void)c_;
|
22
27
|
}
|
23
28
|
|
24
29
|
static void iodine_mustache_data_free(void *c_) {
|
25
30
|
mustache_free(((mustache_s **)c_)[0]);
|
31
|
+
FIO_LOG_DEBUG("deallocated mustache data at: %p", ((void **)c_)[0]);
|
26
32
|
free((void *)c_);
|
33
|
+
FIO_LOG_DEBUG("deallocated mustache pointer at: %p", c_);
|
27
34
|
(void)c_;
|
28
35
|
}
|
29
36
|
|
@@ -43,6 +50,7 @@ static const rb_data_type_t iodine_mustache_data_type = {
|
|
43
50
|
static VALUE iodine_mustache_data_alloc_c(VALUE self) {
|
44
51
|
void *m = malloc(sizeof(mustache_s *));
|
45
52
|
((mustache_s **)m)[0] = NULL;
|
53
|
+
FIO_LOG_DEBUG("allocated mustache pointer at: %p", m);
|
46
54
|
return TypedData_Wrap_Struct(self, &iodine_mustache_data_type, m);
|
47
55
|
}
|
48
56
|
|
@@ -310,9 +318,11 @@ static VALUE iodine_mustache_new(int argc, VALUE *argv, VALUE self) {
|
|
310
318
|
.data = (template == Qnil ? NULL : RSTRING_PTR(template)),
|
311
319
|
.data_len = (template == Qnil ? 0 : RSTRING_LEN(template)),
|
312
320
|
.err = &err);
|
313
|
-
|
314
321
|
if (!*m)
|
315
322
|
goto error;
|
323
|
+
|
324
|
+
FIO_LOG_DEBUG("allocated / loaded mustache data at: %p", (void *)*m);
|
325
|
+
|
316
326
|
return self;
|
317
327
|
error:
|
318
328
|
switch (err) {
|
data/iodine.gemspec
CHANGED
@@ -40,6 +40,8 @@ Gem::Specification.new do |spec|
|
|
40
40
|
# spec.add_development_dependency 'bundler', '>= 1.10', '< 2.0'
|
41
41
|
spec.add_development_dependency 'rake', '~> 12.0', '< 13.0'
|
42
42
|
spec.add_development_dependency 'minitest', '>=5', '< 6.0'
|
43
|
+
spec.add_development_dependency 'rspec', '>=3.9.0', '< 4.0'
|
44
|
+
spec.add_development_dependency 'spec', '>=5.3.0', '< 6.0'
|
43
45
|
spec.add_development_dependency 'rake-compiler', '>= 1', '< 2.0'
|
44
46
|
|
45
47
|
spec.post_install_message = "Thank you for installing Iodine #{Iodine::VERSION}.\n" +
|
data/lib/iodine.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'socket' # TCPSocket is used internally for Hijack support
|
2
2
|
# require 'openssl' # For SSL/TLS support using OpenSSL
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require_relative './iodine/version'
|
5
|
+
require_relative './iodine/iodine' # loading a binary C extension
|
6
6
|
|
7
7
|
# Iodine is an HTTP / WebSocket server as well as an Evented Network Tool Library. In essense, Iodine is a Ruby port for the [facil.io](http://facil.io) C library.
|
8
8
|
#
|
data/lib/iodine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iodine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -50,6 +50,46 @@ dependencies:
|
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '6.0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rspec
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 3.9.0
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '4.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.9.0
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '4.0'
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: spec
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 5.3.0
|
80
|
+
- - "<"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '6.0'
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 5.3.0
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '6.0'
|
53
93
|
- !ruby/object:Gem::Dependency
|
54
94
|
name: rake-compiler
|
55
95
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,7 +243,7 @@ licenses:
|
|
203
243
|
metadata:
|
204
244
|
allowed_push_host: https://rubygems.org
|
205
245
|
post_install_message: |-
|
206
|
-
Thank you for installing Iodine 0.7.
|
246
|
+
Thank you for installing Iodine 0.7.35.
|
207
247
|
Remember: if iodine supports your business, it's is only fair to give value back (code contributions / donations).
|
208
248
|
rdoc_options: []
|
209
249
|
require_paths:
|