isomorfeus-iodine 0.7.49 → 0.7.50
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +17 -3
- data/Rakefile +1 -9
- data/examples/etag.ru +16 -0
- data/ext/{iodine → iodine_ext}/extconf.rb +1 -1
- data/ext/{iodine → iodine_ext}/fio.c +0 -0
- data/ext/{iodine → iodine_ext}/fio.h +0 -0
- data/ext/{iodine → iodine_ext}/fio_cli.c +0 -0
- data/ext/{iodine → iodine_ext}/fio_cli.h +189 -189
- data/ext/{iodine → iodine_ext}/fio_json_parser.h +687 -687
- data/ext/{iodine → iodine_ext}/fio_siphash.c +157 -157
- data/ext/{iodine → iodine_ext}/fio_siphash.h +37 -37
- data/ext/{iodine → iodine_ext}/fio_tls.h +129 -129
- data/ext/{iodine → iodine_ext}/fio_tls_missing.c +0 -0
- data/ext/{iodine → iodine_ext}/fio_tls_openssl.c +0 -0
- data/ext/{iodine → iodine_ext}/fio_tmpfile.h +0 -0
- data/ext/{iodine → iodine_ext}/fiobj.h +44 -44
- data/ext/{iodine → iodine_ext}/fiobj4fio.h +21 -21
- data/ext/{iodine → iodine_ext}/fiobj_ary.c +333 -333
- data/ext/{iodine → iodine_ext}/fiobj_ary.h +139 -139
- data/ext/{iodine → iodine_ext}/fiobj_data.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_data.h +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_hash.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_hash.h +176 -176
- data/ext/{iodine → iodine_ext}/fiobj_json.c +622 -622
- data/ext/{iodine → iodine_ext}/fiobj_json.h +68 -68
- data/ext/{iodine → iodine_ext}/fiobj_mem.h +71 -71
- data/ext/{iodine → iodine_ext}/fiobj_mustache.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_mustache.h +62 -62
- data/ext/{iodine → iodine_ext}/fiobj_numbers.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_numbers.h +127 -127
- data/ext/{iodine → iodine_ext}/fiobj_str.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobj_str.h +172 -172
- data/ext/{iodine → iodine_ext}/fiobject.c +0 -0
- data/ext/{iodine → iodine_ext}/fiobject.h +0 -0
- data/ext/{iodine → iodine_ext}/hpack.h +1923 -1923
- data/ext/{iodine → iodine_ext}/http.c +14 -27
- data/ext/{iodine → iodine_ext}/http.h +1002 -1002
- data/ext/{iodine → iodine_ext}/http1.c +0 -0
- data/ext/{iodine → iodine_ext}/http1.h +29 -29
- data/ext/{iodine → iodine_ext}/http1_parser.h +0 -0
- data/ext/{iodine → iodine_ext}/http_internal.c +0 -0
- data/ext/{iodine → iodine_ext}/http_internal.h +0 -0
- data/ext/{iodine → iodine_ext}/http_mime_parser.h +350 -350
- data/ext/{iodine → iodine_ext}/iodine.c +1 -1
- data/ext/{iodine → iodine_ext}/iodine.h +0 -0
- data/ext/{iodine → iodine_ext}/iodine_caller.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_caller.h +0 -0
- data/ext/{iodine → iodine_ext}/iodine_connection.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_connection.h +55 -55
- data/ext/{iodine → iodine_ext}/iodine_defer.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_defer.h +6 -6
- data/ext/{iodine → iodine_ext}/iodine_fiobj2rb.h +120 -120
- data/ext/{iodine → iodine_ext}/iodine_helpers.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_helpers.h +12 -12
- data/ext/{iodine → iodine_ext}/iodine_http.c +0 -2
- data/ext/{iodine → iodine_ext}/iodine_http.h +23 -23
- data/ext/{iodine → iodine_ext}/iodine_json.c +302 -302
- data/ext/{iodine → iodine_ext}/iodine_json.h +6 -6
- data/ext/{iodine → iodine_ext}/iodine_mustache.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_mustache.h +6 -6
- data/ext/{iodine → iodine_ext}/iodine_pubsub.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_pubsub.h +26 -26
- data/ext/{iodine → iodine_ext}/iodine_rack_io.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_rack_io.h +20 -20
- data/ext/{iodine → iodine_ext}/iodine_store.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_store.h +20 -20
- data/ext/{iodine → iodine_ext}/iodine_tcp.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_tcp.h +0 -0
- data/ext/{iodine → iodine_ext}/iodine_tls.c +0 -0
- data/ext/{iodine → iodine_ext}/iodine_tls.h +13 -13
- data/ext/{iodine → iodine_ext}/mustache_parser.h +0 -0
- data/ext/{iodine → iodine_ext}/redis_engine.c +0 -0
- data/ext/{iodine → iodine_ext}/redis_engine.h +0 -0
- data/ext/{iodine → iodine_ext}/resp_parser.h +0 -0
- data/ext/{iodine → iodine_ext}/websocket_parser.h +505 -505
- data/ext/{iodine → iodine_ext}/websockets.c +0 -0
- data/ext/{iodine → iodine_ext}/websockets.h +185 -185
- data/isomorfeus-iodine.gemspec +1 -2
- data/lib/iodine/version.rb +1 -1
- data/lib/iodine.rb +1 -1
- metadata +79 -78
@@ -92,14 +92,12 @@ static inline void add_date(http_s *r) {
|
|
92
92
|
static uint64_t date_hash = 0;
|
93
93
|
if (!date_hash)
|
94
94
|
date_hash = fiobj_hash_string("date", 4);
|
95
|
-
static uint64_t mod_hash = 0;
|
96
|
-
if (!mod_hash)
|
97
|
-
mod_hash = fiobj_hash_string("last-modified", 13);
|
98
95
|
|
99
96
|
if (fio_last_tick().tv_sec > last_date_added) {
|
100
97
|
fio_lock(&date_lock);
|
101
98
|
if (fio_last_tick().tv_sec > last_date_added) { /* retest inside lock */
|
102
|
-
/* 32 chars are ok for a while, but http_time2str below has a buffer sized
|
99
|
+
/* 32 chars are ok for a while, but http_time2str below has a buffer sized
|
100
|
+
* 48 chars and does a memcpy ... */
|
103
101
|
FIOBJ tmp = fiobj_str_buf(32);
|
104
102
|
FIOBJ old = current_date;
|
105
103
|
fiobj_str_resize(
|
@@ -115,11 +113,6 @@ static inline void add_date(http_s *r) {
|
|
115
113
|
fiobj_hash_set(r->private_data.out_headers, HTTP_HEADER_DATE,
|
116
114
|
fiobj_dup(current_date));
|
117
115
|
}
|
118
|
-
if (r->status_str == FIOBJ_INVALID &&
|
119
|
-
!fiobj_hash_get2(r->private_data.out_headers, mod_hash)) {
|
120
|
-
fiobj_hash_set(r->private_data.out_headers, HTTP_HEADER_LAST_MODIFIED,
|
121
|
-
fiobj_dup(current_date));
|
122
|
-
}
|
123
116
|
}
|
124
117
|
|
125
118
|
struct header_writer_s {
|
@@ -2355,7 +2348,7 @@ static void init_cached_key_ptr(void) {
|
|
2355
2348
|
time_t *cached_tick = malloc(sizeof(time_t));
|
2356
2349
|
FIO_ASSERT_ALLOC(cached_tick);
|
2357
2350
|
memset(cached_tick, 0, sizeof(time_t));
|
2358
|
-
char *cached_httpdate = malloc(sizeof(char)*48);
|
2351
|
+
char *cached_httpdate = malloc(sizeof(char) * 48);
|
2359
2352
|
FIO_ASSERT_ALLOC(cached_tick);
|
2360
2353
|
memset(cached_httpdate, 0, 48);
|
2361
2354
|
size_t *cached_len = malloc(sizeof(size_t));
|
@@ -2401,28 +2394,24 @@ size_t http_time2str(char *target, const time_t t) {
|
|
2401
2394
|
|
2402
2395
|
/* Credit to Jonathan Leffler for the idea of a unified conditional */
|
2403
2396
|
#define hex_val(c) \
|
2404
|
-
(((c) >= '0' && (c) <= '9')
|
2405
|
-
|
2406
|
-
|
2407
|
-
|
2408
|
-
|
2409
|
-
|
2410
|
-
0; \
|
2411
|
-
}))
|
2397
|
+
(((c) >= '0' && (c) <= '9') ? ((c)-48) \
|
2398
|
+
: (((c) | 32) >= 'a' && ((c) | 32) <= 'f') ? (((c) | 32) - 87) \
|
2399
|
+
: ({ \
|
2400
|
+
return -1; \
|
2401
|
+
0; \
|
2402
|
+
}))
|
2412
2403
|
static inline int hex2byte(uint8_t *dest, const uint8_t *source) {
|
2413
2404
|
if (source[0] >= '0' && source[0] <= '9')
|
2414
2405
|
*dest = (source[0] - '0');
|
2415
|
-
else if ((source[0] >= 'a' && source[0] <= 'f')
|
2416
|
-
|
2417
|
-
*dest = (source[0] | 32) - 87;
|
2406
|
+
else if ((source[0] | 32) >= 'a' && (source[0] | 32) <= 'f')
|
2407
|
+
*dest = (source[0] | 32) - ('a' - 10);
|
2418
2408
|
else
|
2419
2409
|
return -1;
|
2420
2410
|
*dest <<= 4;
|
2421
2411
|
if (source[1] >= '0' && source[1] <= '9')
|
2422
2412
|
*dest |= (source[1] - '0');
|
2423
|
-
else if ((source[1] >= 'a' && source[1] <= 'f')
|
2424
|
-
|
2425
|
-
*dest |= (source[1] | 32) - 87;
|
2413
|
+
else if ((source[1] | 32) >= 'a' && (source[1] | 32) <= 'f')
|
2414
|
+
*dest |= (source[1] | 32) - ('a' - 10);
|
2426
2415
|
else
|
2427
2416
|
return -1;
|
2428
2417
|
return 0;
|
@@ -2561,9 +2550,7 @@ FIOBJ http_mimetype_find(char *file_ext, size_t file_ext_len) {
|
|
2561
2550
|
|
2562
2551
|
static pthread_key_t buffer_key;
|
2563
2552
|
static pthread_once_t buffer_once = PTHREAD_ONCE_INIT;
|
2564
|
-
static void init_buffer_key(void) {
|
2565
|
-
pthread_key_create(&buffer_key, free);
|
2566
|
-
}
|
2553
|
+
static void init_buffer_key(void) { pthread_key_create(&buffer_key, free); }
|
2567
2554
|
static void init_buffer_ptr(void) {
|
2568
2555
|
char *buffer = malloc(sizeof(char) * (LONGEST_FILE_EXTENSION_LENGTH + 1));
|
2569
2556
|
FIO_ASSERT_ALLOC(buffer);
|