iodine 0.7.25 → 0.7.26

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of iodine might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78a87730fe356cbad1e97b0f8b236aa0d11922a5f4d9a2bc0dcd0b2d78ed76b9
4
- data.tar.gz: 78867a8cb0fa36d09a642e1bde58226e7bc1db8286890d2fa393021607e05319
3
+ metadata.gz: cef74e69c89b287a19db0fdfe5dfe4d54df7e33026d786832aebb6e431457efa
4
+ data.tar.gz: 86a85ce79660e0df9bcd56b66a6ebd5d1274e29f83bffc1f004acf7bd99bbfe4
5
5
  SHA512:
6
- metadata.gz: c300c420d934e36214360481db13975971934d34566c172e301b3f9432263bdbb1a8fe3fec0002dab56485749cc49519d940735ef21d545b0b83fa5bd5cd024e
7
- data.tar.gz: d38221c36a4a2c889d68e0992b8e1da0f62ad93a5114b4dc74953f72d5dd959bb71b82b3a28b2b2913b0251f983e8d30b5e0c7d4f9fb4b3e930f272e7424d9db
6
+ metadata.gz: b0d9c2b9730b802c9c085f820243ee20621ec845cde85411927a38661f903cf75792d143d163498bd5597c4301df38a881c123b604edee0bdfbe72b71bc2aab8
7
+ data.tar.gz: 16fd00d1387cf1aab22c58091abded717aca527b912dbdd7dc358eaec9d18a16b16919ad77177dc50d358c465c96af77dfa35433c95e1ad6ff67e585feb7b341
@@ -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.26
10
+
11
+ **Fix**: (`http`) fixed HTTP date format to force the day of the month to use two digits. Credit to @ianks (Ian Ker-Seymer) for exposing this issue (issue #64).
12
+
13
+ **Fix**: (`iodine`) fixed static file service without an application (when using iodine as a stand-alone static file server).
14
+
15
+ **Fix**: (`fio`) miscellaneous compatibility updates.
16
+
9
17
  #### Change log v.0.7.25
10
18
 
11
19
  **Fix**: (`iodine`) fixed host name binding when running `iodine` using `rackup` or through `Rack`. Credit to @adam12 (Adam Daniels) for PR #60.
data/exe/iodine CHANGED
@@ -37,6 +37,7 @@ module Iodine
37
37
  if Iodine::DEFAULT_SETTINGS[:public]
38
38
  puts " Running only static file service."
39
39
  opt = ::Rack::Server::Options.new.parse!([])
40
+ app = Proc.new { [404, {}, "Not Found!"] }
40
41
  else
41
42
  puts "\nERROR: Couldn't run Ruby application, check command line arguments."
42
43
  ARGV << "-?"
@@ -52,14 +52,6 @@ Feel free to copy, use and enjoy according to the license provided.
52
52
  #endif
53
53
  #endif
54
54
 
55
- #if FIO_ENGINE_EPOLL
56
- #include <sys/epoll.h>
57
-
58
- #elif FIO_ENGINE_KQUEUE
59
-
60
- #include <sys/event.h>
61
- #endif
62
-
63
55
  /* for kqueue and epoll only */
64
56
  #ifndef FIO_POLL_MAX_EVENTS
65
57
  #define FIO_POLL_MAX_EVENTS 64
@@ -90,6 +82,15 @@ Feel free to copy, use and enjoy according to the license provided.
90
82
  #define FIO_TLS_WEAK __attribute__((weak))
91
83
  #endif
92
84
 
85
+ /* Mitigates MAP_ANONYMOUS not being defined on older versions of MacOS */
86
+ #if !defined(MAP_ANONYMOUS)
87
+ #if defined(MAP_ANON)
88
+ #define MAP_ANONYMOUS MAP_ANON
89
+ #else
90
+ #define MAP_ANONYMOUS 0
91
+ #endif
92
+ #endif
93
+
93
94
  /* *****************************************************************************
94
95
  Event deferring (declarations)
95
96
  ***************************************************************************** */
@@ -1619,6 +1620,7 @@ Section Start Marker
1619
1620
 
1620
1621
  ***************************************************************************** */
1621
1622
  #if FIO_ENGINE_EPOLL
1623
+ #include <sys/epoll.h>
1622
1624
 
1623
1625
  /**
1624
1626
  * Returns a C string detailing the IO engine selected during compilation.
@@ -1779,6 +1781,7 @@ Section Start Marker
1779
1781
 
1780
1782
  ***************************************************************************** */
1781
1783
  #if FIO_ENGINE_KQUEUE
1784
+ #include <sys/event.h>
1782
1785
 
1783
1786
  /**
1784
1787
  * Returns a C string detailing the IO engine selected during compilation.
@@ -2318,8 +2321,11 @@ int fio_set_non_block(int fd) {
2318
2321
  int flags;
2319
2322
  if (-1 == (flags = fcntl(fd, F_GETFL, 0)))
2320
2323
  flags = 0;
2321
- // printf("flags initial value was %d\n", flags);
2324
+ #ifdef O_CLOEXEC
2322
2325
  return fcntl(fd, F_SETFL, flags | O_NONBLOCK | O_CLOEXEC);
2326
+ #else
2327
+ return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
2328
+ #endif
2323
2329
  #elif defined(FIONBIO)
2324
2330
  /* Otherwise, use the old way of doing it */
2325
2331
  static int flags = 1;
@@ -2591,13 +2597,10 @@ Internal socket flushing related functions
2591
2597
  #if !defined(USE_SENDFILE) && !defined(USE_SENDFILE_LINUX) && \
2592
2598
  !defined(USE_SENDFILE_BSD) && !defined(USE_SENDFILE_APPLE)
2593
2599
  #if defined(__linux__) /* linux sendfile works */
2594
- #include <sys/sendfile.h>
2595
2600
  #define USE_SENDFILE_LINUX 1
2596
2601
  #elif defined(__FreeBSD__) /* FreeBSD sendfile should work - not tested */
2597
- #include <sys/uio.h>
2598
2602
  #define USE_SENDFILE_BSD 1
2599
2603
  #elif defined(__APPLE__) /* Is the apple sendfile still broken? */
2600
- #include <sys/uio.h>
2601
2604
  #define USE_SENDFILE_APPLE 2
2602
2605
  #else /* sendfile might not be available - always set to 0 */
2603
2606
  #define USE_SENDFILE 0
@@ -2675,6 +2678,7 @@ read_error:
2675
2678
  }
