iodine 0.7.26 → 0.7.27

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: cef74e69c89b287a19db0fdfe5dfe4d54df7e33026d786832aebb6e431457efa
4
- data.tar.gz: 86a85ce79660e0df9bcd56b66a6ebd5d1274e29f83bffc1f004acf7bd99bbfe4
3
+ metadata.gz: 271062484b7941686926625d08f09463c7f723a94c9a43b1ef9a3b85c2b0e2e2
4
+ data.tar.gz: 7914c3a6e093c53bc2ff78ed1f6bc0f376d5dcb69bb2086187238fc9666894eb
5
5
  SHA512:
6
- metadata.gz: b0d9c2b9730b802c9c085f820243ee20621ec845cde85411927a38661f903cf75792d143d163498bd5597c4301df38a881c123b604edee0bdfbe72b71bc2aab8
7
- data.tar.gz: 16fd00d1387cf1aab22c58091abded717aca527b912dbdd7dc358eaec9d18a16b16919ad77177dc50d358c465c96af77dfa35433c95e1ad6ff67e585feb7b341
6
+ metadata.gz: 9ef504553715d08e8152e2a5195368965bdb71c9d6d52157a4796c58cb5533527008d29fa7fb03788df89f3a3c80db4210b4721b062291f0993529aae26f1347
7
+ data.tar.gz: f7afb8f4c3a0fbe19e396798f917d2c3d039d8ff318b43be2c059b73ec8cb079c80f1d4daa777aafc7206360aee2373d767c3e1089676ffbc70226c6b294681f
data/.gitignore CHANGED
@@ -15,3 +15,5 @@
15
15
  .clang_complete
16
16
 
17
17
  .DS_Store
18
+ spec/examples.txt
19
+ spec/log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --color
@@ -20,20 +20,11 @@ addons:
20
20
  sources:
21
21
  - ubuntu-toolchain-r-test
22
22
  packages:
23
- - gcc-4.9
24
- - gcc-5
25
- - clang
23
+ - gcc
26
24
  script:
27
25
  - echo CFLAGS = $CFLAGS
28
26
  - echo cflags = $cflags
29
27
  - gem uninstall -x iodine
30
28
  - rake build
31
29
  - find pkg/iodine-*.gem -exec gem install -V {} +
32
- - gem uninstall -x iodine
33
- - export CFLAGS="-std=c99"
34
- - export CC=gcc
35
- - find pkg/iodine-*.gem -exec gem install -V {} +
36
- - gem uninstall -x iodine
37
- - export CFLAGS="-Wall"
38
- - export CC="gcc-5"
39
- - find pkg/iodine-*.gem -exec gem install -V {} +
30
+ - bundle exec rspec --format documentation
@@ -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.27
10
+
11
+ **Compatibility**: (`iodine`) fixed the HTTP request `SCRIPT_NAME` variable (in the Rack `env`) to default to the global environment variable `SCRIPT_NAME` when `SCRIPT_NAME` isn't root (`/`). Credit to @thexa4 (Max Maton) for exposing this compatibility concern (issue #68).
12
+
9
13
  #### Change log v.0.7.26
10
14
 
11
15
  **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).
data/Gemfile CHANGED
@@ -1,4 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ group :test do
4
+ gem 'pry'
5
+ gem 'rspec'
6
+ gem 'rack'
7
+ gem 'http'
8
+ end
9
+
3
10
  # Specify your gem's dependencies in iodine.gemspec
4
11
  gemspec
@@ -1397,17 +1397,20 @@ static void sig_int_handler(int sig) {
1397
1397
  old = &fio_old_sig_usr1;
1398
1398
  break;
1399
1399
  #endif
1400
- case SIGINT: /* fallthrough */
1400
+ /* fallthrough */
1401
+ case SIGINT:
1401
1402
  if (!old)
1402
1403
  old = &fio_old_sig_int;
1403
- case SIGTERM: /* fallthrough */
1404
+ /* fallthrough */
1405
+ case SIGTERM:
1404
1406
  if (!old)
1405
1407
  old = &fio_old_sig_term;
1406
1408
  fio_stop();
1407
1409
  break;
1408
- case SIGPIPE: /* fallthrough */
1410
+ case SIGPIPE:
1409
1411
  if (!old)
1410
1412
  old = &fio_old_sig_pipe;
1413
+ /* fallthrough */
1411
1414
  default:
1412
1415
  break;
1413
1416
  }
