iodine 0.7.57 → 0.7.59
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/CHANGELOG.md +6 -0
- data/README.md +17 -17
- data/SECURITY.md +32 -0
- data/ext/iodine/fio.c +1 -1
- data/ext/iodine/fio.h +12 -14
- data/ext/iodine/fio_json_parser.h +5 -4
- data/ext/iodine/fio_tls_openssl.c +140 -90
- data/ext/iodine/fiobj_data.c +13 -11
- data/ext/iodine/fiobj_str.h +1 -1
- data/ext/iodine/fiobject.h +5 -4
- data/ext/iodine/http1.c +92 -7
- data/ext/iodine/http1_parser.h +164 -1121
- data/ext/iodine/iodine_caller.c +25 -13
- data/ext/iodine/iodine_store.c +23 -19
- data/ext/iodine/websockets.c +7 -16
- data/lib/iodine/version.rb +1 -1
- data/lib/iodine.rb +4 -0
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b701f0b79a433993d53684b5ce564356f1317e0a23060a0a9c7f729d8857d3bb
|
|
4
|
+
data.tar.gz: 1abd95637405ccc2990d00d771e61c25cc075e8d819da47205879e151099d546
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d35fb80524542d8dbaf5a9d0b8c36fbe2b8a82801d3957559573d6141bd109537ea64f4d1bee905b16b37b6b80bc998403e5da8476aaeee2c19cb009f23b9cd
|
|
7
|
+
data.tar.gz: d7ddbe875e12102ab71557391c8be4eedd9d0735d9734bfddfcbf600af0a3867ab1f0ea159f1a2ad61f823772d300732a0907e20cc1f30941e5ec211d3268068
|
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.58 (2024-04-28)
|
|
10
|
+
|
|
11
|
+
**Fix**: possible fix for compilation issues on Fedora. Credit to @garytaylor for opening issue #155.
|
|
12
|
+
|
|
13
|
+
**Fix**: possible fix for an OpenSSL certificate chain import issue that would cause certificate chains to be imported incorrectly. Credit to @dwolrdcojp for opening the facil.io repo PR #151.
|
|
14
|
+
|
|
9
15
|
#### Change log v.0.7.57 (2023-09-04)
|
|
10
16
|
|
|
11
17
|
**Fix**: Fixes possible name collision when loading gem (`.rb` vs. `.so` loading). Credit to @noraj (Alexandre ZANNI) for opening issue #148. Credit to @janbiedermann (Jan Biedermann) for discovering the root cause and offering a solution.
|
data/README.md
CHANGED
|
@@ -10,42 +10,42 @@
|
|
|
10
10
|
|
|
11
11
|
Iodine is a fast concurrent web application server for real-time Ruby applications, with native support for WebSockets and Pub/Sub services - but it's also so much more.
|
|
12
12
|
|
|
13
|
-
Iodine is a Ruby wrapper for
|
|
13
|
+
Iodine is a Ruby wrapper for much of the [facil.io](https://facil.io) C framework, leveraging the speed of C for many common web application tasks. In addition, iodine abstracts away all network concerns, so you never need to worry about the transport layer, leaving you free to concentrate on your application logic.
|
|
14
14
|
|
|
15
15
|
Iodine includes native support for:
|
|
16
16
|
|
|
17
17
|
* HTTP, WebSockets and EventSource (SSE) Services (server);
|
|
18
18
|
* WebSocket connections (server / client);
|
|
19
19
|
* Pub/Sub (with optional Redis Pub/Sub scaling);
|
|
20
|
-
* Fast(!) builtin Mustache
|
|
20
|
+
* Fast(!) builtin Mustache templating;
|
|
21
21
|
* Static file service (with automatic `gzip` support for pre-compressed assets);
|
|
22
|
-
* Optimized Logging to `stderr
|
|
22
|
+
* Optimized Logging to `stderr`;
|
|
23
23
|
* Asynchronous event scheduling and timers;
|
|
24
24
|
* HTTP/1.1 keep-alive and pipelining;
|
|
25
|
-
* Heap Fragmentation Protection
|
|
26
|
-
* TLS 1.2 and above (
|
|
25
|
+
* Heap Fragmentation Protection;
|
|
26
|
+
* TLS 1.2 and above (Requiring OpenSSL >= 1.1.0);
|
|
27
27
|
* TCP/IP server and client connectivity;
|
|
28
28
|
* Unix Socket server and client connectivity;
|
|
29
|
-
* Hot
|
|
29
|
+
* Hot Restarts (using the USR1 signal and without hot deployment);
|
|
30
30
|
* Custom protocol authoring;
|
|
31
|
-
* [Sequel](https://github.com/jeremyevans/sequel) and ActiveRecord forking protection
|
|
31
|
+
* [Sequel](https://github.com/jeremyevans/sequel) and ActiveRecord forking protection;
|
|
32
32
|
* and more!
|
|
33
33
|
|
|
34
|
-
Since iodine wraps much of the [C facil.io framework](https://github.com/boazsegev/facil.io)
|
|
34
|
+
Since iodine wraps much of the [C facil.io framework](https://github.com/boazsegev/facil.io) for Ruby:
|
|
35
35
|
|
|
36
|
-
* Iodine can handle **thousands of concurrent connections** (tested with more
|
|
36
|
+
* Iodine can handle **thousands of concurrent connections** (tested with more than 20K connections on Linux)!
|
|
37
37
|
|
|
38
38
|
* Iodine is ideal for **Linux/Unix** based systems (i.e. macOS, Ubuntu, FreeBSD etc'), which are ideal for evented IO (while Windows and Solaris are better at IO *completion* events, which are very different).
|
|
39
39
|
|
|
40
40
|
Iodine is a C extension for Ruby, developed and optimized for Ruby MRI 2.3 and up... it should support the whole Ruby 2.x and 3.x MRI family, but CI tests start at Ruby 2.3.
|
|
41
41
|
|
|
42
|
-
**Note**: iodine does **not** support streaming when using Rack. It's recommended to avoid blocking the server when using `body.each` since the `each` loop will block
|
|
42
|
+
**Note**: iodine does **not** support streaming when using Rack. It's recommended to avoid blocking the server when using `body.each` since the `each` loop will block iodine's thread until it's finished and iodine won't send any data before the loop is done.
|
|
43
43
|
|
|
44
44
|
## Iodine - a fast & powerful HTTP + WebSockets server with native Pub/Sub
|
|
45
45
|
|
|
46
46
|
Iodine includes a light and fast HTTP and Websocket server written in C that was written according to the [Rack interface specifications](http://www.rubydoc.info/github/rack/rack/master/file/SPEC) and the [Websocket draft extension](./SPEC-Websocket-Draft.md).
|
|
47
47
|
|
|
48
|
-
With `Iodine.listen service: :http` it's possible to run multiple HTTP applications (please remember not to set more than a single application on a single TCP/IP port).
|
|
48
|
+
With `Iodine.listen service: :http` it's possible to run multiple HTTP applications (but please remember not to set more than a single application on a single TCP/IP port).
|
|
49
49
|
|
|
50
50
|
Iodine also supports native process cluster Pub/Sub and a native RedisEngine to easily scale iodine's Pub/Sub horizontally.
|
|
51
51
|
|
|
@@ -278,11 +278,11 @@ module WebsocketChat
|
|
|
278
278
|
extend self
|
|
279
279
|
end
|
|
280
280
|
APP = Proc.new do |env|
|
|
281
|
-
if env['rack.upgrade?'.freeze] == :websocket
|
|
282
|
-
env['rack.upgrade'.freeze] = WebsocketChat
|
|
281
|
+
if env['rack.upgrade?'.freeze] == :websocket
|
|
282
|
+
env['rack.upgrade'.freeze] = WebsocketChat
|
|
283
283
|
[0,{}, []] # It's possible to set cookies for the response.
|
|
284
284
|
elsif env['rack.upgrade?'.freeze] == :sse
|
|
285
|
-
puts "SSE connections can only receive data from the server, the can't write."
|
|
285
|
+
puts "SSE connections can only receive data from the server, the can't write."
|
|
286
286
|
env['rack.upgrade'.freeze] = WebsocketChat
|
|
287
287
|
[0,{}, []] # It's possible to set cookies for the response.
|
|
288
288
|
else
|
|
@@ -556,7 +556,7 @@ Iodine is written in C and allows some compile-time customizations, such as:
|
|
|
556
556
|
* `FIO_MAX_SOCK_CAPACITY` - limits iodine's maximum client capacity. Defaults to 131,072 clients.
|
|
557
557
|
|
|
558
558
|
* `FIO_USE_RISKY_HASH` - replaces SipHash with RiskyHash for iodine's internal hash maps.
|
|
559
|
-
|
|
559
|
+
|
|
560
560
|
Since iodine hash maps have internal protection against collisions and hash flooding attacks, it's possible for iodine to leverage RiskyHash, which is faster than SipHash.
|
|
561
561
|
|
|
562
562
|
By default, SipHash will be used. This is a community related choice, since the community seems to believe a hash function should protect the hash map rather than it being enough for a hash map implementation to be attack resistance.
|
|
@@ -611,7 +611,7 @@ end
|
|
|
611
611
|
|
|
612
612
|
In pure Ruby (without using C extensions or Java), it's possible to do the same by using `select`... and although `select` has some issues, it could work well for lighter loads.
|
|
613
613
|
|
|
614
|
-
The server events are fairly fast and fragmented (longer code is fragmented across multiple events), so one thread is enough to run the server including it's static file service and everything...
|
|
614
|
+
The server events are fairly fast and fragmented (longer code is fragmented across multiple events), so one thread is enough to run the server including it's static file service and everything...
|
|
615
615
|
|
|
616
616
|
...but single threaded mode should probably be avoided.
|
|
617
617
|
|
|
@@ -642,7 +642,7 @@ If you have the development headers but still can't compile the iodine extension
|
|
|
642
642
|
|
|
643
643
|
## Mr. Sandman, write me a server
|
|
644
644
|
|
|
645
|
-
Iodine allows custom TCP/IP server authoring, for those cases where we need raw TCP/IP (UDP isn't supported just yet).
|
|
645
|
+
Iodine allows custom TCP/IP server authoring, for those cases where we need raw TCP/IP (UDP isn't supported just yet).
|
|
646
646
|
|
|
647
647
|
Here's a short and sweet echo server - No HTTP, just use `telnet`:
|
|
648
648
|
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
Please report any security issues you discover on GitHub using the [`Security and quality`](https://github.com/boazsegev/iodine/security) reporting form.
|
|
4
|
+
|
|
5
|
+
Please remember that this is an open source project that I work on in my free time. Take it as is, I don't promise anything.
|
|
6
|
+
|
|
7
|
+
## Supported Versions
|
|
8
|
+
|
|
9
|
+
I support what I have time to support, with my main focus being:
|
|
10
|
+
|
|
11
|
+
| Version | Support |
|
|
12
|
+
| ------- | ------------------ |
|
|
13
|
+
| 0.8.x | :green_circle: |
|
|
14
|
+
| 0.7.x | :orange_circle: |
|
|
15
|
+
| < 0.7.0 | :red_circle: |
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### [facil.io](https://facil.io) Security Issues
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
| Version | facil.io link |
|
|
23
|
+
| ------- | ------------------ |
|
|
24
|
+
| 0.8.x | https://github.com/facil-io/cstl/security |
|
|
25
|
+
| 0.7.x | https://github.com/boazsegev/facil.io/security |
|
|
26
|
+
| < 0.7.0 | :red_circle: |
|
|
27
|
+
|
|
28
|
+
## Reporting a Vulnerability
|
|
29
|
+
|
|
30
|
+
Please report any security issues you discover on GitHub using the [`Security and quality`](https://github.com/boazsegev/iodine/security) reporting form or privately using email.
|
|
31
|
+
|
|
32
|
+
Usually I implement a security patch for the version reported before porting to the current developer version. Please note that it's usually possible to port the patch manually if you don't want to upgrade an older version.
|
data/ext/iodine/fio.c
CHANGED
|
@@ -3385,7 +3385,7 @@ read_error:
|
|
|
3385
3385
|
static int fio_sock_sendfile_from_fd(int fd, fio_packet_s *packet) {
|
|
3386
3386
|
ssize_t sent;
|
|
3387
3387
|
sent =
|
|
3388
|
-
|
|
3388
|
+
sendfile(fd, packet->data.fd, (off_t *)&packet->offset, packet->length);
|
|
3389
3389
|
if (sent < 0)
|
|
3390
3390
|
return -1;
|
|
3391
3391
|
packet->length -= sent;
|
data/ext/iodine/fio.h
CHANGED
|
@@ -109,7 +109,7 @@ Version and helper macros
|
|
|
109
109
|
|
|
110
110
|
#define FIO_VERSION_MAJOR 0
|
|
111
111
|
#define FIO_VERSION_MINOR 7
|
|
112
|
-
#define FIO_VERSION_PATCH
|
|
112
|
+
#define FIO_VERSION_PATCH 7
|
|
113
113
|
#define FIO_VERSION_BETA 0
|
|
114
114
|
|
|
115
115
|
/* Automatically convert version data to a string constant - ignore these two */
|
|
@@ -221,6 +221,7 @@ Version and helper macros
|
|
|
221
221
|
#include <unistd.h>
|
|
222
222
|
#ifdef __MINGW32__
|
|
223
223
|
#include <winsock2.h>
|
|
224
|
+
|
|
224
225
|
#include <winsock.h>
|
|
225
226
|
#include <ws2tcpip.h>
|
|
226
227
|
#endif
|
|
@@ -251,10 +252,10 @@ Version and helper macros
|
|
|
251
252
|
#endif
|
|
252
253
|
|
|
253
254
|
#ifdef __MINGW32__
|
|
254
|
-
#define
|
|
255
|
-
#define __S_IFLNK
|
|
256
|
-
#define
|
|
257
|
-
#define S_ISLNK(mode)
|
|
255
|
+
#define __S_IFMT 0170000
|
|
256
|
+
#define __S_IFLNK 0120000
|
|
257
|
+
#define __S_ISTYPE(mode, mask) (((mode)&__S_IFMT) == (mask))
|
|
258
|
+
#define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
|
|
258
259
|
|
|
259
260
|
#define SIGKILL 9
|
|
260
261
|
#define SIGTERM 15
|
|
@@ -4743,14 +4744,11 @@ static FIO_ARY_TYPE const FIO_NAME(s___const_invalid_object);
|
|
|
4743
4744
|
/* minimizes allocation "dead space" by alligning allocated length to 16bytes */
|
|
4744
4745
|
#undef FIO_ARY_SIZE2WORDS
|
|
4745
4746
|
#define FIO_ARY_SIZE2WORDS(size) \
|
|
4746
|
-
((sizeof(FIO_ARY_TYPE) & 1)
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
? (((size) & (~3)) + 4) \
|
|
4752
|
-
: (sizeof(FIO_ARY_TYPE) & 8) ? (((size) & (~1)) + 2) \
|
|
4753
|
-
: (size))
|
|
4747
|
+
((sizeof(FIO_ARY_TYPE) & 1) ? (((size) & (~15)) + 16) \
|
|
4748
|
+
: (sizeof(FIO_ARY_TYPE) & 2) ? (((size) & (~7)) + 8) \
|
|
4749
|
+
: (sizeof(FIO_ARY_TYPE) & 4) ? (((size) & (~3)) + 4) \
|
|
4750
|
+
: (sizeof(FIO_ARY_TYPE) & 8) ? (((size) & (~1)) + 2) \
|
|
4751
|
+
: (size))
|
|
4754
4752
|
|
|
4755
4753
|
/* *****************************************************************************
|
|
4756
4754
|
Array API
|
|
@@ -6048,7 +6046,7 @@ FIO_NAME(_insert_or_overwrite_)(FIO_NAME(s) * set, FIO_SET_HASH_TYPE hash_value,
|
|
|
6048
6046
|
pos->hash = hash_value;
|
|
6049
6047
|
pos->pos->hash = hash_value;
|
|
6050
6048
|
FIO_SET_COPY(pos->pos->obj, obj);
|
|
6051
|
-
|
|
6049
|
+
|
|
6052
6050
|
return pos->pos->obj;
|
|
6053
6051
|
}
|
|
6054
6052
|
|
|
@@ -393,7 +393,7 @@ fio_json_parse(json_parser_s *parser, const char *buffer, size_t length) {
|
|
|
393
393
|
goto error;
|
|
394
394
|
break;
|
|
395
395
|
case ']':
|
|
396
|
-
if ((parser->dict & 1))
|
|
396
|
+
if ((parser->dict & 1) || !parser->depth)
|
|
397
397
|
goto error;
|
|
398
398
|
--parser->depth;
|
|
399
399
|
++pos;
|
|
@@ -453,12 +453,12 @@ fio_json_parse(json_parser_s *parser, const char *buffer, size_t length) {
|
|
|
453
453
|
long long i = fio_atol((char **)&tmp);
|
|
454
454
|
if (tmp > limit)
|
|
455
455
|
goto stop;
|
|
456
|
-
if (!tmp || JSON_NUMERAL[*tmp]) {
|
|
456
|
+
if (!tmp || tmp == pos || JSON_NUMERAL[*tmp]) {
|
|
457
457
|
tmp = pos;
|
|
458
458
|
double f = fio_atof((char **)&tmp);
|
|
459
459
|
if (tmp > limit)
|
|
460
460
|
goto stop;
|
|
461
|
-
if (!tmp || JSON_NUMERAL[*tmp])
|
|
461
|
+
if (!tmp || tmp == pos || JSON_NUMERAL[*tmp])
|
|
462
462
|
goto error;
|
|
463
463
|
fio_json_on_float(parser, f);
|
|
464
464
|
pos = tmp;
|
|
@@ -481,8 +481,9 @@ fio_json_parse(json_parser_s *parser, const char *buffer, size_t length) {
|
|
|
481
481
|
if (pos[1] == '*') {
|
|
482
482
|
if (pos + 4 > limit)
|
|
483
483
|
goto stop;
|
|
484
|
-
uint8_t *tmp = pos +
|
|
484
|
+
uint8_t *tmp = pos + 2; /* avoid this: /*/
|
|
485
485
|
do {
|
|
486
|
+
++tmp;
|
|
486
487
|
tmp = memchr(tmp, '/', (uintptr_t)(limit - tmp));
|
|
487
488
|
} while (tmp && tmp[-1] != '*');
|
|
488
489
|
if (!tmp)
|