2676
2679
 
2677
2680
  #if USE_SENDFILE_LINUX /* linux sendfile API */
2681
+ #include <sys/sendfile.h>
2678
2682
 
2679
2683
  static int fio_sock_sendfile_from_fd(int fd, fio_packet_s *packet) {
2680
2684
  ssize_t sent;
@@ -2688,7 +2692,8 @@ static int fio_sock_sendfile_from_fd(int fd, fio_packet_s *packet) {
2688
2692
  return sent;
2689
2693
  }
2690
2694
 
2691
- #elif USE_SENDFILE_LINUX_BSD || USE_SENDFILE_APPLE /* FreeBSD / Apple API */
2695
+ #elif USE_SENDFILE_BSD || USE_SENDFILE_APPLE /* FreeBSD / Apple API */
2696
+ #include <sys/uio.h>
2692
2697
 
2693
2698
  static int fio_sock_sendfile_from_fd(int fd, fio_packet_s *packet) {
2694
2699
  off_t act_sent = 0;
@@ -2717,7 +2722,7 @@ error:
2717
2722
  }
2718
2723
 
2719
2724
  #else
2720
- static int (*fio_sock_sendfile_from_fd)(int fd, struct packet_s *packet) =
2725
+ static int (*fio_sock_sendfile_from_fd)(int fd, fio_packet_s *packet) =
2721
2726
  fio_sock_write_from_fd;
2722
2727
 
2723
2728
  #endif
@@ -3533,7 +3538,8 @@ static void __attribute__((destructor)) fio_lib_destroy(void) {
3533
3538
  fio_free(fio_data);
3534
3539
  /* memory library destruction must be last */
3535
3540
  fio_mem_destroy();
3536
- FIO_LOG_DEBUG("(%d) facil.io resources released, exit complete.", getpid());
3541
+ FIO_LOG_DEBUG("(%d) facil.io resources released, exit complete.",
3542
+ (int)getpid());
3537
3543
  if (add_eol)
3538
3544
  fprintf(stderr, "\n"); /* add EOL to logs (logging adds EOL before text */
3539
3545
  }
@@ -3762,7 +3768,7 @@ static void fio_worker_startup(void) {
3762
3768
  fio_data->is_worker = 1;
3763
3769
  } else if (fio_data->is_worker) {
3764
3770
  /* Worker Process */
3765
- FIO_LOG_INFO("%d is running.", getpid());
3771
+ FIO_LOG_INFO("%d is running.", (int)getpid());
3766
3772
  } else {
3767
3773
  /* Root Process should run in single thread mode */
3768
3774
  fio_data->threads = 1;
@@ -3786,7 +3792,7 @@ static void fio_worker_startup(void) {
3786
3792
  static void fio_worker_cleanup(void) {
3787
3793
  /* switch to winding down */
3788
3794
  if (fio_data->is_worker)
3789
- FIO_LOG_INFO("(%d) detected exit signal.", getpid());
3795
+ FIO_LOG_INFO("(%d) detected exit signal.", (int)getpid());
3790
3796
  else
3791
3797
  FIO_LOG_INFO("Server Detected exit signal.");
3792
3798
  fio_state_callback_force(FIO_CALL_ON_SHUTDOWN);
@@ -3815,7 +3821,7 @@ static void fio_worker_cleanup(void) {
3815
3821
  if (fio_data->parent == getpid()) {
3816
3822
  FIO_LOG_INFO(" --- Shutdown Complete ---\n");
3817
3823
  } else {
3818
- FIO_LOG_INFO("(%d) cleanup complete.", getpid());
3824
+ FIO_LOG_INFO("(%d) cleanup complete.", (int)getpid());
3819
3825
  }
3820
3826
  }
3821
3827
 
@@ -3849,11 +3855,12 @@ static void *fio_sentinel_worker_thread(void *arg) {
3849
3855
  /* don't call any functions while forking. */
3850
3856
  fio_lock(&fio_fork_lock);
3851
3857
  if (!WIFEXITED(status) || WEXITSTATUS(status)) {
3852
- FIO_LOG_ERROR("Child worker (%d) crashed. Respawning worker.", child);
3858
+ FIO_LOG_ERROR("Child worker (%d) crashed. Respawning worker.",
3859
+ (int)child);
3853
3860
  fio_state_callback_force(FIO_CALL_ON_CHILD_CRUSH);
3854
3861
  } else {
3855
3862
  FIO_LOG_WARNING("Child worker (%d) shutdown. Respawning worker.",
3856
- child);
3863
+ (int)child);
3857
3864
  }
3858
3865
  fio_defer_push_task(fio_sentinel_task, NULL, NULL);
3859
3866
  fio_unlock(&fio_fork_lock);
@@ -3917,7 +3924,7 @@ void fio_start FIO_IGNORE_MACRO(struct fio_start_args args) {
3917
3924
  "* Press ^C to stop\n",
3918
3925
  fio_data->workers, fio_data->workers > 1 ? "workers" : "worker",
3919
3926
  fio_data->threads, fio_data->threads > 1 ? "threads" : "thread",
3920
- fio_engine(), fio_data->capa, fio_data->parent);
3927
+ fio_engine(), fio_data->capa, (int)fio_data->parent);
3921
3928
 
3922
3929
  if (args.workers > 1) {
3923
3930
  for (int i = 0; i < args.workers && fio_data->active; ++i) {
@@ -4496,9 +4503,9 @@ static void fio_listen_on_startup(void *pr_) {
4496
4503
  fio_listen_protocol_s *pr = pr_;
4497
4504
  fio_attach(pr->uuid, &pr->pr);
4498
4505
  if (pr->port_len)
4499
- FIO_LOG_DEBUG("(%d) started listening on port %s", getpid(), pr->port);
4506
+ FIO_LOG_DEBUG("(%d) started listening on port %s", (int)getpid(), pr->port);
4500
4507
  else
4501
- FIO_LOG_DEBUG("(%d) started listening on Unix Socket at %s", getpid(),
4508
+ FIO_LOG_DEBUG("(%d) started listening on Unix Socket at %s", (int)getpid(),
4502
4509
  pr->addr);
4503
4510
  }
4504
4511
 
@@ -5837,7 +5844,7 @@ static struct cluster_data_s {
5837
5844
  static void fio_cluster_data_cleanup(int delete_file) {
5838
5845
  if (delete_file && cluster_data.name[0]) {
5839
5846
  #if DEBUG
5840
- FIO_LOG_DEBUG("(%d) unlinking cluster's Unix socket.", getpid());
5847
+ FIO_LOG_DEBUG("(%d) unlinking cluster's Unix socket.", (int)getpid());
5841
5848
  #endif
5842
5849
  unlink(cluster_data.name);
5843
5850
  }
@@ -5886,7 +5893,7 @@ static void fio_cluster_init(void) {
5886
5893
  tmp_folder_len += 14;
5887
5894
  tmp_folder_len +=
5888
5895
  snprintf(cluster_data.name + tmp_folder_len,
5889
- FIO_CLUSTER_NAME_LIMIT - tmp_folder_len, "%d", getpid());
5896
+ FIO_CLUSTER_NAME_LIMIT - tmp_folder_len, "%d", (int)getpid());
5890
5897
  cluster_data.name[tmp_folder_len] = 0;
5891
5898
 
5892
5899
  /* remove if existing */
@@ -5931,7 +5938,7 @@ static void fio_cluster_on_data(intptr_t uuid, fio_protocol_s *pr_) {
5931
5938
  if (c->exp_channel) {
5932
5939
  if (c->exp_channel >= (1024 * 1024 * 16) + 1) {
5933
5940
  FIO_LOG_FATAL("(%d) cluster message name too long (16Mb limit): %u\n",
5934
- getpid(), (unsigned int)c->exp_channel);
5941
+ (int)getpid(), (unsigned int)c->exp_channel);
5935
5942
  exit(1);
5936
5943
  return;
5937
5944
  }
@@ -5939,7 +5946,7 @@ static void fio_cluster_on_data(intptr_t uuid, fio_protocol_s *pr_) {
5939
5946
  if (c->exp_msg) {
5940
5947
  if (c->exp_msg >= (1024 * 1024 * 64) + 1) {
5941
5948
  FIO_LOG_FATAL("(%d) cluster message data too long (64Mb limit): %u\n",
5942
- getpid(), (unsigned int)c->exp_msg);
5949
+ (int)getpid(), (unsigned int)c->exp_msg);
5943
5950
  exit(1);
5944
5951
  return;
5945
5952
  }
@@ -6021,7 +6028,7 @@ static void fio_cluster_on_close(intptr_t uuid, fio_protocol_s *pr_) {
6021
6028
  } else if (fio_data->active) {
6022
6029
  /* no shutdown message received - parent crashed. */
6023
6030
  if (c->type != FIO_CLUSTER_MSG_SHUTDOWN && fio_is_running()) {
6024
- FIO_LOG_FATAL("(%d) Parent Process crash detected!", getpid());
6031
+ FIO_LOG_FATAL("(%d) Parent Process crash detected!", (int)getpid());
6025
6032
  fio_state_callback_force(FIO_CALL_ON_PARENT_CRUSH);
6026
6033
  fio_state_callback_clear(FIO_CALL_ON_PARENT_CRUSH);
6027
6034
  fio_cluster_data_cleanup(1);
@@ -6184,7 +6191,8 @@ static void fio_cluster_listen_on_close(intptr_t uuid,
6184
6191
  cluster_data.uuid = -1;
6185
6192
  if (fio_parent_pid() == getpid()) {
6186
6193
  #if DEBUG
6187
- FIO_LOG_DEBUG("(%d) stopped listening for cluster connections", getpid());
6194
+ FIO_LOG_DEBUG("(%d) stopped listening for cluster connections",
6195
+ (int)getpid());
6188
6196
  #endif
6189
6197
  if (fio_data->active)
6190
6198
  kill(0, SIGINT);
@@ -6210,7 +6218,8 @@ static void fio_listen2cluster(void *ignore) {
6210
6218
  .ping = mock_ping_eternal,
6211
6219
  .on_close = fio_cluster_listen_on_close,
6212
6220
  };
6213
- FIO_LOG_DEBUG("(%d) Listening to cluster: %s", getpid(), cluster_data.name);
6221
+ FIO_LOG_DEBUG("(%d) Listening to cluster: %s", (int)getpid(),
6222
+ cluster_data.name);
6214
6223
  fio_attach(cluster_data.uuid, p);
6215
6224
  (void)ignore;
6216
6225
  }
@@ -6342,8 +6351,8 @@ static inline void fio_cluster_inform_root_about_channel(channel_s *ch,
6342
6351
  fio_str_info_s ch_name = {.data = ch->name, .len = ch->name_len};
6343
6352
  fio_str_info_s msg = {.data = NULL, .len = 0};
6344
6353
  #if DEBUG
6345
- FIO_LOG_DEBUG("(%d) informing root about: %s (%zu) msg type %d", getpid(),
6346
- ch_name.data, ch_name.len,
6354
+ FIO_LOG_DEBUG("(%d) informing root about: %s (%zu) msg type %d",
6355
+ (int)getpid(), ch_name.data, ch_name.len,
6347
6356
  (ch->match ? (add ? FIO_CLUSTER_MSG_PATTERN_SUB
6348
6357
  : FIO_CLUSTER_MSG_PATTERN_UNSUB)
6349
6358
  : (add ? FIO_CLUSTER_MSG_PUBSUB_SUB
@@ -7143,8 +7152,10 @@ static inline block_s *block_new(void) {
7143
7152
  }
7144
7153
  /* collect memory from the system */
7145
7154
  blk = sys_alloc(FIO_MEMORY_BLOCK_SIZE * FIO_MEMORY_BLOCKS_PER_ALLOCATION, 0);
7146
- if (!blk)
7155
+ if (!blk) {
7156
+ fio_unlock(&memory.lock);
7147
7157
  return NULL;
7158
+ }
7148
7159
  FIO_LOG_DEBUG("memory allocator allocated %p from the system", (void *)blk);
7149
7160
  FIO_MEMORY_ON_BLOCK_ALLOC();
7150
7161
  block_init_root(blk, blk);
@@ -9418,7 +9429,7 @@ FIO_FUNC void fio_socket_test(void) {
9418
9429
  #else
9419
9430
  fio_str_write(&sock_name, "/tmp", 4);
9420
9431
  #endif
9421
- fio_str_printf(&sock_name, "/fio_test_sock-%d.sock", getpid());
9432
+ fio_str_printf(&sock_name, "/fio_test_sock-%d.sock", (int)getpid());
9422
9433
 
9423
9434
  fprintf(stderr, "=== Testing facil.io listening socket creation (partial "
9424
9435
  "testing only).\n");
@@ -110,7 +110,7 @@ Version and helper macros
110
110
  #define FIO_VERSION_MAJOR 0
111
111
  #define FIO_VERSION_MINOR 7
112
112
  #define FIO_VERSION_PATCH 0
113
- #define FIO_VERSION_BETA 8
113
+ #define FIO_VERSION_BETA 9
114
114
 
115
115
  /* Automatically convert version data to a string constant - ignore these two */
116
116
  #define FIO_MACRO2STR_STEP2(macro) #macro
@@ -224,10 +224,16 @@ Version and helper macros
224
224
  #define __has_builtin(...) 0
225
225
  #define FIO_GNUC_BYPASS 1
226
226
  #elif !defined(__clang__) && !defined(__has_builtin)
227
+ /* E.g: GCC < 6.0 doesn't support __has_builtin */
227
228
  #define __has_builtin(...) 0
228
229
  #define FIO_GNUC_BYPASS 1
229
230
  #endif
230
231
 
232
+ #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
233
+ /* GCC < 4.5 doesn't support deprecation reason string */
234
+ #define deprecated(reason) deprecated
235
+ #endif
236
+
231
237
  #ifndef FIO_FUNC
232
238
  #define FIO_FUNC static __attribute__((unused))
233
239
  #endif
@@ -2022,7 +2028,8 @@ int fio_pubsub_is_attached(fio_pubsub_engine_s *engine);
2022
2028
  /* Select the correct compiler builtin method. */
2023
2029
  #elif __has_builtin(__sync_add_and_fetch)
2024
2030
  /** An atomic exchange operation, ruturns previous value */
2025
- #define fio_atomic_xchange(p_obj, value) __sync_fetch_and_or((p_obj), (value))
2031
+ #define fio_atomic_xchange(p_obj, value) \
2032
+ __sync_val_compare_and_swap((p_obj), *(p_obj), (value))
2026
2033
  /** An atomic addition operation */
2027
2034
  #define fio_atomic_add(p_obj, value) __sync_add_and_fetch((p_obj), (value))
2028
2035
  /** An atomic subtraction operation */
@@ -2030,7 +2037,8 @@ int fio_pubsub_is_attached(fio_pubsub_engine_s *engine);
2030
2037
 
2031
2038
  #elif __GNUC__ > 3
2032
2039
  /** An atomic exchange operation, ruturns previous value */
2033
- #define fio_atomic_xchange(p_obj, value) __sync_fetch_and_or((p_obj), (value))
2040
+ #define fio_atomic_xchange(p_obj, value) \
2041
+ __sync_val_compare_and_swap((p_obj), *(p_obj), (value))
2034
2042
  /** An atomic addition operation */
2035
2043
  #define fio_atomic_add(p_obj, value) __sync_add_and_fetch((p_obj), (value))
2036
2044
  /** An atomic subtraction operation */
@@ -378,7 +378,7 @@ Atomic reference counting
378
378
  __atomic_sub_fetch(&FIOBJECT2HEAD(o)->ref, 1, __ATOMIC_SEQ_CST)
379
379
 
380
380
  /* Select the correct compiler builtin method. */
381
- #elif defined(__has_builtin)
381
+ #elif defined(__has_builtin) && !FIO_GNUC_BYPASS
382
382
 
383
383
  #if __has_builtin(__sync_fetch_and_or)
384
384
  /** An atomic addition operation */
@@ -786,7 +786,7 @@ void hpack_test(void) {
786
786
  tmp = hpack_string_pack(buffer + buf_pos, limit - buf_pos, str1, 56,
787
787
  (i & 1) == 1);
788
788
  if (tmp == -1)
789
- fprintf(stderr, "* HPACK STRING PACKING FAIL AT %lu\n", i);
789
+ fprintf(stderr, "* HPACK STRING PACKING FAIL AT %zu\n", i);
790
790
  else if ((size_t)tmp > limit - buf_pos)
791
791
  break;
792
792
  buf_pos += tmp;
@@ -799,7 +799,7 @@ void hpack_test(void) {
799
799
  --i;
800
800
  tmp = hpack_string_unpack(result, 56, buffer, limit, &buf_pos);
801
801
  if (tmp == -1) {
802
- fprintf(stderr, "* HPACK STRING UNPACKING FAIL AT %lu\n",
802
+ fprintf(stderr, "* HPACK STRING UNPACKING FAIL AT %zu\n",
803
803
  (repeats - 1) - i);
804
804
  exit(-1);
805
805
  } else if (tmp != 56) {
@@ -811,13 +811,13 @@ void hpack_test(void) {
811
811
  }
812
812
  if (memcmp(str1, result, 56)) {
813
813
  fprintf(stderr,
814
- "* HPACK STRING UNPACKING ERROR AT %lu. Got (%u) %.*s\n",
814
+ "* HPACK STRING UNPACKING ERROR AT %zu. Got (%u) %.*s\n",
815
815
  (repeats - 1) - i, tmp, tmp, result);
816
816
  exit(-1);
817
817
  }
818
818
  }
819
819
  fprintf(stderr,
820
- "* HPACK string primitive test complete (buffer used %u/%zu "
820
+ "* HPACK string primitive test complete (buffer used %d/%zu "
821
821
  "strings)\n",
822
822
  count, repeats);
823
823
  }
@@ -18,6 +18,21 @@ Feel free to copy, use and enjoy according to the license provided.
18
18
  #include <sys/types.h>
19
19
  #include <unistd.h>
20
20
 
21
+ #ifndef HAVE_TM_TM_ZONE
22
+ #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
23
+ defined(__DragonFly__) || defined(__bsdi__) || defined(__ultrix) || \
24
+ (defined(__APPLE__) && defined(__MACH__)) || \
25
+ (defined(__sun) && !defined(__SVR4))
26
+ /* Known BSD systems */
27
+ #define HAVE_TM_TM_ZONE 1
28
+ #elif defined(__GLIBC__) && defined(_BSD_SOURCE)
29
+ /* GNU systems with _BSD_SOURCE */
30
+ #define HAVE_TM_TM_ZONE 1
31
+ #else
32
+ #define HAVE_TM_TM_ZONE 0
33
+ #endif
34
+ #endif
35
+
21
36
  /* *****************************************************************************
22
37
  SSL/TLS patch
23
38
  ***************************************************************************** */
@@ -2073,11 +2088,20 @@ struct tm *http_gmtime(time_t timer, struct tm *tmbuf) {
2073
2088
  if (timer < 0)
2074
2089
  return gmtime_r(&timer, tmbuf);
2075
2090
  ssize_t a, b;
2076
- tmbuf->tm_gmtoff = 0;
2077
- tmbuf->tm_zone = "UTC";
2078
- tmbuf->tm_isdst = 0;
2079
- tmbuf->tm_year = 70; // tm_year == The number of years since 1900
2080
- tmbuf->tm_mon = 0;
2091
+ #if HAVE_TM_TM_ZONE
2092
+ *tmbuf = (struct tm){
2093
+ .tm_isdst = 0,
2094
+ .tm_year = 70, // tm_year == The number of years since 1900
2095
+ .tm_mon = 0,
2096
+ .tm_zone = "UTC",
2097
+ };
2098
+ #else
2099
+ *tmbuf = (struct tm){
2100
+ .tm_isdst = 0,
2101
+ .tm_year = 70, // tm_year == The number of years since 1900
2102
+ .tm_mon = 0,
2103
+ };
2104
+ #endif
2081
2105
  // for seconds up to weekdays, we build up, as small values clean up
2082
2106
  // larger values.
2083
2107
  a = (ssize_t)timer;
@@ -2168,6 +2192,7 @@ static const char *MONTH_NAMES[] = {"Jan ", "Feb ", "Mar ", "Apr ",
2168
2192
  static const char *GMT_STR = "GMT";
2169
2193
 
2170
2194
  size_t http_date2str(char *target, struct tm *tmbuf) {
2195
+ /* note: day of month is always 2 digits */
2171
2196
  char *pos = target;
2172
2197
  uint16_t tmp;
2173
2198
  pos[0] = DAY_NAMES[tmbuf->tm_wday][0];
@@ -2176,15 +2201,10 @@ size_t http_date2str(char *target, struct tm *tmbuf) {
2176
2201
  pos[3] = ',';
2177
2202
  pos[4] = ' ';
2178
2203
  pos += 5;
2179
- if (tmbuf->tm_mday < 10) {
2180
- *pos = '0' + tmbuf->tm_mday;
2181
- ++pos;
2182
- } else {
2183
- tmp = tmbuf->tm_mday / 10;
2184
- pos[0] = '0' + tmp;
2185
- pos[1] = '0' + (tmbuf->tm_mday - (tmp * 10));
2186
- pos += 2;
2187
- }
2204
+ tmp = tmbuf->tm_mday / 10;
2205
+ pos[0] = '0' + tmp;
2206
+ pos[1] = '0' + (tmbuf->tm_mday - (tmp * 10));
2207
+ pos += 2;
2188
2208
  *(pos++) = ' ';
2189
2209
  pos[0] = MONTH_NAMES[tmbuf->tm_mon][0];
2190
2210
  pos[1] = MONTH_NAMES[tmbuf->tm_mon][1];
@@ -2216,6 +2236,7 @@ size_t http_date2str(char *target, struct tm *tmbuf) {
2216
2236
  }
2217
2237
 
2218
2238
  size_t http_date2rfc2822(char *target, struct tm *tmbuf) {
2239
+ /* note: day of month is either 1 or 2 digits */
2219
2240
  char *pos = target;
2220
2241
  uint16_t tmp;
2221
2242
  pos[0] = DAY_NAMES[tmbuf->tm_wday][0];
@@ -2263,7 +2284,9 @@ size_t http_date2rfc2822(char *target, struct tm *tmbuf) {
2263
2284
  return pos - target;
2264
2285
  }
2265
2286
 
2287
+ /* HTTP header format for Cookie ages */
2266
2288
  size_t http_date2rfc2109(char *target, struct tm *tmbuf) {
2289
+ /* note: day of month is always 2 digits */
2267
2290
  char *pos = target;
2268
2291
  uint16_t tmp;
2269
2292
  pos[0] = DAY_NAMES[tmbuf->tm_wday][0];
@@ -2272,15 +2295,10 @@ size_t http_date2rfc2109(char *target, struct tm *tmbuf) {
2272
2295
  pos[3] = ',';
2273
2296
  pos[4] = ' ';
2274
2297
  pos += 5;
2275
- if (tmbuf->tm_mday < 10) {
2276
- *pos = '0' + tmbuf->tm_mday;
2277
- ++pos;
2278
- } else {
2279
- tmp = tmbuf->tm_mday / 10;
2280
- pos[0] = '0' + tmp;
2281
- pos[1] = '0' + (tmbuf->tm_mday - (tmp * 10));
2282
- pos += 2;
2283
- }
2298
+ tmp = tmbuf->tm_mday / 10;
2299
+ pos[0] = '0' + tmp;
2300
+ pos[1] = '0' + (tmbuf->tm_mday - (tmp * 10));
2301
+ pos += 2;
2284
2302
  *(pos++) = ' ';
2285
2303
  pos[0] = MONTH_NAMES[tmbuf->tm_mon][0];
2286
2304
  pos[1] = MONTH_NAMES[tmbuf->tm_mon][1];
@@ -320,7 +320,7 @@ static void redis_send_next_command_unsafe(redis_engine_s *r) {
320
320
  FIO_LS_EMBD_OBJ(redis_commands_s, node, r->queue.next);
321
321
  fio_write2(r->pub_data.uuid, .data.buffer = cmd->cmd,
322
322
  .length = cmd->cmd_len, .after.dealloc = FIO_DEALLOC_NOOP);
323
- FIO_LOG_DEBUG("(redis %d) Sending (%zu bytes):\n%s\n", getpid(),
323
+ FIO_LOG_DEBUG("(redis %d) Sending (%zu bytes):\n%s\n", (int)getpid(),
324
324
  cmd->cmd_len, cmd->cmd);
325
325
  }
326
326
  }
@@ -352,7 +352,7 @@ static void resp_on_pub_message(struct redis_engine_internal_s *i, FIOBJ msg) {
352
352
  if (!node) {
353
353
  /* TODO: possible ping? from server?! not likely... */
354
354
  FIO_LOG_WARNING("(redis %d) received a reply when no command was sent.",
355
- getpid());
355
+ (int)getpid());
356
356
  return;
357
357
  }
358
358
  node->next = (void *)fiobj_dup(msg);
@@ -657,7 +657,7 @@ static void redis_on_publish_root(const fio_pubsub_engine_s *eng,
657
657
  *buf++ = '\r';
658
658
  *buf++ = '\n';
659
659
  *buf = 0;
660
- FIO_LOG_DEBUG("(%d) Publishing:\n%s", getpid(), cmd->cmd);
660
+ FIO_LOG_DEBUG("(%d) Publishing:\n%s", (int)getpid(), cmd->cmd);
661
661
  cmd->cmd_len = (uintptr_t)buf - (uintptr_t)(cmd + 1);
662
662
  redis_attach_cmd(r, cmd);
663
663
  return;
@@ -130,7 +130,7 @@ module Iodine
130
130
  end
131
131
  end
132
132
 
133
- ### trap some signals to avoid exception reports
133
+ ### trap some signals to avoid excessive exception reports
134
134
  begin
135
135
  old_sigint = Signal.trap("SIGINT") { old_sigint.call if old_sigint.respond_to?(:call) }
136
136
  rescue Exception
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.7.25'.freeze
2
+ VERSION = '0.7.26'.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.25
4
+ version: 0.7.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-22 00:00:00.000000000 Z
11
+ date: 2019-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -201,7 +201,7 @@ licenses:
201
201
  - MIT
202
202
  metadata:
203
203
  allowed_push_host: https://rubygems.org
204
- post_install_message: 'Thank you for installing Iodine 0.7.25.
204
+ post_install_message: 'Thank you for installing Iodine 0.7.26.
205
205
 
206
206
  '
207
207
  rdoc_options: []