@@ -3005,23 +3008,23 @@ flush_rw_hook:
3005
3008
  test_errno:
3006
3009
  fio_unlock(&uuid_data(uuid).sock_lock);
3007
3010
  switch (errno) {
3008
- case EWOULDBLOCK: /* ovreflow */
3011
+ case EWOULDBLOCK: /* fallthrough */
3009
3012
  #if EWOULDBLOCK != EAGAIN
3010
- case EAGAIN: /* ovreflow */
3013
+ case EAGAIN: /* fallthrough */
3011
3014
  #endif
3012
- case ENOTCONN: /* ovreflow */
3013
- case EINPROGRESS: /* ovreflow */
3014
- case ENOSPC: /* ovreflow */
3015
- case EADDRNOTAVAIL: /* ovreflow */
3015
+ case ENOTCONN: /* fallthrough */
3016
+ case EINPROGRESS: /* fallthrough */
3017
+ case ENOSPC: /* fallthrough */
3018
+ case EADDRNOTAVAIL: /* fallthrough */
3016
3019
  case EINTR:
3017
3020
  return 1;
3018
3021
  case EFAULT:
3019
3022
  FIO_LOG_ERROR("fio_flush EFAULT - possible memory address error sent to "
3020
3023
  "Unix socket.");
3021
- /* ovreflow */
3022
- case EPIPE: /* ovreflow */
3023
- case EIO: /* ovreflow */
3024
- case EINVAL: /* ovreflow */
3024
+ /* fallthrough */
3025
+ case EPIPE: /* fallthrough */
3026
+ case EIO: /* fallthrough */
3027
+ case EINVAL: /* fallthrough */
3025
3028
  case EBADF:
3026
3029
  uuid_data(uuid).close = 1;
3027
3030
  fio_force_close(uuid);
@@ -3362,13 +3365,13 @@ void fio_state_callback_force(callback_type_e c_type) {
3362
3365
  fio_lock(&callback_collection[c_type].lock);
3363
3366
  fio_state_callback_ensure(&callback_collection[c_type]);
3364
3367
  switch (c_type) { /* the difference between `unshift` and `push` */
3365
- case FIO_CALL_ON_INITIALIZE: /* overflow */
3366
- case FIO_CALL_PRE_START: /* overflow */
3367
- case FIO_CALL_BEFORE_FORK: /* overflow */
3368
- case FIO_CALL_AFTER_FORK: /* overflow */
3369
- case FIO_CALL_IN_CHILD: /* overflow */
3370
- case FIO_CALL_IN_MASTER: /* overflow */
3371
- case FIO_CALL_ON_START: /* overflow */
3368
+ case FIO_CALL_ON_INITIALIZE: /* fallthrough */
3369
+ case FIO_CALL_PRE_START: /* fallthrough */
3370
+ case FIO_CALL_BEFORE_FORK: /* fallthrough */
3371
+ case FIO_CALL_AFTER_FORK: /* fallthrough */
3372
+ case FIO_CALL_IN_CHILD: /* fallthrough */
3373
+ case FIO_CALL_IN_MASTER: /* fallthrough */
3374
+ case FIO_CALL_ON_START: /* fallthrough */
3372
3375
  FIO_LS_EMBD_FOR(&callback_collection[c_type].callbacks, pos) {
3373
3376
  callback_data_s *tmp = fio_malloc(sizeof(*tmp));
3374
3377
  FIO_ASSERT_ALLOC(tmp);
@@ -3385,12 +3388,12 @@ void fio_state_callback_force(callback_type_e c_type) {
3385
3388
  }
3386
3389
  break;
3387
3390
 
3388
- case FIO_CALL_ON_SHUTDOWN: /* overflow */
3389
- case FIO_CALL_ON_FINISH: /* overflow */
3390
- case FIO_CALL_ON_PARENT_CRUSH: /* overflow */
3391
- case FIO_CALL_ON_CHILD_CRUSH: /* overflow */
3392
- case FIO_CALL_AT_EXIT: /* overflow */
3393
- case FIO_CALL_NEVER: /* overflow */
3391
+ case FIO_CALL_ON_SHUTDOWN: /* fallthrough */
3392
+ case FIO_CALL_ON_FINISH: /* fallthrough */
3393
+ case FIO_CALL_ON_PARENT_CRUSH: /* fallthrough */
3394
+ case FIO_CALL_ON_CHILD_CRUSH: /* fallthrough */
3395
+ case FIO_CALL_AT_EXIT: /* fallthrough */
3396
+ case FIO_CALL_NEVER: /* fallthrough */
3394
3397
  default:
3395
3398
  FIO_LS_EMBD_FOR(&callback_collection[c_type].callbacks, pos) {
3396
3399
  callback_data_s *tmp = fio_malloc(sizeof(*tmp));
@@ -4148,7 +4151,7 @@ size_t fio_ltoa(char *dest, int64_t num, uint8_t base) {
4148
4151
  goto zero;
4149
4152
 
4150
4153
  switch (base) {
4151
- case 1:
4154
+ case 1: /* fallthrough */
4152
4155
  case 2:
4153
4156
  /* Base 2 */
4154
4157
  {
@@ -4224,12 +4227,12 @@ size_t fio_ltoa(char *dest, int64_t num, uint8_t base) {
4224
4227
  dest[len] = 0;
4225
4228
  return len;
4226
4229
  }
4227
- case 3:
4228
- case 4:
4229
- case 5:
4230
- case 6:
4231
- case 7:
4232
- case 9:
4230
+ case 3: /* fallthrough */
4231
+ case 4: /* fallthrough */
4232
+ case 5: /* fallthrough */
4233
+ case 6: /* fallthrough */
4234
+ case 7: /* fallthrough */
4235
+ case 9: /* fallthrough */
4233
4236
  /* rare bases */
4234
4237
  if (num < 0) {
4235
4238
  dest[len++] = '-';
@@ -6655,7 +6658,7 @@ static int fio_glob_match(fio_str_info_s pat, fio_str_info_s ch) {
6655
6658
  case '\\':
6656
6659
  d = *(uint8_t *)pat.data++;
6657
6660
  pat.len--;
6658
- /* FALLTHROUGH */
6661
+ /* fallthrough */
6659
6662
  default: /* Literal character */
6660
6663
  if (c == d)
6661
6664
  break;
@@ -7494,10 +7497,12 @@ void fio_rand_bytes(void *data_, size_t len) {
7494
7497
  case 24:
7495
7498
  tmp = fio_rand64();
7496
7499
  fio_u2str64(data + 16, tmp);
7497
- case 16: /* overflow */
7500
+ /* fallthrough */
7501
+ case 16:
7498
7502
  tmp = fio_rand64();
7499
7503
  fio_u2str64(data + 8, tmp);
7500
- case 8: /* overflow */
7504
+ /* fallthrough */
7505
+ case 8:
7501
7506
  tmp = fio_rand64();
7502
7507
  fio_u2str64(data, tmp);
7503
7508
  data += len & 24;
@@ -7506,19 +7511,25 @@ void fio_rand_bytes(void *data_, size_t len) {
7506
7511
  tmp = fio_rand64();
7507
7512
  /* leftover bytes */
7508
7513
  switch ((len & 7)) {
7509
- case 7: /* overflow */
7514
+ case 7:
7510
7515
  data[6] = (tmp >> 8) & 0xFF;
7511
- case 6: /* overflow */
7516
+ /* fallthrough */
7517
+ case 6:
7512
7518
  data[5] = (tmp >> 16) & 0xFF;
7513
- case 5: /* overflow */
7519
+ /* fallthrough */
7520
+ case 5:
7514
7521
  data[4] = (tmp >> 24) & 0xFF;
7515
- case 4: /* overflow */
7522
+ /* fallthrough */
7523
+ case 4:
7516
7524
  data[3] = (tmp >> 32) & 0xFF;
7517
- case 3: /* overflow */
7525
+ /* fallthrough */
7526
+ case 3:
7518
7527
  data[2] = (tmp >> 40) & 0xFF;
7519
- case 2: /* overflow */
7528
+ /* fallthrough */
7529
+ case 2:
7520
7530
  data[1] = (tmp >> 48) & 0xFF;
7521
- case 1: /* overflow */
7531
+ /* fallthrough */
7532
+ case 1:
7522
7533
  data[0] = (tmp >> 56) & 0xFF;
7523
7534
  }
7524
7535
  }
@@ -2288,14 +2288,14 @@ FIO_FUNC inline uintptr_t fio_ct_if2(uintptr_t cond, uintptr_t a, uintptr_t b) {
2288
2288
  /** Writes a local 64 bit number to an unaligned buffer in network order. */
2289
2289
  #define fio_u2str64(buffer, i) \
2290
2290
  do { \
2291
- ((uint8_t *)(buffer))[0] = ((uint64_t)(i) >> 56) & 0xFF; \
2292
- ((uint8_t *)(buffer))[1] = ((uint64_t)(i) >> 48) & 0xFF; \
2293
- ((uint8_t *)(buffer))[2] = ((uint64_t)(i) >> 40) & 0xFF; \
2294
- ((uint8_t *)(buffer))[3] = ((uint64_t)(i) >> 32) & 0xFF; \
2295
- ((uint8_t *)(buffer))[4] = ((uint64_t)(i) >> 24) & 0xFF; \
2296
- ((uint8_t *)(buffer))[5] = ((uint64_t)(i) >> 16) & 0xFF; \
2297
- ((uint8_t *)(buffer))[6] = ((uint64_t)(i) >> 8) & 0xFF; \
2298
- ((uint8_t *)(buffer))[7] = ((uint64_t)(i)) & 0xFF; \
2291
+ ((uint8_t *)(buffer))[0] = (((uint64_t)(i) >> 56) & 0xFF); \
2292
+ ((uint8_t *)(buffer))[1] = (((uint64_t)(i) >> 48) & 0xFF); \
2293
+ ((uint8_t *)(buffer))[2] = (((uint64_t)(i) >> 40) & 0xFF); \
2294
+ ((uint8_t *)(buffer))[3] = (((uint64_t)(i) >> 32) & 0xFF); \
2295
+ ((uint8_t *)(buffer))[4] = (((uint64_t)(i) >> 24) & 0xFF); \
2296
+ ((uint8_t *)(buffer))[5] = (((uint64_t)(i) >> 16) & 0xFF); \
2297
+ ((uint8_t *)(buffer))[6] = (((uint64_t)(i) >> 8) & 0xFF); \
2298
+ ((uint8_t *)(buffer))[7] = (((uint64_t)(i)) & 0xFF); \
2299
2299
  } while (0);
2300
2300
 
2301
2301
  /* *****************************************************************************
@@ -2478,9 +2478,11 @@ FIO_FUNC inline uint64_t fio_risky_hash(const void *data_, size_t len,
2478
2478
  switch (len & 24) {
2479
2479
  case 24:
2480
2480
  fio_risky_consume(v2, fio_str2u64(data + 16));
2481
- case 16: /* overflow */
2481
+ /* fallthrough */
2482
+ case 16:
2482
2483
  fio_risky_consume(v1, fio_str2u64(data + 8));
2483
- case 8: /* overflow */
2484
+ /* fallthrough */
2485
+ case 8:
2484
2486
  fio_risky_consume(v0, fio_str2u64(data));
2485
2487
  data += len & 24;
2486
2488
  }
@@ -2488,19 +2490,25 @@ FIO_FUNC inline uint64_t fio_risky_hash(const void *data_, size_t len,
2488
2490
  uint64_t tmp = 0;
2489
2491
  /* consume leftover bytes, if any */
2490
2492
  switch ((len & 7)) {
2491
- case 7: /* overflow */
2493
+ case 7:
2492
2494
  tmp |= ((uint64_t)data[6]) << 8;
2493
- case 6: /* overflow */
2495
+ /* fallthrough */
2496
+ case 6:
2494
2497
  tmp |= ((uint64_t)data[5]) << 16;
2495
- case 5: /* overflow */
2498
+ /* fallthrough */
2499
+ case 5:
2496
2500
  tmp |= ((uint64_t)data[4]) << 24;
2497
- case 4: /* overflow */
2501
+ /* fallthrough */
2502
+ case 4:
2498
2503
  tmp |= ((uint64_t)data[3]) << 32;
2499
- case 3: /* overflow */
2504
+ /* fallthrough */
2505
+ case 3:
2500
2506
  tmp |= ((uint64_t)data[2]) << 40;
2501
- case 2: /* overflow */
2507
+ /* fallthrough */
2508
+ case 2:
2502
2509
  tmp |= ((uint64_t)data[1]) << 48;
2503
- case 1: /* overflow */
2510
+ /* fallthrough */
2511
+ case 1:
2504
2512
  tmp |= ((uint64_t)data[0]) << 56;
2505
2513
  /* ((len >> 3) & 3) is a 0...3 value indicating consumption vector */
2506
2514
  switch ((len >> 3) & 3) {
@@ -156,7 +156,8 @@ static void fio_cli_set_arg(cstr_s arg, char const *value, char const *line,
156
156
  goto error;
157
157
  }
158
158
  }
159
- case FIO_CLI_STRING__TYPE_I: /* fallthrough */
159
+ /* fallthrough */
160
+ case FIO_CLI_STRING__TYPE_I:
160
161
  if (!value)
161
162
  goto error;
162
163
  if (!value[0])
@@ -202,11 +203,11 @@ print_help:
202
203
  char const **pos = parser->names;
203
204
  while (*pos) {
204
205
  switch ((intptr_t)*pos) {
205
- case FIO_CLI_STRING__TYPE_I: /* fallthrough */
206
- case FIO_CLI_BOOL__TYPE_I: /* fallthrough */
207
- case FIO_CLI_INT__TYPE_I: /* fallthrough */
208
- case FIO_CLI_PRINT__TYPE_I: /* fallthrough */
209
- case FIO_CLI_PRINT_HEADER__TYPE_I: /* fallthrough */
206
+ case FIO_CLI_STRING__TYPE_I: /* fallthrough */
207
+ case FIO_CLI_BOOL__TYPE_I: /* fallthrough */
208
+ case FIO_CLI_INT__TYPE_I: /* fallthrough */
209
+ case FIO_CLI_PRINT__TYPE_I: /* fallthrough */
210
+ case FIO_CLI_PRINT_HEADER__TYPE_I:
210
211
  ++pos;
211
212
  continue;
212
213
  }
@@ -108,7 +108,7 @@ size_t __attribute__((weak)) fio_ltoa(char *dest, int64_t num, uint8_t base) {
108
108
  goto zero;
109
109
 
110
110
  switch (base) {
111
- case 1:
111
+ case 1: /* fallthrough */
112
112
  case 2:
113
113
  /* Base 2 */
114
114
  {
@@ -184,12 +184,12 @@ size_t __attribute__((weak)) fio_ltoa(char *dest, int64_t num, uint8_t base) {
184
184
  dest[len] = 0;
185
185
  return len;
186
186
  }
187
- case 3:
188
- case 4:
189
- case 5:
190
- case 6:
191
- case 7:
192
- case 9:
187
+ case 3: /* fallthrough */
188
+ case 4: /* fallthrough */
189
+ case 5: /* fallthrough */
190
+ case 6: /* fallthrough */
191
+ case 7: /* fallthrough */
192
+ case 9: /* fallthrough */
193
193
  /* rare bases */
194
194
  if (num < 0) {
195
195
  dest[len++] = '-';
@@ -232,10 +232,11 @@ size_t __attribute__((weak)) fio_ltoa(char *dest, int64_t num, uint8_t base) {
232
232
 
233
233
  zero:
234
234
  switch (base) {
235
- case 1:
235
+ case 1: /* fallthrough */
236
236
  case 2:
237
237
  dest[len++] = '0';
238
238
  dest[len++] = 'b';
239
+ /* fallthrough */
239
240
  case 16:
240
241
  dest[len++] = '0';
241
242
  dest[len++] = 'x';
@@ -113,14 +113,14 @@ typedef const struct {
113
113
  const uint32_t code;
114
114
  const uint8_t bits;
115
115
  } huffman_encode_s;
116
- static const huffman_encode_s huffman_encode_table[];
116
+ static const huffman_encode_s huffman_encode_table[257];
117
117
 
118
118
  /* the huffman decoding binary tree type */
119
119
  typedef struct {
120
120
  const int16_t value; // value, -1 == none.
121
121
  const uint8_t offset[2]; // offset for 0 and one. 0 == leaf node.
122
122
  } huffman_decode_s;
123
- static const huffman_decode_s huffman_decode_tree[];
123
+ static const huffman_decode_s huffman_decode_tree[513];
124
124
 
125
125
  /**
126
126
  * Unpack (de-compress) using HPACK huffman - returns the number of bytes
@@ -388,11 +388,11 @@ static MAYBE_UNUSED int hpack_huffman_pack(void *dest_, const int limit,
388
388
  switch (bits >> 3) {
389
389
  case 3:
390
390
  dest[comp_len + 2] = (uint8_t)(code >> 8) & 0xFF;
391
- /* overflow */
391
+ /* fallthrough */
392
392
  case 2:
393
393
  dest[comp_len + 1] = (uint8_t)(code >> 16) & 0xFF;
394
- /* overflow */
395
- case 1: /* overflow */
394
+ /* fallthrough */
395
+ case 1:
396
396
  dest[comp_len + 0] = (uint8_t)(code >> 24) & 0xFF;
397
397
  comp_len += (bits >> 3);
398
398
  code <<= (bits & (~7));
@@ -426,7 +426,7 @@ calc_final_length:
426
426
  Header static table lookup
427
427
  ***************************************************************************** */
428
428
 
429
- const static struct {
429
+ static const struct {
430
430
  struct hpack_static_data_s {
431
431
  const char *val;
432
432
  const size_t len;
@@ -1058,10 +1058,11 @@ void huffman__print_tree(void) {
1058
1058
  }
1059
1059
  }
1060
1060
  }
1061
- fprintf(stderr, "***** Copy after this line ****\n\n"
1062
- "/** Static Huffman encoding map, left aligned */\n"
1061
+ fprintf(stderr,
1062
+ "***** Copy after this line ****\n\n"
1063
+ "/** Static Huffman encoding map, left aligned */\n"
1063
1064
 
1064
- "static const huffman_encode_s huffman_encode_table[] = {\n");
1065
+ "static const huffman_encode_s huffman_encode_table[257] = {\n");
1065
1066
  for (size_t i = 0; i < 257; ++i) {
1066
1067
  /* print huffman code left align */
1067
1068
  fprintf(stderr, " {.code = 0x%.08X, .bits = %u}, // [%zu] \n",
@@ -1071,7 +1072,8 @@ void huffman__print_tree(void) {
1071
1072
  fprintf(stderr,
1072
1073
  "};\n\n/** Static Huffman decoding tree, flattened as an array */\n"
1073
1074
 
1074
- "static const huffman_decode_s huffman_decode_tree[] = {\n");
1075
+ "static const huffman_decode_s huffman_decode_tree[%zu] = {\n",
1076
+ tree_len);
1075
1077
  for (size_t i = 0; i < tree_len; ++i) {
1076
1078
  huffman__print_unit(
1077
1079
  tree[i], i,
@@ -1127,7 +1129,7 @@ int main(void) {
1127
1129
  ***************************************************************************** */
1128
1130
 
1129
1131
  /** Static Huffman encoding map, left aligned */
1130
- static const huffman_encode_s huffman_encode_table[] = {
1132
+ static const huffman_encode_s huffman_encode_table[257] = {
1131
1133
  {.code = 0xFFC00000, .bits = 13}, // [0]
1132
1134
  {.code = 0xFFFFB000, .bits = 23}, // [1]
1133
1135
  {.code = 0xFFFFFE20, .bits = 28}, // [2]
@@ -1388,7 +1390,7 @@ static const huffman_encode_s huffman_encode_table[] = {
1388
1390
  };
1389
1391
 
1390
1392
  /** Static Huffman decoding tree, flattened as an array */
1391
- static const huffman_decode_s huffman_decode_tree[] = {
1393
+ static const huffman_decode_s huffman_decode_tree[513] = {
1392
1394
  {.value = -1, .offset = {1, 44}}, // [0]
1393
1395
  {.value = -1, .offset = {1, 16}}, // [1]
1394
1396
  {.value = -1, .offset = {1, 8}}, // [2]
@@ -2191,7 +2191,7 @@ static const char *MONTH_NAMES[] = {"Jan ", "Feb ", "Mar ", "Apr ",
2191
2191
  "Sep ", "Oct ", "Nov ", "Dec "};
2192
2192
  static const char *GMT_STR = "GMT";
2193
2193
 
2194
- size_t http_date2str(char *target, struct tm *tmbuf) {
2194
+ size_t http_date2rfc7231(char *target, struct tm *tmbuf) {
2195
2195
  /* note: day of month is always 2 digits */
2196
2196
  char *pos = target;
2197
2197
  uint16_t tmp;
@@ -2235,6 +2235,8 @@ size_t http_date2str(char *target, struct tm *tmbuf) {
2235
2235
  return pos - target;
2236
2236
  }
2237
2237
 
2238
+ size_t http_date2str(char *target, struct tm *tmbuf);
2239
+
2238
2240
  size_t http_date2rfc2822(char *target, struct tm *tmbuf) {
2239
2241
  /* note: day of month is either 1 or 2 digits */
2240
2242
  char *pos = target;
@@ -905,6 +905,12 @@ Falls back to `gmtime_r` for dates before epoch.
905
905
  */
906
906
  struct tm *http_gmtime(time_t timer, struct tm *tmbuf);
907
907
 
908
+ /** Writes an RFC 7231 date representation (HTTP date format) to target. */
909
+ size_t http_date2rfc7231(char *target, struct tm *tmbuf);
910
+ /** Writes an RFC 2109 date representation to target. */
911
+ size_t http_date2rfc2109(char *target, struct tm *tmbuf);
912
+ /** Writes an RFC 2822 date representation to target. */
913
+ size_t http_date2rfc2822(char *target, struct tm *tmbuf);
908
914
  /**
909
915
  Writes an HTTP date string to the `target` buffer.
910
916
 
@@ -913,11 +919,9 @@ it's a super funky year, 32 bytes is about 3 more than you need).
913
919
 
914
920
  Returns the number of bytes actually written.
915
921
  */
916
- size_t http_date2str(char *target, struct tm *tmbuf);
917
- /** An alternative, RFC 2109 date representation. Requires */
918
- size_t http_date2rfc2109(char *target, struct tm *tmbuf);
919
- /** An alternative, RFC 2822 date representation. */
920
- size_t http_date2rfc2822(char *target, struct tm *tmbuf);
922
+ static inline size_t http_date2str(char *target, struct tm *tmbuf) {
923
+ return http_date2rfc7231(target, tmbuf);
924
+ }
921
925
 
922
926
  /**
923
927
  * Prints Unix time to a HTTP time formatted string.
@@ -834,7 +834,14 @@ static void initialize_env_template(void) {
834
834
  }
835
835
  add_value_to_env(env_template_no_upgrade, "rack.version", rack_version);
836
836
  }
837
- add_str_to_env(env_template_no_upgrade, "SCRIPT_NAME", "");
837
+
838
+ {
839
+ const char *sn = getenv("SCRIPT_NAME");
840
+ if (!sn || (sn[0] == '/' && sn[1] == 0)) {
841
+ sn = "";
842
+ }
843
+ add_str_to_env(env_template_no_upgrade, "SCRIPT_NAME", sn);
844
+ }
838
845
  add_value_to_env(env_template_no_upgrade, "rack.errors", rb_stderr);
839
846
  add_value_to_env(env_template_no_upgrade, "rack.hijack?", Qtrue);
840
847
  add_value_to_env(env_template_no_upgrade, "rack.multiprocess", Qtrue);
@@ -1046,7 +1046,8 @@ MUSTACHE_FUNC int(mustache_build)(mustache_build_args_s args) {
1046
1046
  instructions[s.pos].data.name_len))
1047
1047
  goto user_error;
1048
1048
  break;
1049
- case MUSTACHE_WRITE_ARG: /* overflow */
1049
+ /* fallthrough */
1050
+ case MUSTACHE_WRITE_ARG:
1050
1051
  if (mustache_on_arg(&s.stack[s.index].sec,
1051
1052
  data + instructions[s.pos].data.name_pos,
1052
1053
  instructions[s.pos].data.name_len, 1))
@@ -1058,8 +1059,10 @@ MUSTACHE_FUNC int(mustache_build)(mustache_build_args_s args) {
1058
1059
  instructions[s.pos].data.name_len, 0))
1059
1060
  goto user_error;
1060
1061
  break;
1061
- case MUSTACHE_SECTION_GOTO: /* overflow */
1062
- case MUSTACHE_SECTION_START: /* overflow */
1062
+ /* fallthrough */
1063
+ case MUSTACHE_SECTION_GOTO:
1064
+ /* fallthrough */
1065
+ case MUSTACHE_SECTION_START:
1063
1066
  case MUSTACHE_SECTION_START_INV:
1064
1067
  /* advance stack*/
1065
1068
  if (s.index + 1 >= MUSTACHE_NESTING_LIMIT) {
@@ -1094,8 +1097,7 @@ MUSTACHE_FUNC int(mustache_build)(mustache_build_args_s args) {
1094
1097
  }
1095
1098
  s.stack[s.index].count = (uint32_t)val;
1096
1099
  }
1097
-
1098
- /* overflow */
1100
+ /* fallthrough */
1099
1101
  case MUSTACHE_SECTION_END:
1100
1102
  /* loop section or continue */
1101
1103
  if (s.stack[s.index].index < s.stack[s.index].count) {
@@ -1310,9 +1312,10 @@ MUSTACHE_FUNC mustache_s *(mustache_load)(mustache_load_args_s args) {
1310
1312
  }
1311
1313
  break;
1312
1314
 
1313
- case '^': /*overflow*/
1315
+ case '^':
1314
1316
  /* start inverted section */
1315
1317
  flag = 0;
1318
+ /* fallthrough */
1316
1319
  case '#':
1317
1320
  /* start section (or inverted section) */
1318
1321
  mustache__stand_alone_adjust(&s, stand_alone);
@@ -1449,14 +1452,14 @@ MUSTACHE_FUNC mustache_s *(mustache_load)(mustache_load_args_s args) {
1449
1452
  s.stack[s.index].del_end[s.stack[s.index].del_end_len - 1] == '}') {
1450
1453
  ++s.stack[s.index].data_pos;
1451
1454
  }
1452
- /*overflow*/
1453
- case '&': /*overflow*/
1455
+ /* fallthrough */
1456
+ case '&':
1454
1457
  /* unescaped variable data */
1455
1458
  flag = 0;
1456
- /* overflow to default */
1457
- case ':': /*overflow*/
1458
- case '<': /*overflow*/
1459
- ++beg; /*overflow*/
1459
+ /* fallthrough */
1460
+ case ':': /*fallthrough*/
1461
+ case '<': /*fallthrough*/
1462
+ ++beg; /*fallthrough*/
1460
1463
  default:
1461
1464
  --end;
1462
1465
  MUSTACHE_IGNORE_WHITESPACE(beg, 1);
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.7.26'.freeze
2
+ VERSION = '0.7.27'.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.26
4
+ version: 0.7.27
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-03-07 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -82,6 +82,7 @@ extensions:
82
82
  extra_rdoc_files: []
83
83
  files:
84
84
  - ".gitignore"
85
+ - ".rspec"
85
86
  - ".travis.yml"
86
87
  - ".yardopts"
87
88
  - CHANGELOG.md
@@ -201,7 +202,7 @@ licenses:
201
202
  - MIT
202
203
  metadata:
203
204
  allowed_push_host: https://rubygems.org
204
- post_install_message: 'Thank you for installing Iodine 0.7.26.
205
+ post_install_message: 'Thank you for installing Iodine 0.7.27.
205
206
 
206
207
  '
207
208
  rdoc_options: []