iodine 0.7.34 → 0.7.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37df76fb8d575cf00bba0d36342aa6eabd5fba95a4d2940b61ce9b3026082dc1
4
- data.tar.gz: 0a5f7fe186c7c824d15959cbabaa71edaffc8159780a7054a54bf959f36b465a
3
+ metadata.gz: f07c471ae04fb0a960e636a064b6d37bb6c122397a08cbcd6b8bfd346c0404c3
4
+ data.tar.gz: c5be46ad5c0c11905e302993ae5658aff5dd2d3e12a5a7aa2158000ae3bbed30
5
5
  SHA512:
6
- metadata.gz: 304dda003c1272727bc279126cc008c27cff83233080ede66817dcb1a3849e149f4b64765642705020013e8d7817726dcbb7039eff8809cf63229cff861a3be7
7
- data.tar.gz: 27cdeee27782a72ea42c931fb43f09660a8627fdb26c9afb4ce084047b0a10b4e8648adb660f796c1ac12db05fdf011306e2b0dfeaae57212b0f45a21503e39c
6
+ metadata.gz: 4dccb90c6164381e2645514a4f1d5710c8edc94765f102fab56e27e4a5f91a598df7daeb3aa1519aa62e7f88c76fc87793f1a41ec6b7fcdb80ce206297afd9a5
7
+ data.tar.gz: 773ba1086531e10702ae59c27b7ef52d6ebf9fdc9616b7fe8dfe73b680ed5792705549bbb1aff3c21b32d3ae177aff1de40c8d7d7042afef358d7b9d404433a8
@@ -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
@@ -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
- Rake::TestTask.new(:test) do |t|
6
- t.libs << "test"
7
- t.libs << "lib"
8
- t.test_files = FileList['test/**/*_test.rb']
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, :test]
10
+ task :default => [:compile, :spec]
12
11
 
13
12
  Rake::ExtensionTask.new "iodine" do |ext|
14
13
  ext.lib_dir = "lib/iodine"
@@ -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
 
@@ -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 > 59) {
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[64];
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
- return NULL;
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) {
@@ -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" +
@@ -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
- require 'iodine/version'
5
- require 'iodine/iodine'
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
  #
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.7.34'.freeze
2
+ VERSION = '0.7.35'.freeze
3
3
  end
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.34
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-04 00:00:00.000000000 Z
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.34.
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: