From bddec167af052e94bd89009178562cc87f9d5e22 Mon Sep 17 00:00:00 2001 From: AdvTechnoKing Date: Tue, 29 Apr 2025 16:10:11 +0300 Subject: [PATCH] fixed file ext: .zstd > .zst --- doc/configure/file_directives.html | 2 +- doc/h2o.conf.5 | 2 +- lib/handler/file.c | 5 ++++- srcdoc/configure/file_directives.mt | 2 +- t/50file-config.t | 2 +- t/assets/doc_root/{index.txt.zstd => index.txt.zst} | Bin 6 files changed, 8 insertions(+), 5 deletions(-) rename t/assets/doc_root/{index.txt.zstd => index.txt.zst} (100%) diff --git a/doc/configure/file_directives.html b/doc/configure/file_directives.html index 9df03f7e5..db84fc3f1 100644 --- a/doc/configure/file_directives.html +++ b/doc/configure/file_directives.html @@ -445,7 +445,7 @@ A flag indicating how a pre-compressed file should be served.

-If set to ON, the handler looks for a file with .br, .zstd, or .gz appended and sends the file, if the client is capable of transparently decoding a brotli, zstd, or gzip-encoded response. +If set to ON, the handler looks for a file with .br, .zst, or .gz appended and sends the file, if the client is capable of transparently decoding a brotli, zstd, or gzip-encoded response. For example, if a client requests a file named index.html with Accept-Encoding: gzip header and if index.html.gz exists, the .gz file is sent as a response together with a Content-Encoding: gzip response header. When both the client and the server support multiple content encodings, the encoding chosen is the first one listed in the following order: brotli, zstd, gzip.

diff --git a/doc/h2o.conf.5 b/doc/h2o.conf.5 index c84b88c73..94cb4819f 100644 --- a/doc/h2o.conf.5 +++ b/doc/h2o.conf.5 @@ -3112,7 +3112,7 @@ A flag indicating how a pre-compressed file should be served. .PP -If set to ON, the handler looks for a file with .br, .zstd, or .gz appended and sends the file, if the client is capable of transparently decoding a brotli, zstd, or gzip-encoded response. +If set to ON, the handler looks for a file with .br, .zst, or .gz appended and sends the file, if the client is capable of transparently decoding a brotli, zstd, or gzip-encoded response. For example, if a client requests a file named index.html with Accept-Encoding: gzip header and if index.html.gz exists, the .gz file is sent as a response together with a Content-Encoding: gzip response header. When both the client and the server support multiple content encodings, the encoding chosen is the first one listed in the following order: brotli, zstd, gzip. diff --git a/lib/handler/file.c b/lib/handler/file.c index b68f109b9..4c1318d83 100644 --- a/lib/handler/file.c +++ b/lib/handler/file.c @@ -353,8 +353,11 @@ static struct st_h2o_sendfile_generator_t *create_generator(h2o_req_t *req, cons } \ } TRY_VARIANT(H2O_COMPRESSIBLE_BROTLI, "br", ".br"); - TRY_VARIANT(H2O_COMPRESSIBLE_ZSTD, "zstd", ".zstd"); + TRY_VARIANT(H2O_COMPRESSIBLE_ZSTD, "zstd", ".zst"); TRY_VARIANT(H2O_COMPRESSIBLE_GZIP, "gzip", ".gz"); + + // Deprecated + TRY_VARIANT(H2O_COMPRESSIBLE_ZSTD, "zstd", ".zstd"); #undef TRY_VARIANT } } diff --git a/srcdoc/configure/file_directives.mt b/srcdoc/configure/file_directives.mt index 73fb4cf27..cd8323850 100644 --- a/srcdoc/configure/file_directives.mt +++ b/srcdoc/configure/file_directives.mt @@ -239,7 +239,7 @@ EOT )->(sub { ?>

-If set to ON, the handler looks for a file with .br, .zstd, or .gz appended and sends the file, if the client is capable of transparently decoding a brotli, zstd, or gzip-encoded response. +If set to ON, the handler looks for a file with .br, .zst, or .gz appended and sends the file, if the client is capable of transparently decoding a brotli, zstd, or gzip-encoded response. For example, if a client requests a file named index.html with Accept-Encoding: gzip header and if index.html.gz exists, the .gz file is sent as a response together with a Content-Encoding: gzip response header. When both the client and the server support multiple content encodings, the encoding chosen is the first one listed in the following order: brotli, zstd, gzip.

diff --git a/t/50file-config.t b/t/50file-config.t index 2afac41c2..55f3589a1 100644 --- a/t/50file-config.t +++ b/t/50file-config.t @@ -77,7 +77,7 @@ EOT my $index_orig_len = (stat 't/assets/doc_root/index.txt')[7]; my $index_gz_len = (stat 't/assets/doc_root/index.txt.gz')[7]; my $index_br_len = (stat 't/assets/doc_root/index.txt.br')[7]; - my $index_zstd_len = (stat 't/assets/doc_root/index.txt.zstd')[7]; + my $index_zstd_len = (stat 't/assets/doc_root/index.txt.zst')[7]; my $alice2_orig_len = `gzip -cd < t/assets/doc_root/alice2.txt.gz | wc -c`; my $alice2_gz_len = (stat 't/assets/doc_root/alice2.txt.gz')[7]; diff --git a/t/assets/doc_root/index.txt.zstd b/t/assets/doc_root/index.txt.zst similarity index 100% rename from t/assets/doc_root/index.txt.zstd rename to t/assets/doc_root/index.txt.zst