This commit is contained in:
Mateusz Gruszczyński committed 2026-10-05 17:05:06 +02:00
1 parent d168ee2afa
commit ddc5c6593f
70 files changed
+2293 -594

No files matched your search

+8 -3
View File
@@ -85,7 +85,8 @@ pub(super) async fn file_response(
if let Some(range) = range {
response.headers_mut().insert(
CONTENT_RANGE,
HeaderValue::from_str(&format!("bytes {}-{}/{length}", range.start, range.end)).unwrap(),
HeaderValue::from_str(&format!("bytes {}-{}/{length}", range.start, range.end))
.unwrap(),
);
}
add_validators(&mut response, etag.as_deref(), modified);
@@ -173,14 +174,18 @@ pub(super) fn directory_listing(path: &str, entries: &[DirectoryEntry]) -> Vec<u
}
let href = html_escape(&href);
let slash = if entry.directory { "/" } else { "" };
let class = if entry.directory { "entry directory" } else { "entry file" };
let class = if entry.directory {
"entry directory"
} else {
"entry file"
};
let kind = if entry.directory { "Directory" } else { "File" };
let type_label = if entry.directory { "DIR" } else { "FILE" };
html.push_str(&format!(
"<a class=\"{class}\" href=\"{href}\"><span class=\"type\">{type_label}</span><span class=\"name\">{label}{slash}</span><span class=\"kind\">{kind}</span></a>"
));
}
html.push_str(r#"</div></section><footer class="page-footer"><span>RustProxy <b>0.25.7</b></span><span>Web Server · Directory listing</span></footer></main></body></html>"#);
html.push_str(r#"</div></section><footer class="page-footer"><span>RustProxy <b>0.26.0</b></span><span>Web Server · Directory listing</span></footer></main></body></html>"#);
html.into_bytes()
}