rage-iodine 5.0.0 → 5.2.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/CHANGELOG.md +19 -0
- data/ext/iodine/http1.c +2 -1
- data/ext/iodine/http_internal.c +4 -64
- data/ext/iodine/iodine_http.c +64 -121
- data/lib/iodine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7be7852385079072038ac11985d101e7b05b4a179d9cca4d9714b5259b2e7976
|
|
4
|
+
data.tar.gz: 89cfe5691372d27ea1cc2093fa9f47e11b86011013b453a23c90371e7849e4c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffadced84f5141ee01debbb951cf7313d9c1f8fda94db7cec4512c717dd6f71c43d0f5e6375c3a736cc1f5c36820db530397c01196aac9e727c0ee47c95ed832
|
|
7
|
+
data.tar.gz: 7cdf3c7c92c855dcb6f07b8063134f6c537f63e4f28bdab4a7b6e58911969c4f069a3d52f3d74ded830bd49a57033bc2fa6e33c77b5ffa1cbdda9d90c7b7307c
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,25 @@ Please notice that this change log contains changes for upcoming releases as wel
|
|
|
6
6
|
|
|
7
7
|
## Changes:
|
|
8
8
|
|
|
9
|
+
#### Change log v.5.2.0 (2026-03-10)
|
|
10
|
+
|
|
11
|
+
**Update**: Skip connection validity check when closing SSE connections
|
|
12
|
+
|
|
13
|
+
**Update**: Stop setting content-type header for SSE requests
|
|
14
|
+
|
|
15
|
+
**Update**: Set `x-accel-buffering` for SSE requests
|
|
16
|
+
|
|
17
|
+
#### Change log v.5.1.0 (2026-03-04)
|
|
18
|
+
|
|
19
|
+
**Update**: Verify SSE connection are open before calling the protocol object
|
|
20
|
+
**Update**: Invert upgrade flow to move the upgrade decisions to the framework level
|
|
21
|
+
|
|
22
|
+
#### Change log v.5.0.0 (2026-02-25)
|
|
23
|
+
|
|
24
|
+
**Update**: Stop formatting SSE events
|
|
25
|
+
**Update**: Update accept header check for SSE
|
|
26
|
+
**Update**: Support fiber pauses during upgrades
|
|
27
|
+
|
|
9
28
|
#### Change log v.4.4.0 (2025-11-28)
|
|
10
29
|
|
|
11
30
|
**Update**: Update the `rackup` interface.
|
data/ext/iodine/http1.c
CHANGED
|
@@ -465,11 +465,12 @@ static int http1_upgrade2sse(http_s *h, http_sse_s *sse) {
|
|
|
465
465
|
const intptr_t uuid = handle2pr(h)->p.uuid;
|
|
466
466
|
/* send response */
|
|
467
467
|
h->status = 200;
|
|
468
|
-
http_set_header(h, HTTP_HEADER_CONTENT_TYPE, fiobj_dup(HTTP_HVALUE_SSE_MIME));
|
|
469
468
|
http_set_header(h, HTTP_HEADER_CACHE_CONTROL,
|
|
470
469
|
fiobj_dup(HTTP_HVALUE_NO_CACHE));
|
|
471
470
|
http_set_header(h, HTTP_HEADER_CONTENT_ENCODING,
|
|
472
471
|
fiobj_str_new("identity", 8));
|
|
472
|
+
http_set_header(h, fiobj_str_new("x-accel-buffering", 17),
|
|
473
|
+
fiobj_str_new("no", 2));
|
|
473
474
|
handle2pr(h)->stop = 1;
|
|
474
475
|
htt1p_finish(h); /* avoid the enforced content length in http_finish */
|
|
475
476
|
|
data/ext/iodine/http_internal.c
CHANGED
|
@@ -12,53 +12,12 @@ Feel free to copy, use and enjoy according to the license provided.
|
|
|
12
12
|
Internal Request / Response Handlers
|
|
13
13
|
***************************************************************************** */
|
|
14
14
|
|
|
15
|
+
/* Used by HTTP client response handler for WebSocket upgrade detection */
|
|
15
16
|
static uint64_t http_upgrade_hash = 0;
|
|
16
17
|
|
|
17
|
-
static inline uint8_t http_accept_item_is_sse(char *item, size_t len) {
|
|
18
|
-
while (len && (*item == ' ' || *item == '\t')) {
|
|
19
|
-
++item;
|
|
20
|
-
--len;
|
|
21
|
-
}
|
|
22
|
-
while (len && (item[len - 1] == ' ' || item[len - 1] == '\t')) {
|
|
23
|
-
--len;
|
|
24
|
-
}
|
|
25
|
-
return (len == 17 && !strncasecmp(item, "text/event-stream", 17));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static inline uint8_t http_accepts_sse(FIOBJ value) {
|
|
29
|
-
if (!value)
|
|
30
|
-
return 0;
|
|
31
|
-
if (FIOBJ_TYPE_IS(value, FIOBJ_T_ARRAY)) {
|
|
32
|
-
for (size_t i = 0; i < fiobj_ary_count(value); ++i) {
|
|
33
|
-
if (http_accepts_sse(fiobj_ary_index(value, i)))
|
|
34
|
-
return 1;
|
|
35
|
-
}
|
|
36
|
-
return 0;
|
|
37
|
-
}
|
|
38
|
-
fio_str_info_s accept = fiobj_obj2cstr(value);
|
|
39
|
-
if (!accept.data || !accept.len)
|
|
40
|
-
return 0;
|
|
41
|
-
|
|
42
|
-
size_t i = 0;
|
|
43
|
-
while (i < accept.len) {
|
|
44
|
-
size_t start = i;
|
|
45
|
-
while (i < accept.len && accept.data[i] != ';' && accept.data[i] != ',')
|
|
46
|
-
++i;
|
|
47
|
-
if (http_accept_item_is_sse(accept.data + start, i - start))
|
|
48
|
-
return 1;
|
|
49
|
-
while (i < accept.len && accept.data[i] != ',')
|
|
50
|
-
++i;
|
|
51
|
-
if (i < accept.len)
|
|
52
|
-
++i;
|
|
53
|
-
}
|
|
54
|
-
return 0;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
18
|
/** Use this function to handle HTTP requests.*/
|
|
58
19
|
void http_on_request_handler______internal(http_s *h,
|
|
59
20
|
http_settings_s *settings) {
|
|
60
|
-
if (!http_upgrade_hash)
|
|
61
|
-
http_upgrade_hash = fiobj_hash_string("upgrade", 7);
|
|
62
21
|
h->udata = settings->udata;
|
|
63
22
|
|
|
64
23
|
static uint64_t host_hash = 0;
|
|
@@ -75,13 +34,7 @@ void http_on_request_handler______internal(http_s *h,
|
|
|
75
34
|
}
|
|
76
35
|
}
|
|
77
36
|
|
|
78
|
-
|
|
79
|
-
if (t)
|
|
80
|
-
goto upgrade;
|
|
81
|
-
|
|
82
|
-
if (http_accepts_sse(
|
|
83
|
-
fiobj_hash_get2(h->headers, fiobj_obj2hash(HTTP_HEADER_ACCEPT))))
|
|
84
|
-
goto eventsource;
|
|
37
|
+
/* Static file handling */
|
|
85
38
|
if (settings->public_folder &&
|
|
86
39
|
(fiobj_obj2cstr(h->method).len != 4 || strncasecmp("post", fiobj_obj2cstr(h->method).data, 4))) {
|
|
87
40
|
fio_str_info_s path_str = fiobj_obj2cstr(h->path);
|
|
@@ -91,24 +44,11 @@ void http_on_request_handler______internal(http_s *h,
|
|
|
91
44
|
return;
|
|
92
45
|
}
|
|
93
46
|
}
|
|
47
|
+
|
|
48
|
+
/* Always call on_request - let the framework decide upgrades */
|
|
94
49
|
settings->on_request(h);
|
|
95
50
|
return;
|
|
96
51
|
|
|
97
|
-
upgrade:
|
|
98
|
-
if (1) {
|
|
99
|
-
fiobj_dup(t); /* allow upgrade name access after http_finish */
|
|
100
|
-
fio_str_info_s val = fiobj_obj2cstr(t);
|
|
101
|
-
if (val.data[0] == 'h' && val.data[1] == '2') {
|
|
102
|
-
http_send_error(h, 400);
|
|
103
|
-
} else {
|
|
104
|
-
settings->on_upgrade(h, val.data, val.len);
|
|
105
|
-
}
|
|
106
|
-
fiobj_free(t);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
eventsource:
|
|
110
|
-
settings->on_upgrade(h, (char *)"sse", 3);
|
|
111
|
-
return;
|
|
112
52
|
missing_host:
|
|
113
53
|
FIO_LOG_DEBUG("missing Host header");
|
|
114
54
|
http_send_error(h, 400);
|
data/ext/iodine/iodine_http.c
CHANGED
|
@@ -63,11 +63,8 @@ static ID fiber_result_var_id;
|
|
|
63
63
|
static VALUE http_wait_directive;
|
|
64
64
|
static ID fiber_id_method_id;
|
|
65
65
|
static ID iodine_env_var_id;
|
|
66
|
-
static ID iodine_upgrade_var_id;
|
|
67
66
|
|
|
68
|
-
static VALUE
|
|
69
|
-
static VALUE env_template_websockets;
|
|
70
|
-
static VALUE env_template_sse;
|
|
67
|
+
static VALUE env_template;
|
|
71
68
|
|
|
72
69
|
static rb_encoding *IodineUTF8Encoding;
|
|
73
70
|
static rb_encoding *IodineBinaryEncoding;
|
|
@@ -124,11 +121,6 @@ typedef struct {
|
|
|
124
121
|
IODINE_HTTP_WAIT,
|
|
125
122
|
IODINE_HTTP_DEFERRED,
|
|
126
123
|
} type;
|
|
127
|
-
enum iodine_upgrade_type_enum {
|
|
128
|
-
IODINE_UPGRADE_NONE = 0,
|
|
129
|
-
IODINE_UPGRADE_WEBSOCKET,
|
|
130
|
-
IODINE_UPGRADE_SSE,
|
|
131
|
-
} upgrade;
|
|
132
124
|
} iodine_http_request_handle_s;
|
|
133
125
|
|
|
134
126
|
/* *****************************************************************************
|
|
@@ -240,10 +232,15 @@ static void iodine_sse_on_close(http_sse_s *sse) {
|
|
|
240
232
|
}
|
|
241
233
|
|
|
242
234
|
static void iodine_sse_on_open(http_sse_s *sse) {
|
|
235
|
+
intptr_t uuid = http_sse2uuid(sse);
|
|
236
|
+
if (uuid == -1) {
|
|
237
|
+
// Connection was closed before on_open could fire, skip silently
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
243
240
|
VALUE h = (VALUE)sse->udata;
|
|
244
241
|
iodine_connection_s *c = iodine_connection_CData(h);
|
|
245
242
|
c->arg = sse;
|
|
246
|
-
c->uuid =
|
|
243
|
+
c->uuid = uuid;
|
|
247
244
|
iodine_connection_fire_event(h, IODINE_CONNECTION_ON_OPEN, Qnil);
|
|
248
245
|
sse->on_ready = iodine_sse_on_ready;
|
|
249
246
|
fio_force_event(c->uuid, FIO_EVENT_ON_READY);
|
|
@@ -323,18 +320,7 @@ static int iodine_copy2env_task(FIOBJ o, void *env_) {
|
|
|
323
320
|
static inline VALUE copy2env(iodine_http_request_handle_s *handle) {
|
|
324
321
|
VALUE env;
|
|
325
322
|
http_s *h = handle->h;
|
|
326
|
-
|
|
327
|
-
case IODINE_UPGRADE_WEBSOCKET:
|
|
328
|
-
env = rb_hash_dup(env_template_websockets);
|
|
329
|
-
break;
|
|
330
|
-
case IODINE_UPGRADE_SSE:
|
|
331
|
-
env = rb_hash_dup(env_template_sse);
|
|
332
|
-
break;
|
|
333
|
-
case IODINE_UPGRADE_NONE: /* fallthrough */
|
|
334
|
-
default:
|
|
335
|
-
env = rb_hash_dup(env_template_no_upgrade);
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
323
|
+
env = rb_hash_dup(env_template);
|
|
338
324
|
IodineStore.add(env);
|
|
339
325
|
|
|
340
326
|
fio_str_info_s tmp;
|
|
@@ -614,6 +600,8 @@ static inline int ruby2c_review_upgrade(iodine_http_request_handle_s *req,
|
|
|
614
600
|
VALUE rbresponse, VALUE env) {
|
|
615
601
|
http_s *h = req->h;
|
|
616
602
|
VALUE handler;
|
|
603
|
+
VALUE upgrade_type;
|
|
604
|
+
|
|
617
605
|
if ((handler = rb_hash_aref(env, IODINE_R_HIJACK_CB)) != Qnil) {
|
|
618
606
|
// send headers
|
|
619
607
|
http_finish(h);
|
|
@@ -627,37 +615,29 @@ static inline int ruby2c_review_upgrade(iodine_http_request_handle_s *req,
|
|
|
627
615
|
goto upgraded;
|
|
628
616
|
} else if ((handler = rb_hash_aref(env, UPGRADE_TCP)) != Qnil) {
|
|
629
617
|
goto tcp_ip_upgrade;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
intptr_t uuid = http_hijack(h, NULL);
|
|
651
|
-
// send headers
|
|
652
|
-
http_finish(h);
|
|
653
|
-
// upgrade protocol to raw TCP/IP
|
|
654
|
-
iodine_tcp_attch_uuid(uuid, handler);
|
|
655
|
-
goto upgraded;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
break;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
handler = rb_hash_aref(env, RACK_UPGRADE);
|
|
621
|
+
if (handler == Qnil)
|
|
622
|
+
return 0;
|
|
623
|
+
|
|
624
|
+
upgrade_type = rb_hash_aref(env, RACK_UPGRADE_Q);
|
|
625
|
+
|
|
626
|
+
if (upgrade_type == RACK_UPGRADE_WEBSOCKET) {
|
|
627
|
+
iodine_ws_attach(h, handler, env);
|
|
628
|
+
goto upgraded;
|
|
629
|
+
} else if (upgrade_type == RACK_UPGRADE_SSE) {
|
|
630
|
+
iodine_sse_attach(h, handler, env);
|
|
631
|
+
goto upgraded;
|
|
632
|
+
} else if (RTEST(upgrade_type)) {
|
|
633
|
+
tcp_ip_upgrade : {
|
|
634
|
+
intptr_t uuid = http_hijack(h, NULL);
|
|
635
|
+
http_finish(h);
|
|
636
|
+
iodine_tcp_attch_uuid(uuid, handler);
|
|
637
|
+
goto upgraded;
|
|
659
638
|
}
|
|
660
639
|
}
|
|
640
|
+
|
|
661
641
|
return 0;
|
|
662
642
|
|
|
663
643
|
upgraded:
|
|
@@ -675,8 +655,8 @@ Handling HTTP requests
|
|
|
675
655
|
|
|
676
656
|
static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
677
657
|
iodine_http_request_handle_s *handle = handle_;
|
|
678
|
-
VALUE rbresponse =
|
|
679
|
-
VALUE env =
|
|
658
|
+
VALUE rbresponse = Qnil;
|
|
659
|
+
VALUE env = Qnil, tmp;
|
|
680
660
|
http_s *h = handle->h;
|
|
681
661
|
if (!h->udata)
|
|
682
662
|
goto err_not_found;
|
|
@@ -684,7 +664,6 @@ static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
|
684
664
|
if (handle->type == IODINE_HTTP_DEFERRED) {
|
|
685
665
|
rbresponse = rb_ivar_get((VALUE)h->fiber, fiber_result_var_id);
|
|
686
666
|
env = rb_ivar_get((VALUE)h->fiber, iodine_env_var_id);
|
|
687
|
-
handle->upgrade = FIX2INT(rb_ivar_get((VALUE)h->fiber, iodine_upgrade_var_id));
|
|
688
667
|
} else {
|
|
689
668
|
// create / register env variable
|
|
690
669
|
env = copy2env(handle);
|
|
@@ -704,7 +683,6 @@ static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
|
704
683
|
if (TYPE(tmp) == T_SYMBOL && tmp == http_wait_directive) {
|
|
705
684
|
VALUE fiber = rb_ary_entry(rbresponse, 1);
|
|
706
685
|
rb_ivar_set(fiber, iodine_env_var_id, env);
|
|
707
|
-
rb_ivar_set(fiber, iodine_upgrade_var_id, INT2FIX(handle->upgrade));
|
|
708
686
|
h->fiber = (void *)IodineStore.add(fiber);
|
|
709
687
|
goto defer;
|
|
710
688
|
}
|
|
@@ -748,7 +726,8 @@ static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
|
748
726
|
// review each header and write it to the response.
|
|
749
727
|
rb_hash_foreach(response_headers, for_each_header_data, (VALUE)(h));
|
|
750
728
|
// review for upgrade.
|
|
751
|
-
if ((intptr_t)h->status < 300 &&
|
|
729
|
+
if ((intptr_t)h->status < 300 && env != Qnil &&
|
|
730
|
+
ruby2c_review_upgrade(handle, rbresponse, env))
|
|
752
731
|
goto external_done;
|
|
753
732
|
// send the request body.
|
|
754
733
|
if (ruby2c_response_send(handle, rbresponse, env))
|
|
@@ -832,7 +811,6 @@ iodine_perform_handle_action(iodine_http_request_handle_s handle) {
|
|
|
832
811
|
static inline void http_resume_deferred_request_handler(http_s *h) {
|
|
833
812
|
iodine_http_request_handle_s handle = (iodine_http_request_handle_s){
|
|
834
813
|
.h = h,
|
|
835
|
-
.upgrade = IODINE_UPGRADE_NONE,
|
|
836
814
|
.type = IODINE_HTTP_DEFERRED,
|
|
837
815
|
};
|
|
838
816
|
|
|
@@ -863,7 +841,6 @@ static inline void http_pause_request_handler(http_pause_handle_s *s) {
|
|
|
863
841
|
static void on_rack_request(http_s *h) {
|
|
864
842
|
iodine_http_request_handle_s handle = (iodine_http_request_handle_s){
|
|
865
843
|
.h = h,
|
|
866
|
-
.upgrade = IODINE_UPGRADE_NONE,
|
|
867
844
|
};
|
|
868
845
|
IodineCaller.enterGVL((void *(*)(void *))iodine_handle_request_in_GVL,
|
|
869
846
|
&handle);
|
|
@@ -875,38 +852,15 @@ static void on_rack_request(http_s *h) {
|
|
|
875
852
|
}
|
|
876
853
|
}
|
|
877
854
|
|
|
878
|
-
static void on_rack_upgrade(http_s *h, char *proto, size_t len) {
|
|
879
|
-
iodine_http_request_handle_s handle = (iodine_http_request_handle_s){.h = h};
|
|
880
|
-
if (len == 9 && (proto[1] == 'e' || proto[1] == 'E')) {
|
|
881
|
-
handle.upgrade = IODINE_UPGRADE_WEBSOCKET;
|
|
882
|
-
} else if (len == 3 && proto[0] == 's') {
|
|
883
|
-
handle.upgrade = IODINE_UPGRADE_SSE;
|
|
884
|
-
}
|
|
885
|
-
/* when we stop supporting custom Upgrade headers: */
|
|
886
|
-
// else {
|
|
887
|
-
// http_send_error(h, 400);
|
|
888
|
-
// return;
|
|
889
|
-
// }
|
|
890
|
-
IodineCaller.enterGVL(iodine_handle_request_in_GVL, &handle);
|
|
891
|
-
|
|
892
|
-
if (handle.type == IODINE_HTTP_WAIT) {
|
|
893
|
-
http_pause(handle.h, http_pause_request_handler);
|
|
894
|
-
} else {
|
|
895
|
-
iodine_perform_handle_action(handle);
|
|
896
|
-
}
|
|
897
|
-
(void)proto;
|
|
898
|
-
(void)len;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
855
|
/* *****************************************************************************
|
|
902
856
|
Rack `env` Template Initialization
|
|
903
857
|
***************************************************************************** */
|
|
904
858
|
|
|
905
859
|
static void initialize_env_template(void) {
|
|
906
|
-
if (
|
|
860
|
+
if (env_template)
|
|
907
861
|
return;
|
|
908
|
-
|
|
909
|
-
IodineStore.add(
|
|
862
|
+
env_template = rb_hash_new();
|
|
863
|
+
IodineStore.add(env_template);
|
|
910
864
|
|
|
911
865
|
#define add_str_to_env(env, key, value) \
|
|
912
866
|
{ \
|
|
@@ -923,9 +877,9 @@ static void initialize_env_template(void) {
|
|
|
923
877
|
rb_hash_aset((env), k, value); \
|
|
924
878
|
}
|
|
925
879
|
|
|
926
|
-
/* Set global template */
|
|
927
|
-
rb_hash_aset(
|
|
928
|
-
rb_hash_aset(
|
|
880
|
+
/* Set global template - framework will set rack.upgrade? if it wants an upgrade */
|
|
881
|
+
rb_hash_aset(env_template, RACK_UPGRADE_Q, Qnil);
|
|
882
|
+
rb_hash_aset(env_template, RACK_UPGRADE, Qnil);
|
|
929
883
|
{
|
|
930
884
|
/* add the rack.version */
|
|
931
885
|
static VALUE rack_version = 0;
|
|
@@ -936,7 +890,7 @@ static void initialize_env_template(void) {
|
|
|
936
890
|
rb_global_variable(&rack_version);
|
|
937
891
|
rb_ary_freeze(rack_version);
|
|
938
892
|
}
|
|
939
|
-
add_value_to_env(
|
|
893
|
+
add_value_to_env(env_template, "rack.version", rack_version);
|
|
940
894
|
}
|
|
941
895
|
|
|
942
896
|
{
|
|
@@ -944,37 +898,27 @@ static void initialize_env_template(void) {
|
|
|
944
898
|
if (!sn || (sn[0] == '/' && sn[1] == 0)) {
|
|
945
899
|
sn = "";
|
|
946
900
|
}
|
|
947
|
-
add_str_to_env(
|
|
901
|
+
add_str_to_env(env_template, "SCRIPT_NAME", sn);
|
|
948
902
|
}
|
|
949
|
-
rb_hash_aset(
|
|
950
|
-
add_value_to_env(
|
|
951
|
-
add_value_to_env(
|
|
952
|
-
add_value_to_env(
|
|
953
|
-
add_value_to_env(
|
|
954
|
-
add_value_to_env(
|
|
903
|
+
rb_hash_aset(env_template, IODINE_R_INPUT, IODINE_R_INPUT_DEFAULT);
|
|
904
|
+
add_value_to_env(env_template, "rack.errors", rb_stderr);
|
|
905
|
+
add_value_to_env(env_template, "rack.hijack?", Qtrue);
|
|
906
|
+
add_value_to_env(env_template, "rack.multiprocess", Qtrue);
|
|
907
|
+
add_value_to_env(env_template, "rack.multithread", Qtrue);
|
|
908
|
+
add_value_to_env(env_template, "rack.run_once", Qfalse);
|
|
955
909
|
/* default schema to http, it might be updated later */
|
|
956
|
-
rb_hash_aset(
|
|
910
|
+
rb_hash_aset(env_template, R_URL_SCHEME, HTTP_SCHEME);
|
|
957
911
|
/* placeholders... minimize rehashing*/
|
|
958
|
-
rb_hash_aset(
|
|
959
|
-
rb_hash_aset(
|
|
960
|
-
rb_hash_aset(
|
|
961
|
-
rb_hash_aset(
|
|
962
|
-
rb_hash_aset(
|
|
963
|
-
rb_hash_aset(
|
|
964
|
-
rb_hash_aset(
|
|
965
|
-
rb_hash_aset(
|
|
966
|
-
rb_hash_aset(
|
|
967
|
-
rb_hash_aset(
|
|
968
|
-
|
|
969
|
-
/* WebSocket upgrade support */
|
|
970
|
-
env_template_websockets = rb_hash_dup(env_template_no_upgrade);
|
|
971
|
-
IodineStore.add(env_template_websockets);
|
|
972
|
-
rb_hash_aset(env_template_websockets, RACK_UPGRADE_Q, RACK_UPGRADE_WEBSOCKET);
|
|
973
|
-
|
|
974
|
-
/* SSE upgrade support */
|
|
975
|
-
env_template_sse = rb_hash_dup(env_template_no_upgrade);
|
|
976
|
-
IodineStore.add(env_template_sse);
|
|
977
|
-
rb_hash_aset(env_template_sse, RACK_UPGRADE_Q, RACK_UPGRADE_SSE);
|
|
912
|
+
rb_hash_aset(env_template, HTTP_VERSION, QUERY_STRING);
|
|
913
|
+
rb_hash_aset(env_template, IODINE_R_HIJACK, QUERY_STRING);
|
|
914
|
+
rb_hash_aset(env_template, PATH_INFO, QUERY_STRING);
|
|
915
|
+
rb_hash_aset(env_template, QUERY_STRING, QUERY_STRING);
|
|
916
|
+
rb_hash_aset(env_template, REMOTE_ADDR, QUERY_STRING);
|
|
917
|
+
rb_hash_aset(env_template, REQUEST_METHOD, QUERY_STRING);
|
|
918
|
+
rb_hash_aset(env_template, SERVER_NAME, QUERY_STRING);
|
|
919
|
+
rb_hash_aset(env_template, SERVER_PROTOCOL, QUERY_STRING);
|
|
920
|
+
rb_hash_aset(env_template, IODINE_REQUEST_ID, QUERY_STRING);
|
|
921
|
+
rb_hash_aset(env_template, IODINE_HAS_BODY, QUERY_STRING);
|
|
978
922
|
|
|
979
923
|
#undef add_value_to_env
|
|
980
924
|
#undef add_str_to_env
|
|
@@ -1031,15 +975,15 @@ relevant to HTTP/1.x connections.
|
|
|
1031
975
|
intptr_t iodine_http_listen(iodine_connection_args_s args){
|
|
1032
976
|
// clang-format on
|
|
1033
977
|
if (args.public.data) {
|
|
1034
|
-
rb_hash_aset(
|
|
1035
|
-
rb_hash_aset(
|
|
978
|
+
rb_hash_aset(env_template, XSENDFILE_TYPE, XSENDFILE);
|
|
979
|
+
rb_hash_aset(env_template, XSENDFILE_TYPE_HEADER, XSENDFILE);
|
|
1036
980
|
support_xsendfile = 1;
|
|
1037
981
|
}
|
|
1038
982
|
IodineStore.add(args.handler);
|
|
1039
983
|
#ifdef __MINGW32__
|
|
1040
984
|
intptr_t uuid = http_listen(
|
|
1041
985
|
args.port.data, args.address.data, .on_request = on_rack_request,
|
|
1042
|
-
.
|
|
986
|
+
.udata = (void *)args.handler,
|
|
1043
987
|
.timeout = args.timeout, .ws_timeout = args.ping,
|
|
1044
988
|
.ws_max_msg_size = args.max_msg, .max_header_size = args.max_headers,
|
|
1045
989
|
.on_finish = free_iodine_http, .log = args.log, .max_clients = args.max_clients,
|
|
@@ -1047,7 +991,7 @@ intptr_t iodine_http_listen(iodine_connection_args_s args){
|
|
|
1047
991
|
#else
|
|
1048
992
|
intptr_t uuid = http_listen(
|
|
1049
993
|
args.port.data, args.address.data, .on_request = on_rack_request,
|
|
1050
|
-
.
|
|
994
|
+
.udata = (void *)args.handler,
|
|
1051
995
|
.tls = args.tls, .timeout = args.timeout, .ws_timeout = args.ping,
|
|
1052
996
|
.ws_max_msg_size = args.max_msg, .max_header_size = args.max_headers,
|
|
1053
997
|
.on_finish = free_iodine_http, .log = args.log, .max_clients = args.max_clients,
|
|
@@ -1257,7 +1201,6 @@ void iodine_init_http(void) {
|
|
|
1257
1201
|
http_wait_directive = ID2SYM(rb_intern("__http_defer__"));
|
|
1258
1202
|
fiber_id_method_id = rb_intern("__get_id");
|
|
1259
1203
|
iodine_env_var_id = rb_intern("@__iodine_env");
|
|
1260
|
-
iodine_upgrade_var_id = rb_intern("@__iodine_upgrade");
|
|
1261
1204
|
|
|
1262
1205
|
IodineUTF8Encoding = rb_enc_find("UTF-8");
|
|
1263
1206
|
IodineBinaryEncoding = rb_enc_find("binary");
|
data/lib/iodine/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rage-iodine
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Boaz Segev
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-03-10 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rake
|