rage-iodine 5.0.0 → 5.1.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 +11 -0
- data/ext/iodine/http_internal.c +4 -64
- data/ext/iodine/iodine_http.c +68 -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: 5780b0bd483cbceaee368b8416a0fc6cdfc7fcf155f67eaa5715a3748790e032
|
|
4
|
+
data.tar.gz: 3191054adbffcac948151b9cb1367033819b3639ffc027bc052313bb216a7d20
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e07a2923d319c9e561216101dd59a31a13bb2a85f370e89d40718ed99fd1293990ecf033bd8ca23ccb65e1ea5395500529503a59d208a01c4d96a36cab90ee4
|
|
7
|
+
data.tar.gz: 2b57180029bf202fb8b825304b96e7f4307220576920c05e052b79ed2292d3780437ba7056876222bf33f3d120692794b182bab816f6c3ffedda2d3d987e3b38
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,17 @@ 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.1.0 (2026-03-04)
|
|
10
|
+
|
|
11
|
+
**Update**: Verify SSE connection are open before calling the protocol object
|
|
12
|
+
**Update**: Invert upgrade flow to move the upgrade decisions to the framework level
|
|
13
|
+
|
|
14
|
+
#### Change log v.5.0.0 (2026-02-25)
|
|
15
|
+
|
|
16
|
+
**Update**: Stop formatting SSE events
|
|
17
|
+
**Update**: Update accept header check for SSE
|
|
18
|
+
**Update**: Support fiber pauses during upgrades
|
|
19
|
+
|
|
9
20
|
#### Change log v.4.4.0 (2025-11-28)
|
|
10
21
|
|
|
11
22
|
**Update**: Update the `rackup` interface.
|
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
|
/* *****************************************************************************
|
|
@@ -235,15 +227,24 @@ static void iodine_sse_on_shutdown(http_sse_s *sse) {
|
|
|
235
227
|
Qnil);
|
|
236
228
|
}
|
|
237
229
|
static void iodine_sse_on_close(http_sse_s *sse) {
|
|
230
|
+
if (http_sse2uuid(sse) == -1) {
|
|
231
|
+
// Connection was already closed, skip silently
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
238
234
|
iodine_connection_fire_event((VALUE)sse->udata, IODINE_CONNECTION_ON_CLOSE,
|
|
239
235
|
Qnil);
|
|
240
236
|
}
|
|
241
237
|
|
|
242
238
|
static void iodine_sse_on_open(http_sse_s *sse) {
|
|
239
|
+
intptr_t uuid = http_sse2uuid(sse);
|
|
240
|
+
if (uuid == -1) {
|
|
241
|
+
// Connection was closed before on_open could fire, skip silently
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
243
244
|
VALUE h = (VALUE)sse->udata;
|
|
244
245
|
iodine_connection_s *c = iodine_connection_CData(h);
|
|
245
246
|
c->arg = sse;
|
|
246
|
-
c->uuid =
|
|
247
|
+
c->uuid = uuid;
|
|
247
248
|
iodine_connection_fire_event(h, IODINE_CONNECTION_ON_OPEN, Qnil);
|
|
248
249
|
sse->on_ready = iodine_sse_on_ready;
|
|
249
250
|
fio_force_event(c->uuid, FIO_EVENT_ON_READY);
|
|
@@ -323,18 +324,7 @@ static int iodine_copy2env_task(FIOBJ o, void *env_) {
|
|
|
323
324
|
static inline VALUE copy2env(iodine_http_request_handle_s *handle) {
|
|
324
325
|
VALUE env;
|
|
325
326
|
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
|
-
}
|
|
327
|
+
env = rb_hash_dup(env_template);
|
|
338
328
|
IodineStore.add(env);
|
|
339
329
|
|
|
340
330
|
fio_str_info_s tmp;
|
|
@@ -614,6 +604,8 @@ static inline int ruby2c_review_upgrade(iodine_http_request_handle_s *req,
|
|
|
614
604
|
VALUE rbresponse, VALUE env) {
|
|
615
605
|
http_s *h = req->h;
|
|
616
606
|
VALUE handler;
|
|
607
|
+
VALUE upgrade_type;
|
|
608
|
+
|
|
617
609
|
if ((handler = rb_hash_aref(env, IODINE_R_HIJACK_CB)) != Qnil) {
|
|
618
610
|
// send headers
|
|
619
611
|
http_finish(h);
|
|
@@ -627,37 +619,29 @@ static inline int ruby2c_review_upgrade(iodine_http_request_handle_s *req,
|
|
|
627
619
|
goto upgraded;
|
|
628
620
|
} else if ((handler = rb_hash_aref(env, UPGRADE_TCP)) != Qnil) {
|
|
629
621
|
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;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
handler = rb_hash_aref(env, RACK_UPGRADE);
|
|
625
|
+
if (handler == Qnil)
|
|
626
|
+
return 0;
|
|
627
|
+
|
|
628
|
+
upgrade_type = rb_hash_aref(env, RACK_UPGRADE_Q);
|
|
629
|
+
|
|
630
|
+
if (upgrade_type == RACK_UPGRADE_WEBSOCKET) {
|
|
631
|
+
iodine_ws_attach(h, handler, env);
|
|
632
|
+
goto upgraded;
|
|
633
|
+
} else if (upgrade_type == RACK_UPGRADE_SSE) {
|
|
634
|
+
iodine_sse_attach(h, handler, env);
|
|
635
|
+
goto upgraded;
|
|
636
|
+
} else if (RTEST(upgrade_type)) {
|
|
637
|
+
tcp_ip_upgrade : {
|
|
638
|
+
intptr_t uuid = http_hijack(h, NULL);
|
|
639
|
+
http_finish(h);
|
|
640
|
+
iodine_tcp_attch_uuid(uuid, handler);
|
|
641
|
+
goto upgraded;
|
|
659
642
|
}
|
|
660
643
|
}
|
|
644
|
+
|
|
661
645
|
return 0;
|
|
662
646
|
|
|
663
647
|
upgraded:
|
|
@@ -675,8 +659,8 @@ Handling HTTP requests
|
|
|
675
659
|
|
|
676
660
|
static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
677
661
|
iodine_http_request_handle_s *handle = handle_;
|
|
678
|
-
VALUE rbresponse =
|
|
679
|
-
VALUE env =
|
|
662
|
+
VALUE rbresponse = Qnil;
|
|
663
|
+
VALUE env = Qnil, tmp;
|
|
680
664
|
http_s *h = handle->h;
|
|
681
665
|
if (!h->udata)
|
|
682
666
|
goto err_not_found;
|
|
@@ -684,7 +668,6 @@ static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
|
684
668
|
if (handle->type == IODINE_HTTP_DEFERRED) {
|
|
685
669
|
rbresponse = rb_ivar_get((VALUE)h->fiber, fiber_result_var_id);
|
|
686
670
|
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
671
|
} else {
|
|
689
672
|
// create / register env variable
|
|
690
673
|
env = copy2env(handle);
|
|
@@ -704,7 +687,6 @@ static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
|
704
687
|
if (TYPE(tmp) == T_SYMBOL && tmp == http_wait_directive) {
|
|
705
688
|
VALUE fiber = rb_ary_entry(rbresponse, 1);
|
|
706
689
|
rb_ivar_set(fiber, iodine_env_var_id, env);
|
|
707
|
-
rb_ivar_set(fiber, iodine_upgrade_var_id, INT2FIX(handle->upgrade));
|
|
708
690
|
h->fiber = (void *)IodineStore.add(fiber);
|
|
709
691
|
goto defer;
|
|
710
692
|
}
|
|
@@ -748,7 +730,8 @@ static inline void *iodine_handle_request_in_GVL(void *handle_) {
|
|
|
748
730
|
// review each header and write it to the response.
|
|
749
731
|
rb_hash_foreach(response_headers, for_each_header_data, (VALUE)(h));
|
|
750
732
|
// review for upgrade.
|
|
751
|
-
if ((intptr_t)h->status < 300 &&
|
|
733
|
+
if ((intptr_t)h->status < 300 && env != Qnil &&
|
|
734
|
+
ruby2c_review_upgrade(handle, rbresponse, env))
|
|
752
735
|
goto external_done;
|
|
753
736
|
// send the request body.
|
|
754
737
|
if (ruby2c_response_send(handle, rbresponse, env))
|
|
@@ -832,7 +815,6 @@ iodine_perform_handle_action(iodine_http_request_handle_s handle) {
|
|
|
832
815
|
static inline void http_resume_deferred_request_handler(http_s *h) {
|
|
833
816
|
iodine_http_request_handle_s handle = (iodine_http_request_handle_s){
|
|
834
817
|
.h = h,
|
|
835
|
-
.upgrade = IODINE_UPGRADE_NONE,
|
|
836
818
|
.type = IODINE_HTTP_DEFERRED,
|
|
837
819
|
};
|
|
838
820
|
|
|
@@ -863,7 +845,6 @@ static inline void http_pause_request_handler(http_pause_handle_s *s) {
|
|
|
863
845
|
static void on_rack_request(http_s *h) {
|
|
864
846
|
iodine_http_request_handle_s handle = (iodine_http_request_handle_s){
|
|
865
847
|
.h = h,
|
|
866
|
-
.upgrade = IODINE_UPGRADE_NONE,
|
|
867
848
|
};
|
|
868
849
|
IodineCaller.enterGVL((void *(*)(void *))iodine_handle_request_in_GVL,
|
|
869
850
|
&handle);
|
|
@@ -875,38 +856,15 @@ static void on_rack_request(http_s *h) {
|
|
|
875
856
|
}
|
|
876
857
|
}
|
|
877
858
|
|
|
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
859
|
/* *****************************************************************************
|
|
902
860
|
Rack `env` Template Initialization
|
|
903
861
|
***************************************************************************** */
|
|
904
862
|
|
|
905
863
|
static void initialize_env_template(void) {
|
|
906
|
-
if (
|
|
864
|
+
if (env_template)
|
|
907
865
|
return;
|
|
908
|
-
|
|
909
|
-
IodineStore.add(
|
|
866
|
+
env_template = rb_hash_new();
|
|
867
|
+
IodineStore.add(env_template);
|
|
910
868
|
|
|
911
869
|
#define add_str_to_env(env, key, value) \
|
|
912
870
|
{ \
|
|
@@ -923,9 +881,9 @@ static void initialize_env_template(void) {
|
|
|
923
881
|
rb_hash_aset((env), k, value); \
|
|
924
882
|
}
|
|
925
883
|
|
|
926
|
-
/* Set global template */
|
|
927
|
-
rb_hash_aset(
|
|
928
|
-
rb_hash_aset(
|
|
884
|
+
/* Set global template - framework will set rack.upgrade? if it wants an upgrade */
|
|
885
|
+
rb_hash_aset(env_template, RACK_UPGRADE_Q, Qnil);
|
|
886
|
+
rb_hash_aset(env_template, RACK_UPGRADE, Qnil);
|
|
929
887
|
{
|
|
930
888
|
/* add the rack.version */
|
|
931
889
|
static VALUE rack_version = 0;
|
|
@@ -936,7 +894,7 @@ static void initialize_env_template(void) {
|
|
|
936
894
|
rb_global_variable(&rack_version);
|
|
937
895
|
rb_ary_freeze(rack_version);
|
|
938
896
|
}
|
|
939
|
-
add_value_to_env(
|
|
897
|
+
add_value_to_env(env_template, "rack.version", rack_version);
|
|
940
898
|
}
|
|
941
899
|
|
|
942
900
|
{
|
|
@@ -944,37 +902,27 @@ static void initialize_env_template(void) {
|
|
|
944
902
|
if (!sn || (sn[0] == '/' && sn[1] == 0)) {
|
|
945
903
|
sn = "";
|
|
946
904
|
}
|
|
947
|
-
add_str_to_env(
|
|
905
|
+
add_str_to_env(env_template, "SCRIPT_NAME", sn);
|
|
948
906
|
}
|
|
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(
|
|
907
|
+
rb_hash_aset(env_template, IODINE_R_INPUT, IODINE_R_INPUT_DEFAULT);
|
|
908
|
+
add_value_to_env(env_template, "rack.errors", rb_stderr);
|
|
909
|
+
add_value_to_env(env_template, "rack.hijack?", Qtrue);
|
|
910
|
+
add_value_to_env(env_template, "rack.multiprocess", Qtrue);
|
|
911
|
+
add_value_to_env(env_template, "rack.multithread", Qtrue);
|
|
912
|
+
add_value_to_env(env_template, "rack.run_once", Qfalse);
|
|
955
913
|
/* default schema to http, it might be updated later */
|
|
956
|
-
rb_hash_aset(
|
|
914
|
+
rb_hash_aset(env_template, R_URL_SCHEME, HTTP_SCHEME);
|
|
957
915
|
/* 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);
|
|
916
|
+
rb_hash_aset(env_template, HTTP_VERSION, QUERY_STRING);
|
|
917
|
+
rb_hash_aset(env_template, IODINE_R_HIJACK, QUERY_STRING);
|
|
918
|
+
rb_hash_aset(env_template, PATH_INFO, QUERY_STRING);
|
|
919
|
+
rb_hash_aset(env_template, QUERY_STRING, QUERY_STRING);
|
|
920
|
+
rb_hash_aset(env_template, REMOTE_ADDR, QUERY_STRING);
|
|
921
|
+
rb_hash_aset(env_template, REQUEST_METHOD, QUERY_STRING);
|
|
922
|
+
rb_hash_aset(env_template, SERVER_NAME, QUERY_STRING);
|
|
923
|
+
rb_hash_aset(env_template, SERVER_PROTOCOL, QUERY_STRING);
|
|
924
|
+
rb_hash_aset(env_template, IODINE_REQUEST_ID, QUERY_STRING);
|
|
925
|
+
rb_hash_aset(env_template, IODINE_HAS_BODY, QUERY_STRING);
|
|
978
926
|
|
|
979
927
|
#undef add_value_to_env
|
|
980
928
|
#undef add_str_to_env
|
|
@@ -1031,15 +979,15 @@ relevant to HTTP/1.x connections.
|
|
|
1031
979
|
intptr_t iodine_http_listen(iodine_connection_args_s args){
|
|
1032
980
|
// clang-format on
|
|
1033
981
|
if (args.public.data) {
|
|
1034
|
-
rb_hash_aset(
|
|
1035
|
-
rb_hash_aset(
|
|
982
|
+
rb_hash_aset(env_template, XSENDFILE_TYPE, XSENDFILE);
|
|
983
|
+
rb_hash_aset(env_template, XSENDFILE_TYPE_HEADER, XSENDFILE);
|
|
1036
984
|
support_xsendfile = 1;
|
|
1037
985
|
}
|
|
1038
986
|
IodineStore.add(args.handler);
|
|
1039
987
|
#ifdef __MINGW32__
|
|
1040
988
|
intptr_t uuid = http_listen(
|
|
1041
989
|
args.port.data, args.address.data, .on_request = on_rack_request,
|
|
1042
|
-
.
|
|
990
|
+
.udata = (void *)args.handler,
|
|
1043
991
|
.timeout = args.timeout, .ws_timeout = args.ping,
|
|
1044
992
|
.ws_max_msg_size = args.max_msg, .max_header_size = args.max_headers,
|
|
1045
993
|
.on_finish = free_iodine_http, .log = args.log, .max_clients = args.max_clients,
|
|
@@ -1047,7 +995,7 @@ intptr_t iodine_http_listen(iodine_connection_args_s args){
|
|
|
1047
995
|
#else
|
|
1048
996
|
intptr_t uuid = http_listen(
|
|
1049
997
|
args.port.data, args.address.data, .on_request = on_rack_request,
|
|
1050
|
-
.
|
|
998
|
+
.udata = (void *)args.handler,
|
|
1051
999
|
.tls = args.tls, .timeout = args.timeout, .ws_timeout = args.ping,
|
|
1052
1000
|
.ws_max_msg_size = args.max_msg, .max_header_size = args.max_headers,
|
|
1053
1001
|
.on_finish = free_iodine_http, .log = args.log, .max_clients = args.max_clients,
|
|
@@ -1257,7 +1205,6 @@ void iodine_init_http(void) {
|
|
|
1257
1205
|
http_wait_directive = ID2SYM(rb_intern("__http_defer__"));
|
|
1258
1206
|
fiber_id_method_id = rb_intern("__get_id");
|
|
1259
1207
|
iodine_env_var_id = rb_intern("@__iodine_env");
|
|
1260
|
-
iodine_upgrade_var_id = rb_intern("@__iodine_upgrade");
|
|
1261
1208
|
|
|
1262
1209
|
IodineUTF8Encoding = rb_enc_find("UTF-8");
|
|
1263
1210
|
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.1.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-04 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rake
|