rage-iodine 3.2.0 → 3.3.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/ext/iodine/http.c +32 -27
- data/lib/iodine/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1cf5cbcae299e1e28aaca04e99ea7ab9204a4d98fbf9434b27620f7588c22bc
|
4
|
+
data.tar.gz: 634a243fc8abdff8bfa59e21cf4e2a95a356e309569d17e85568cd5c2803d38f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e25730fe3ce0166e0e7ad4e260a1a1d15787cc264c906fce21a6a960614c3d5d033cbb597bb54cb36a97c316f8f64c5bd079e2c4d3f4cf5b6f0de1d890d92f27
|
7
|
+
data.tar.gz: fa94545855b466b9a16f00dbb267161b0cad66c546d973aa589bd74500868381c349e6d8df5d18c983fa3ecb4fd69fa5f21e57dbedc0f69c833c809c1eb4dc8f
|
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.3.3.0 (2024-08-18)
|
10
|
+
|
11
|
+
**Update**: Improvements and fixes for the static file service.
|
12
|
+
|
9
13
|
#### Change log v.3.2.0 (2024-07-15)
|
10
14
|
|
11
15
|
**Update**: Explicitly undefine the alloc function on IodineObjectStorage.
|
data/ext/iodine/http.c
CHANGED
@@ -460,23 +460,16 @@ no_gzip_support:
|
|
460
460
|
!(S_ISREG(file_data.st_mode) || S_ISLNK(file_data.st_mode)))
|
461
461
|
return -1;
|
462
462
|
found_file:
|
463
|
-
/* set last-modified */
|
464
|
-
{
|
465
|
-
FIOBJ tmp = fiobj_str_buf(32);
|
466
|
-
fiobj_str_resize(
|
467
|
-
tmp, http_time2str(fiobj_obj2cstr(tmp).data, file_data.st_mtime));
|
468
|
-
http_set_header(h, HTTP_HEADER_LAST_MODIFIED, tmp);
|
469
|
-
}
|
470
463
|
/* set cache-control */
|
471
464
|
http_set_header(h, HTTP_HEADER_CACHE_CONTROL, fiobj_dup(HTTP_HVALUE_MAX_AGE));
|
465
|
+
/* set last-modified */
|
466
|
+
FIOBJ last_modified_str = fiobj_str_buf(32);
|
467
|
+
fiobj_str_resize(
|
468
|
+
last_modified_str, http_time2str(fiobj_obj2cstr(last_modified_str).data, file_data.st_mtime));
|
469
|
+
http_set_header(h, HTTP_HEADER_LAST_MODIFIED, last_modified_str);
|
472
470
|
/* set & test etag */
|
473
|
-
|
474
|
-
|
475
|
-
etag = fiobj_hash_string(&etag, sizeof(uint64_t));
|
476
|
-
FIOBJ etag_str = fiobj_str_buf(32);
|
477
|
-
fiobj_str_resize(etag_str,
|
478
|
-
fio_base64_encode(fiobj_obj2cstr(etag_str).data,
|
479
|
-
(void *)&etag, sizeof(uint64_t)));
|
471
|
+
FIOBJ etag_str = fiobj_str_buf(1);
|
472
|
+
fiobj_str_printf(etag_str, "%lx-%llx", file_data.st_mtime, file_data.st_size);
|
480
473
|
/* set */
|
481
474
|
http_set_header(h, HTTP_HEADER_ETAG, etag_str);
|
482
475
|
/* test */
|
@@ -499,7 +492,7 @@ found_file:
|
|
499
492
|
if (!ifrange_hash)
|
500
493
|
ifrange_hash = fiobj_hash_string("if-range", 8);
|
501
494
|
FIOBJ tmp = fiobj_hash_get2(h->headers, ifrange_hash);
|
502
|
-
if (tmp && fiobj_iseq(tmp, etag_str)) {
|
495
|
+
if (tmp && !(fiobj_iseq(tmp, etag_str) || fiobj_iseq(tmp, last_modified_str))) {
|
503
496
|
fiobj_hash_delete2(h->headers, range_hash);
|
504
497
|
} else {
|
505
498
|
tmp = fiobj_hash_get2(h->headers, range_hash);
|
@@ -513,26 +506,30 @@ found_file:
|
|
513
506
|
char *pos = range.data + 6;
|
514
507
|
int64_t start_at = 0, end_at = 0;
|
515
508
|
start_at = fio_atol(&pos);
|
516
|
-
if (start_at >= file_data.st_size)
|
517
|
-
goto open_file;
|
518
509
|
if (start_at >= 0) {
|
519
510
|
pos++;
|
520
511
|
end_at = fio_atol(&pos);
|
521
|
-
if (end_at <= 0)
|
522
|
-
goto open_file;
|
523
512
|
}
|
524
513
|
/* we ignore multimple ranges, only responding with the first range. */
|
525
|
-
if (
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
} else if (end_at) {
|
514
|
+
if (end_at) {
|
515
|
+
/* "Range bytes=100-200": bytes between `start_at` and `end_at` are requested */
|
516
|
+
if (start_at < 0 || end_at <= start_at || end_at >= length)
|
517
|
+
goto invalid_range;
|
518
|
+
|
531
519
|
offset = start_at;
|
532
520
|
length = end_at - start_at + 1;
|
533
|
-
|
534
|
-
|
521
|
+
} else if (start_at < 0) {
|
522
|
+
/* "Range bytes=-100": the last `start_at` bytes are requested */
|
523
|
+
if (0 - start_at >= length)
|
524
|
+
goto invalid_range;
|
525
|
+
|
526
|
+
offset = file_data.st_size + start_at;
|
527
|
+
length = 0 - start_at;
|
535
528
|
} else {
|
529
|
+
/* "Range bytes=100-": all bytes starting at `start_at` are requested */
|
530
|
+
if (start_at >= length)
|
531
|
+
goto invalid_range;
|
532
|
+
|
536
533
|
offset = start_at;
|
537
534
|
length = length - start_at;
|
538
535
|
}
|
@@ -612,6 +609,14 @@ open_file:
|
|
612
609
|
}
|
613
610
|
http_sendfile(h, file, length, offset);
|
614
611
|
return 0;
|
612
|
+
invalid_range:
|
613
|
+
{
|
614
|
+
FIOBJ crange = fiobj_str_buf(1);
|
615
|
+
fiobj_str_printf(crange, "bytes */%lu", (unsigned long)file_data.st_size);
|
616
|
+
http_set_header(h, HTTP_HEADER_CONTENT_RANGE, crange);
|
617
|
+
http_send_error(h, 416);
|
618
|
+
return 0;
|
619
|
+
}
|
615
620
|
}
|
616
621
|
|
617
622
|
/**
|
data/lib/iodine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rage-iodine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -274,7 +274,7 @@ requirements:
|
|
274
274
|
- Ruby >= 2.5.0 recommended.
|
275
275
|
- TLS requires OpenSSL >= 1.1.0.
|
276
276
|
- Or Windows with Ruby >= 3.0.0 build with MingW and MingW as compiler.
|
277
|
-
rubygems_version: 3.
|
277
|
+
rubygems_version: 3.4.10
|
278
278
|
signing_key:
|
279
279
|
specification_version: 4
|
280
280
|
summary: iodine - a fast HTTP / Websocket Server with Pub/Sub support, optimized for
|