rage-iodine 6.3.0 → 6.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bf4dfb83b39ffd7e2c88b535342d69b9ba6492dd80381e747c7f8909025b5c1
4
- data.tar.gz: 7d2e6bdafc532d94b296fb0743cfe832942421ecfa8ddab78a21f7f3e5c50f1e
3
+ metadata.gz: 209fcf94b4cec12ccef647a0463a2256919859ab012e724f89ef6bbb60aea7e7
4
+ data.tar.gz: c8ff6f19d0228ac11f485cc8b6c1edd85a132ae7a3ab94a8e7da8909ee103440
5
5
  SHA512:
6
- metadata.gz: 9989075b63db053de7dd6678cb317aef338c9150acfb88da70a8cf0d77f13acd1b6c5aff12cadf212a85534f84832fb9b2af71580f88eb5fcc1de065f2d3b015
7
- data.tar.gz: bd74de0e0b28d2b035cc3df029ea7930ef57221ab4a443d88df873421ce4634567cb7e2fb06cfaec9a3e878feacb0d70541c6710191855c73b6d55c6173daf10
6
+ metadata.gz: 02e9552071a7f52674c564595ce4e315ab41dc40b4b0a858d6a092e11ec69a4ed5a370e0ffda2028b2fdaa99217966da276425b8b9965faec58f12e75453a5a0
7
+ data.tar.gz: 1978be98f2912cde1b2c6a97483caee8118f795fcb3a22180b8a57c87e3138a31ed085dcd19d4589bb171f7bfd23d8fe649e1b3fc01f6f7907b00e86c7fe13db
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ Please notice that this change log contains changes for upcoming releases as wel
6
6
 
7
7
  ## Changes:
8
8
 
9
+ #### Change log v.6.4.0 (2026-10-29)
10
+
11
+ **Update**: Avoid disk writes for small chunked request bodies.
12
+
9
13
  #### Change log v.6.3.0 (2026-10-23)
10
14
 
11
15
  **Fix**: Fix `rack.input` buffer coderange
data/ext/iodine/http1.c CHANGED
@@ -656,15 +656,27 @@ static int http1_on_body_chunk(http1_parser_s *parser, char *data,
656
656
  http_send_error(&http1_pr2handle(parser2http(parser)), 413);
657
657
  return -1; /* test every time, in case of chunked data */
658
658
  }
659
+ FIOBJ *body = &http1_pr2handle(parser2http(parser)).body;
659
660
  if (!parser->state.read) {
660
- if (parser->state.content_length > 0 &&
661
- parser->state.content_length <= HTTP_MAX_HEADER_LENGTH) {
662
- http1_pr2handle(parser2http(parser)).body = fiobj_data_newstr();
663
- } else {
664
- http1_pr2handle(parser2http(parser)).body = fiobj_data_newtmpfile();
661
+ *body = fiobj_data_newstr();
662
+ }
663
+ /* Switch to a tmpfile once the body outgrows the threshold */
664
+ intptr_t len = fiobj_data_len(*body);
665
+ if (len <= HTTP_MAX_HEADER_LENGTH &&
666
+ len + (intptr_t)data_len > HTTP_MAX_HEADER_LENGTH) {
667
+ FIOBJ file = fiobj_data_newtmpfile();
668
+ if (!file) {
669
+ http_send_error(&http1_pr2handle(parser2http(parser)), 500);
670
+ return -1;
671
+ }
672
+ if (len) {
673
+ fio_str_info_s mem = fiobj_obj2cstr(*body);
674
+ fiobj_data_write(file, mem.data, mem.len);
665
675
  }
676
+ fiobj_free(*body);
677
+ *body = file;
666
678
  }
667
- fiobj_data_write(http1_pr2handle(parser2http(parser)).body, data, data_len);
679
+ fiobj_data_write(*body, data, data_len);
668
680
  return 0;
669
681
  }
670
682
 
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '6.3.0'.freeze
2
+ VERSION = '6.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rage-iodine
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0
4
+ version: 6.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev