From aed776ac49cb44705463d9e43c070dc56adaaae3 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Mon, 10 Jun 2024 00:38:45 +0200 Subject: Remove explicit dependency on http We now use the one supplied by actix-web. --- Cargo.lock | 1 - Cargo.toml | 1 - src/args.rs | 2 +- src/config.rs | 2 +- src/listing.rs | 6 ++++-- src/renderer.rs | 3 +-- tests/auth_file.rs | 2 +- tests/serve_request.rs | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ee0a60..20bce99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1703,7 +1703,6 @@ dependencies = [ "futures", "grass", "hex", - "http", "httparse", "if-addrs", "libflate", diff --git a/Cargo.toml b/Cargo.toml index b18b7e2..7cd503d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,6 @@ fast_qr = { version = "0.12", features = ["svg"] } futures = "0.3" grass = { version = "0.13", features = ["macro"], default-features = false } hex = "0.4" -http = "0.2" httparse = "1" if-addrs = "0.12" libflate = "2" diff --git a/src/args.rs b/src/args.rs index 95c8bff..20be079 100644 --- a/src/args.rs +++ b/src/args.rs @@ -1,8 +1,8 @@ use std::net::IpAddr; use std::path::PathBuf; +use actix_web::http::header::{HeaderMap, HeaderName, HeaderValue}; use clap::{Parser, ValueEnum, ValueHint}; -use http::header::{HeaderMap, HeaderName, HeaderValue}; use crate::auth; use crate::listing::{SortingMethod, SortingOrder}; diff --git a/src/config.rs b/src/config.rs index 3643502..5a0037b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -5,8 +5,8 @@ use std::{ path::PathBuf, }; +use actix_web::http::header::HeaderMap; use anyhow::{anyhow, Context, Result}; -use http::HeaderMap; #[cfg(feature = "tls")] use rustls_pemfile as pemfile; diff --git a/src/listing.rs b/src/listing.rs index e24b41c..6c67051 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -3,7 +3,9 @@ use std::io; use std::path::{Component, Path}; use std::time::SystemTime; -use actix_web::{dev::ServiceResponse, web::Query, HttpMessage, HttpRequest, HttpResponse}; +use actix_web::{ + dev::ServiceResponse, http::Uri, web::Query, HttpMessage, HttpRequest, HttpResponse, +}; use bytesize::ByteSize; use clap::ValueEnum; use comrak::{markdown_to_html, ComrakOptions}; @@ -173,7 +175,7 @@ pub fn directory_listing( let base = Path::new(serve_path); let random_route_abs = format!("/{}", conf.route_prefix); let abs_uri = { - let res = http::Uri::builder() + let res = Uri::builder() .scheme(req.connection_info().scheme()) .authority(req.connection_info().host()) .path_and_query(req.uri().to_string()) diff --git a/src/renderer.rs b/src/renderer.rs index 3935d98..7896dc3 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -1,6 +1,6 @@ use std::time::SystemTime; -use actix_web::http::StatusCode; +use actix_web::http::{StatusCode, Uri}; use chrono::{DateTime, Local}; use chrono_humanize::Humanize; use clap::{crate_name, crate_version, ValueEnum}; @@ -9,7 +9,6 @@ use fast_qr::{ qr::QRCodeError, QRBuilder, }; -use http::Uri; use maud::{html, Markup, PreEscaped, DOCTYPE}; use strum::{Display, IntoEnumIterator}; diff --git a/tests/auth_file.rs b/tests/auth_file.rs index ddc9e25..372c695 100644 --- a/tests/auth_file.rs +++ b/tests/auth_file.rs @@ -1,7 +1,7 @@ mod fixtures; +use actix_web::http::StatusCode; use fixtures::{server, server_no_stderr, Error, FILES}; -use http::StatusCode; use reqwest::blocking::Client; use rstest::rstest; use select::document::Document; diff --git a/tests/serve_request.rs b/tests/serve_request.rs index b7359c3..dd25a3f 100644 --- a/tests/serve_request.rs +++ b/tests/serve_request.rs @@ -1,12 +1,12 @@ mod fixtures; +use actix_web::http::StatusCode; use assert_cmd::prelude::*; use assert_fs::fixture::TempDir; use fixtures::{ port, server, server_no_stderr, tmpdir, Error, TestServer, DIRECTORIES, FILES, HIDDEN_DIRECTORIES, HIDDEN_FILES, }; -use http::StatusCode; use regex::Regex; use rstest::rstest; use select::{document::Document, node::Node, predicate::Attr}; -- cgit v1.2.3