aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWhyme Lyu <callme5long@gmail.com>2023-12-11 10:11:16 +0000
committerWhyme Lyu <callme5long@gmail.com>2023-12-11 10:11:16 +0000
commit9a6ecd74151814aee435bc039c45f6c932ead7c2 (patch)
treec8004d3e5ae590e571daef3d50f7570dae67cfde
parentBump deps (diff)
downloadminiserve-9a6ecd74151814aee435bc039c45f6c932ead7c2.tar.gz
miniserve-9a6ecd74151814aee435bc039c45f6c932ead7c2.zip
Remove header Content-Encoding when archiving
Content-Encoding is a representation header which kinda means "same content, presented differently to different clients" or "encoded & decoded on-the-fly, guided by content negotiation". In the case of downloading an archive, MDN docs explicitly says that (quoted from https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding): > If the original media is encoded in some way (e.g. a zip file) then this > information would not be included in the Content-Encoding header. Thus this patch. Also fixes !1187.
Diffstat (limited to '')
-rw-r--r--src/archive.rs9
-rw-r--r--src/listing.rs1
2 files changed, 0 insertions, 10 deletions
diff --git a/src/archive.rs b/src/archive.rs
index bfae66e..e52fc49 100644
--- a/src/archive.rs
+++ b/src/archive.rs
@@ -2,7 +2,6 @@ use std::fs::File;
use std::io::{Cursor, Read, Write};
use std::path::{Path, PathBuf};
-use actix_web::http::header::ContentEncoding;
use libflate::gzip::Encoder;
use serde::Deserialize;
use strum::{Display, EnumIter, EnumString};
@@ -45,14 +44,6 @@ impl ArchiveMethod {
.to_string()
}
- pub fn content_encoding(self) -> ContentEncoding {
- match self {
- ArchiveMethod::TarGz => ContentEncoding::Gzip,
- ArchiveMethod::Tar => ContentEncoding::Identity,
- ArchiveMethod::Zip => ContentEncoding::Identity,
- }
- }
-
pub fn is_enabled(self, tar_enabled: bool, tar_gz_enabled: bool, zip_enabled: bool) -> bool {
match self {
ArchiveMethod::TarGz => tar_gz_enabled,
diff --git a/src/listing.rs b/src/listing.rs
index a8feeb4..eb9b2be 100644
--- a/src/listing.rs
+++ b/src/listing.rs
@@ -363,7 +363,6 @@ pub fn directory_listing(
req.clone(),
HttpResponse::Ok()
.content_type(archive_method.content_type())
- .append_header(archive_method.content_encoding())
.append_header(("Content-Transfer-Encoding", "binary"))
.append_header((
"Content-Disposition",