iodine 0.7.55 → 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: 1c90d550606141837ea921c3f26de4948561b1000c1af434e7137475c27f2da8
4
- data.tar.gz: 70c8af63ff1508d717ca35cfa76afb320ff675168c26af87bd6b47217c870503
3
+ metadata.gz: e2f42cc055212f19560dc49734f4ab9b4e0be6382172d5b9e7eed59791b88381
4
+ data.tar.gz: 2addb1393f4689b6dd0ab826c43a7dc9b0942e42fdc1ced57b153a910ef6e621
5
5
  SHA512:
6
- metadata.gz: 575cae86c09a016b9ae0947a3e76004944c0d8895a802846843c8278bec44668ff8eaa16cb411496594070a2fe872b03d3d883e0cded8af560a39dd2c37678ef
7
- data.tar.gz: f74425c8a77d70f5d8937cda11f07e820388f0f17cb63a7fe2400b2339fd7e387dbba28847da1b7d29dd01640f05de20c4e79a825093162d73d65685ee2cac32
6
+ metadata.gz: 26cad762bc6d533c7a1828550a371b7db6107fae7439d02176eb02b70bd8887c8a30f7b1c68b931b2088aee728c7e098bbdbf9eec1cefcac697d31ccaf8ebe09
7
+ data.tar.gz: 7582b83233ce7ef198cc9a1d561b738396b5fe6d0b1701ba3984ec164735b3d8ce3fe3973481772217f7d580ec8b070d0493550859abfe0cbe03a5b8c9b6a738
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.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
+
9
13
  #### Change log v.0.7.55 (2023-05-01)
10
14
 
11
15
  **Fix**: Fixes `X-SENDFILE` support so it works will `POST` requests. Credit to @fgoepel for PR #141.
data/ext/iodine/http.c CHANGED
@@ -2649,7 +2649,7 @@ static char invalid_cookie_value_char[256] = {
2649
2649
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
2650
2650
 
2651
2651
  // clang-format off
2652
- #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) }
2653
2653
  // clang-format on
2654
2654
 
2655
2655
  /** Returns the status as a C string struct */
@@ -2696,6 +2696,7 @@ fio_str_info_s http_status2str(uintptr_t status) {
2696
2696
  HTTP_SET_STATUS_STR(415, "Unsupported Media Type"),
2697
2697
  HTTP_SET_STATUS_STR(416, "Range Not Satisfiable"),
2698
2698
  HTTP_SET_STATUS_STR(417, "Expectation Failed"),
2699
+ HTTP_SET_STATUS_STR(418, "I'm a teapot"),
2699
2700
  HTTP_SET_STATUS_STR(421, "Misdirected Request"),
2700
2701
  HTTP_SET_STATUS_STR(422, "Unprocessable Entity"),
2701
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
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.7.55'.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.55
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-05-01 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.55.
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: