From 05f1b5fe5e52f12c8b4fc06b74f7d06958b06ab5 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Tue, 18 Jun 2024 19:32:04 +0300 Subject: [PATCH] some comments --- README.md | 2 ++ src/main.rs | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7bd1bbd..08d6ca9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # EzHttp Easy http server on rust +This library is under developement, so if you found any bugs, please write them to [Issues](https://github.com/MeexReay/ezhttp/issues) + Example: ```rust use ezhttp::{Headers, HttpRequest, HttpResponse, HttpServer}; diff --git a/src/main.rs b/src/main.rs index 7914ea6..3739046 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,12 +10,12 @@ impl HttpServer for EzSite { if req.page == "/" { Some(HttpResponse::from_str( - Headers::from(vec![("Content-Type", "text/html")]), - "200 OK".to_string(), - &self.index_page, + Headers::from(vec![("Content-Type", "text/html")]), // response headers + "200 OK".to_string(), // response status code + &self.index_page, // response body )) } else { - None // just shutdown socket + None // shutdown request } } @@ -41,4 +41,6 @@ fn main() { let host = "localhost:8080"; ezhttp::start_server(site, host).unwrap(); + + // ezhttp::start_server_timeout(site, host, Duration::from_secs(5)).unwrap(); // with read and write timeout }