iodine 0.7.54 → 0.7.56

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: 6bf1dc45230e4d64130055f60291bddd92144bc7c2349a8b10a8829d32f3c09c
4
- data.tar.gz: 858d92f6b21c05d6b38ee525822c986de2757e1a290f8164369012e60735b920
3
+ metadata.gz: e2f42cc055212f19560dc49734f4ab9b4e0be6382172d5b9e7eed59791b88381
4
+ data.tar.gz: 2addb1393f4689b6dd0ab826c43a7dc9b0942e42fdc1ced57b153a910ef6e621
5
5
  SHA512:
6
- metadata.gz: ebaf17fafa2997d5b2d06df4fbc9c537558e5f6a2464b16da3af20908fc6f3875d772ad81da393cb8bcba713bb359fb8918266060a9d80ee5ec07f04957732dd
7
- data.tar.gz: 7e87d6eaa475c5c39e0dfdb60ad8b45a3d095e7f8b702dacbdbc5acf8a7410caf86793415e482b8cb08b882ddc5678a90800697a8ce6a1c6cdece47cf7cecec1
6
+ metadata.gz: 26cad762bc6d533c7a1828550a371b7db6107fae7439d02176eb02b70bd8887c8a30f7b1c68b931b2088aee728c7e098bbdbf9eec1cefcac697d31ccaf8ebe09
7
+ data.tar.gz: 7582b83233ce7ef198cc9a1d561b738396b5fe6d0b1701ba3984ec164735b3d8ce3fe3973481772217f7d580ec8b070d0493550859abfe0cbe03a5b8c9b6a738
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ 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.56 (2023-07-07)
10
+
11
+ **Support**: Adds teapot support (HTTP code 418). Credit to Aleksandar N. Kostadinov (@akostadinov) for issue #144 and PR #145.
12
+
13
+ #### Change log v.0.7.55 (2023-05-01)
14
+
15
+ **Fix**: Fixes `X-SENDFILE` support so it works will `POST` requests. Credit to @fgoepel for PR #141.
16
+
9
17
  #### Change log v.0.7.54 (2023-03-15)
10
18
 
11
19
  **Fix**: Fixes verbosity option in iodine's CLI where the value `0` was ignored. Credit to @jsaak for opening issue #139.
data/ext/iodine/http.c CHANGED
@@ -565,6 +565,7 @@ found_file:
565
565
  http_finish(h);
566
566
  return 0;
567
567
  }
568
+ goto open_file;
568
569
  break;
569
570
  }
570
571
  http_send_error(h, 403);
@@ -2648,7 +2649,7 @@ static char invalid_cookie_value_char[256] = {
2648
2649
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
2649
2650
 
2650
2651
  // clang-format off
2651
- #define HTTP_SET_STATUS_STR(status, str) [status-100] = { .data = (char *)(str), .len = (sizeof(str) - 1) }
2652
+ #define HTTP_SET_STATUS_STR(status, str) [status-100] = { .data = (char *)(#status " " str), .len = (sizeof( #status " " str) - 1) }
2652
2653
  // clang-format on
2653
2654
 
2654
2655
  /** Returns the status as a C string struct */
@@ -2695,6 +2696,7 @@ fio_str_info_s http_status2str(uintptr_t status) {
2695
2696
  HTTP_SET_STATUS_STR(415, "Unsupported Media Type"),
2696
2697
  HTTP_SET_STATUS_STR(416, "Range Not Satisfiable"),
2697
2698
  HTTP_SET_STATUS_STR(417, "Expectation Failed"),
2699
+ HTTP_SET_STATUS_STR(418, "I'm a teapot"),
2698
2700
  HTTP_SET_STATUS_STR(421, "Misdirected Request"),
2699
2701
  HTTP_SET_STATUS_STR(422, "Unprocessable Entity"),
2700
2702
  HTTP_SET_STATUS_STR(423, "Locked"),
data/ext/iodine/http1.c CHANGED
@@ -45,8 +45,6 @@ inline static void h1_reset(http1pr_s *p) { p->header_size = 0; }
45
45
  #define http1_pr2handle(pr) (((http1pr_s *)(pr))->request)
46
46
  #define handle2pr(h) ((http1pr_s *)h->private_data.flag)
47
47
 
48
- static fio_str_info_s http1pr_status2str(uintptr_t status);
49
-
50
48
  /* cleanup an HTTP/1.1 handler object */
51
49
  static inline void http1_after_finish(http_s *h) {
52
50
  http1pr_s *p = handle2pr(h);
@@ -112,8 +110,10 @@ static FIOBJ headers2str(http_s *h, uintptr_t padding) {
112
110
  http1pr_s *p = handle2pr(h);
113
111
 
114
112
  if (p->is_client == 0) {
115
- fio_str_info_s t = http1pr_status2str(h->status);
113
+ fio_str_info_s t = http_status2str(h->status);
114
+ fiobj_str_write(w.dest, "HTTP/1.1 ", 9);
116
115
  fiobj_str_write(w.dest, t.data, t.len);
116
+ fiobj_str_write(w.dest, "\r\n", 2);
117
117
  FIOBJ tmp = fiobj_hash_get2(h->private_data.out_headers, connection_hash);
118
118
  if (tmp) {
119
119
  t = fiobj_obj2cstr(tmp);
@@ -823,90 +823,3 @@ void http1_destroy(fio_protocol_s *pr) {
823
823
  // *)p->p.uuid, (int)fio_uuid2fd(p->p.uuid), (void *)p);
824
824
  fio_free(p); // occasional Windows crash bug
825
825
  }
826
-
827
- /* *****************************************************************************
828
- Protocol Data
829
- ***************************************************************************** */
830
-
831
- // clang-format off
832
- #define HTTP_SET_STATUS_STR(status, str) [((status)-100)] = { .data = (char*)("HTTP/1.1 " #status " " str "\r\n"), .len = (sizeof("HTTP/1.1 " #status " " str "\r\n") - 1) }
833
- // #undef HTTP_SET_STATUS_STR
834
- // clang-format on
835
-
836
- static fio_str_info_s http1pr_status2str(uintptr_t status) {
837
- static fio_str_info_s status2str[] = {
838
- HTTP_SET_STATUS_STR(100, "Continue"),
839
- HTTP_SET_STATUS_STR(101, "Switching Protocols"),
840
- HTTP_SET_STATUS_STR(102, "Processing"),
841
- HTTP_SET_STATUS_STR(103, "Early Hints"),
842
- HTTP_SET_STATUS_STR(200, "OK"),
843
- HTTP_SET_STATUS_STR(201, "Created"),
844
- HTTP_SET_STATUS_STR(202, "Accepted"),
845
- HTTP_SET_STATUS_STR(203, "Non-Authoritative Information"),
846
- HTTP_SET_STATUS_STR(204, "No Content"),
847
- HTTP_SET_STATUS_STR(205, "Reset Content"),
848
- HTTP_SET_STATUS_STR(206, "Partial Content"),
849
- HTTP_SET_STATUS_STR(207, "Multi-Status"),
850
- HTTP_SET_STATUS_STR(208, "Already Reported"),
851
- HTTP_SET_STATUS_STR(226, "IM Used"),
852
- HTTP_SET_STATUS_STR(300, "Multiple Choices"),
853
- HTTP_SET_STATUS_STR(301, "Moved Permanently"),
854
- HTTP_SET_STATUS_STR(302, "Found"),
855
- HTTP_SET_STATUS_STR(303, "See Other"),
856
- HTTP_SET_STATUS_STR(304, "Not Modified"),
857
- HTTP_SET_STATUS_STR(305, "Use Proxy"),
858
- HTTP_SET_STATUS_STR(306, "(Unused), "),
859
- HTTP_SET_STATUS_STR(307, "Temporary Redirect"),
860
- HTTP_SET_STATUS_STR(308, "Permanent Redirect"),
861
- HTTP_SET_STATUS_STR(400, "Bad Request"),
862
- HTTP_SET_STATUS_STR(403, "Forbidden"),
863
- HTTP_SET_STATUS_STR(404, "Not Found"),
864
- HTTP_SET_STATUS_STR(401, "Unauthorized"),
865
- HTTP_SET_STATUS_STR(402, "Payment Required"),
866
- HTTP_SET_STATUS_STR(405, "Method Not Allowed"),
867
- HTTP_SET_STATUS_STR(406, "Not Acceptable"),
868
- HTTP_SET_STATUS_STR(407, "Proxy Authentication Required"),
869
- HTTP_SET_STATUS_STR(408, "Request Timeout"),
870
- HTTP_SET_STATUS_STR(409, "Conflict"),
871
- HTTP_SET_STATUS_STR(410, "Gone"),
872
- HTTP_SET_STATUS_STR(411, "Length Required"),
873
- HTTP_SET_STATUS_STR(412, "Precondition Failed"),
874
- HTTP_SET_STATUS_STR(413, "Payload Too Large"),
875
- HTTP_SET_STATUS_STR(414, "URI Too Long"),
876
- HTTP_SET_STATUS_STR(415, "Unsupported Media Type"),
877
- HTTP_SET_STATUS_STR(416, "Range Not Satisfiable"),
878
- HTTP_SET_STATUS_STR(417, "Expectation Failed"),
879
- HTTP_SET_STATUS_STR(421, "Misdirected Request"),
880
- HTTP_SET_STATUS_STR(422, "Unprocessable Entity"),
881
- HTTP_SET_STATUS_STR(423, "Locked"),
882
- HTTP_SET_STATUS_STR(424, "Failed Dependency"),
883
- HTTP_SET_STATUS_STR(425, "Unassigned"),
884
- HTTP_SET_STATUS_STR(426, "Upgrade Required"),
885
- HTTP_SET_STATUS_STR(427, "Unassigned"),
886
- HTTP_SET_STATUS_STR(428, "Precondition Required"),
887
- HTTP_SET_STATUS_STR(429, "Too Many Requests"),
888
- HTTP_SET_STATUS_STR(430, "Unassigned"),
889
- HTTP_SET_STATUS_STR(431, "Request Header Fields Too Large"),
890
- HTTP_SET_STATUS_STR(500, "Internal Server Error"),
891
- HTTP_SET_STATUS_STR(501, "Not Implemented"),
892
- HTTP_SET_STATUS_STR(502, "Bad Gateway"),
893
- HTTP_SET_STATUS_STR(503, "Service Unavailable"),
894
- HTTP_SET_STATUS_STR(504, "Gateway Timeout"),
895
- HTTP_SET_STATUS_STR(505, "HTTP Version Not Supported"),
896
- HTTP_SET_STATUS_STR(506, "Variant Also Negotiates"),
897
- HTTP_SET_STATUS_STR(507, "Insufficient Storage"),
898
- HTTP_SET_STATUS_STR(508, "Loop Detected"),
899
- HTTP_SET_STATUS_STR(509, "Unassigned"),
900
- HTTP_SET_STATUS_STR(510, "Not Extended"),
901
- HTTP_SET_STATUS_STR(511, "Network Authentication Required"),
902
- };
903
- fio_str_info_s ret = (fio_str_info_s){.len = 0, .data = NULL};
904
- if (status >= 100 &&
905
- (status - 100) < sizeof(status2str) / sizeof(status2str[0]))
906
- ret = status2str[status - 100];
907
- if (!ret.data) {
908
- ret = status2str[400];
909
- }
910
- return ret;
911
- }
912
- #undef HTTP_SET_STATUS_STR
@@ -42,7 +42,8 @@ void http_on_request_handler______internal(http_s *h,
42
42
  fiobj_hash_get2(h->headers, fiobj_obj2hash(HTTP_HEADER_ACCEPT)),
43
43
  HTTP_HVALUE_SSE_MIME))
44
44
  goto eventsource;
45
- if (settings->public_folder) {
45
+ if (settings->public_folder &&
46
+ (fiobj_obj2cstr(h->method).len != 4 || strncasecmp("post", fiobj_obj2cstr(h->method).data, 4))) {
46
47
  fio_str_info_s path_str = fiobj_obj2cstr(h->path);
47
48
  if (!http_sendfile2(h, settings->public_folder,
48
49
  settings->public_folder_length, path_str.data,
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.7.54'.freeze
2
+ VERSION = '0.7.56'.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.54
4
+ version: 0.7.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-15 00:00:00.000000000 Z
11
+ date: 2023-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -246,7 +246,7 @@ licenses:
246
246
  metadata:
247
247
  allowed_push_host: https://rubygems.org
248
248
  post_install_message: |-
249
- Thank you for installing Iodine 0.7.54.
249
+ Thank you for installing Iodine 0.7.56.
250
250
  Remember: if iodine supports your business, it's only fair to give value back (code contributions / donations).
251
251
  rdoc_options: []
252
252
  require_paths: