iodine 0.7.47 → 0.7.48

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: 4aea7e9b88b263c0f7dc83f40923fe6e40ec0b6848b4a2ec7b6c5130de8ece48
4
- data.tar.gz: 7e8912f9b6e8db48cecf299a1dfe6d102be1df1a7197451dcba7514e37a0e3b5
3
+ metadata.gz: 1718fc25cba1ab9a96c643a16e34413067b30b6706659ca77becf907a92bafe6
4
+ data.tar.gz: 1b3fc0945e54e6eedf7e1fa27956cecfe46e80c8a43078f305343a9eb3497f50
5
5
  SHA512:
6
- metadata.gz: f859b4dcdf6daae8b3a0244b4ef4f99c2f3938d2c2280122b0a2a041e71cbaff072dcdd3544367b685f16d93b57da80f4d57a65a2ab212263e98711d5b8d32ab
7
- data.tar.gz: 1a8da92a2795cf3aeb00fa038605fda42eb5b967d502d578a7487ca6f36b0c81471565650012d8ec982bcc7eec1d1d9e1f01ff97e50e14b45b44cb457b1362fd
6
+ metadata.gz: 70945896acf5a4497254bd631bcc427bde4051813c65d44d43567c0283a40c61a1ecefa547985ee481981a21e4bcf4d3380076fbc5816eed2fdc06a487553e64
7
+ data.tar.gz: bfba77e38f598db62a893ad356ad40485a9dfc768355357bc8242227991ecf8c24354f2f30e52d3afcf1d8f1c62b0fec15c7a2baec309c5b29d6b042918ff259
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.48 (2022-06-28)
10
+
11
+ **Fix**: Fixes an issue with `pong` WebSocket frames when a client sends a WebSocket `ping`. Credit to Lucas Kuan (@lucaskuan) for finding this issue and for PR #124.
12
+
9
13
  #### Change log v.0.7.47 (2022-05-11)
10
14
 
11
15
  **Fix**: Fixes an issue that causes `Rack::Lint` to complain about `SERVER_PORT` being an empty string. Credit to @adam12 (Adam Daniels) for PR #108 and issue #107.
@@ -28,7 +28,8 @@ Feel free to copy, use and enjoy according to the license provided.
28
28
 
29
29
  #include <websocket_parser.h>
30
30
 
31
- #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) && !defined(__MINGW32__)
31
+ #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) && \
32
+ !defined(__MINGW32__)
32
33
  #include <endian.h>
33
34
  #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) && \
34
35
  __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
@@ -183,15 +184,19 @@ static void websocket_on_protocol_ping(void *ws_p, void *msg_, uint64_t len) {
183
184
  fio_write2(ws->fd, .data.buffer = buff, .length = len);
184
185
  } else {
185
186
  if (((ws_s *)ws)->is_client) {
186
- fio_write2(ws->fd, .data.buffer = "\x89\x80mask", .length = 2,
187
+ fio_write2(ws->fd, .data.buffer = "\x8a\x80mask", .length = 6,
187
188
  .after.dealloc = FIO_DEALLOC_NOOP);
188
189
  } else {
189
- fio_write2(ws->fd, .data.buffer = "\x89\x00", .length = 2,
190
+ fio_write2(ws->fd, .data.buffer = "\x8a\x00", .length = 2,
190
191
  .after.dealloc = FIO_DEALLOC_NOOP);
191
192
  }
192
193
  }
194
+ FIO_LOG_DEBUG("Received ping and sent pong for Websocket %p (%d)", ws_p,
195
+ (int)(((ws_s *)ws_p)->fd));
193
196
  }
194
197
  static void websocket_on_protocol_pong(void *ws_p, void *msg, uint64_t len) {
198
+ FIO_LOG_DEBUG("Received pong for Websocket %p (%d)", ws_p,
199
+ (int)(((ws_s *)ws_p)->fd));
195
200
  (void)len;
196
201
  (void)msg;
197
202
  (void)ws_p;
@@ -220,6 +225,7 @@ static void ws_ping(intptr_t fd, fio_protocol_s *ws) {
220
225
  fio_write2(fd, .data.buffer = "\x89\x00", .length = 2,
221
226
  .after.dealloc = FIO_DEALLOC_NOOP);
222
227
  }
228
+ FIO_LOG_DEBUG("Sent ping for Websocket %p (%d)", (void *)ws, (int)fd);
223
229
  }
224
230
 
225
231
  static void on_close(intptr_t uuid, fio_protocol_s *_ws) {
@@ -238,10 +244,10 @@ static uint8_t on_shutdown(intptr_t fd, fio_protocol_s *ws) {
238
244
  if (ws && ((ws_s *)ws)->on_shutdown)
239
245
  ((ws_s *)ws)->on_shutdown((ws_s *)ws);
240
246
  if (((ws_s *)ws)->is_client) {
241
- fio_write2(fd, .data.buffer = "\x8a\x80MASK", .length = 6,
247
+ fio_write2(fd, .data.buffer = "\x88\x80MASK", .length = 6,
242
248
  .after.dealloc = FIO_DEALLOC_NOOP);
243
249
  } else {
244
- fio_write2(fd, .data.buffer = "\x8a\x00", .length = 2,
250
+ fio_write2(fd, .data.buffer = "\x88\x00", .length = 2,
245
251
  .after.dealloc = FIO_DEALLOC_NOOP);
246
252
  }
247
253
  return 0;
@@ -728,8 +734,13 @@ int websocket_write(ws_s *ws, fio_str_info_s msg, uint8_t is_text) {
728
734
  }
729
735
  /** Closes a websocket connection. */
730
736
  void websocket_close(ws_s *ws) {
731
- fio_write2(ws->fd, .data.buffer = "\x88\x00", .length = 2,
732
- .after.dealloc = FIO_DEALLOC_NOOP);
737
+ if (ws->is_client) {
738
+ fio_write2(ws->fd, .data.buffer = "\x88\x80MASK", .length = 6,
739
+ .after.dealloc = FIO_DEALLOC_NOOP);
740
+ } else {
741
+ fio_write2(ws->fd, .data.buffer = "\x88\x00", .length = 2,
742
+ .after.dealloc = FIO_DEALLOC_NOOP);
743
+ }
733
744
  fio_close(ws->fd);
734
745
  return;
735
746
  }
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.7.47'.freeze
2
+ VERSION = '0.7.48'.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.47
4
+ version: 0.7.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-10 00:00:00.000000000 Z
11
+ date: 2022-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -245,7 +245,7 @@ licenses:
245
245
  metadata:
246
246
  allowed_push_host: https://rubygems.org
247
247
  post_install_message: |-
248
- Thank you for installing Iodine 0.7.47.
248
+ Thank you for installing Iodine 0.7.48.
249
249
  Remember: if iodine supports your business, it's only fair to give value back (code contributions / donations).
250
250
  rdoc_options: []
251
251
  require_paths: