Commit 7d1afa3
Support for pre-compressed and ETag in download (#222)
* Support for pre-compressed and ETag in download
When downloading file request:
1. **Gzipped file serving**:
- Automatically detects and serves pre-compressed `.gz` files when uncompressed originals are missing
- Properly sets `Content-Encoding: gzip` headers
- Implements `If-None-Match` header comparison for 304 (Not Modified) responses (RFC 7232)
- Implements `ETag` header using CRC-32 from gzip trailer (bytes 4-7 from end)
- Optimize for speed
Changes affect:
void AsyncWebServerRequest::send(FS &fs, const String &path, const char *contentType, bool download, AwsTemplateProcessor callback)
AsyncWebServerResponse *
AsyncWebServerRequest::beginResponse(FS &fs, const String &path, const char *contentType, bool download, AwsTemplateProcessor callback)
AsyncFileResponse::AsyncFileResponse(FS &fs, const String &path, const char *contentType, bool download, AwsTemplateProcessor callback)
: AsyncAbstractResponse(callback)
* ci(pre-commit): Apply automatic fixes
* Update src/AsyncWebServerRequest.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add files via upload
---------
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 049a659 commit 7d1afa3
2 files changed
+80
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | | - | |
| 30 | + | |
24 | 31 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
36 | 46 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
670 | 670 | | |
671 | 671 | | |
672 | 672 | | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
673 | 686 | | |
674 | 687 | | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
681 | 697 | | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | 698 | | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
691 | 708 | | |
692 | 709 | | |
693 | | - | |
694 | | - | |
695 | | - | |
| 710 | + | |
| 711 | + | |
696 | 712 | | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
705 | 719 | | |
706 | 720 | | |
707 | 721 | | |
| |||
710 | 724 | | |
711 | 725 | | |
712 | 726 | | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | 727 | | |
718 | | - | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
719 | 732 | | |
| 733 | + | |
720 | 734 | | |
721 | | - | |
722 | | - | |
| 735 | + | |
| 736 | + | |
723 | 737 | | |
724 | | - | |
| 738 | + | |
| 739 | + | |
725 | 740 | | |
726 | 741 | | |
727 | 742 | | |
| |||
0 commit comments