From 58fa47f4cc13a4823b414c8a681d15e3d706fc41 Mon Sep 17 00:00:00 2001 From: Sudo Dios Date: Wed, 11 Sep 2024 13:39:43 +0330 Subject: [PATCH] Cleanup --- README.md | 16 ++++++++-------- src/http/request.rs | 7 +------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 7c25dd3..f435da5 100644 --- a/README.md +++ b/README.md @@ -49,16 +49,16 @@ Compatible with all librespeed clients : ### Build with docker -0. Install docker and docker-compose. +1. Install docker and docker-compose. -1. Clone the repository: +2. Clone the repository: ```sh $ git clone https://github.com/librespeed/speedtest-rust.git $ cd speedtest-rust ``` -2. Copy the default config and assets: +3. Copy the default config and assets: ```sh $ cp docker-compose.override.sample.yml docker-compose.override.yml @@ -67,7 +67,7 @@ Compatible with all librespeed clients : $ sudo cp -r assets /var/lib/librespeed/assets ``` -3. Edit the config files: +4. Edit the config files: ```sh $ sudo chmod o-rwx /etc/librespeed.toml docker-compose.override.yml # Hide secrets @@ -77,14 +77,14 @@ Compatible with all librespeed clients : $ sudo $EDITOR /var/lib/librespeed/assets/index.html # To change html styles, etc ``` -4. Start the container: +5. Start the container: ```sh - $ docker-compose up -d - $ docker-compose logs -f # To check status + $ docker compose up -d + $ docker compose logs -f # To check status ``` -5. Navigate to http://localhost:8080/ +6. Navigate to http://localhost:8080/ ### Compile from source diff --git a/src/http/request.rs b/src/http/request.rs index 94f3f07..1eb9a81 100644 --- a/src/http/request.rs +++ b/src/http/request.rs @@ -225,12 +225,7 @@ fn check_has_body(headers : &HashMap) -> (Option,Option }; //check fixed body if let Some(content_len) = headers.get("Content-Length") { - let content_len = match content_len.parse::() { - Ok(v) => { v } - Err(_) => { - 0 - } - }; + let content_len = content_len.parse::().unwrap_or(0); if content_len > 0 { let body_type = if let Some(content_type_form) = content_type_form { content_type_form