diff --git a/Cargo.lock b/Cargo.lock index cde4799..ecb0042 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,9 +81,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", @@ -94,9 +94,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -212,15 +212,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] diff --git a/src/main.rs b/src/main.rs index e0b514c..31a647e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,9 +8,8 @@ use crate::post::{Post, Thread}; use std::io; use std::io::{BufRead, BufReader, Read, Write}; -use std::net::{SocketAddr, TcpListener, TcpStream}; +use std::net::{TcpListener, TcpStream}; use std::path::PathBuf; -use std::str; use bincode::{deserialize, serialize}; use errors::DatabaseError; @@ -37,6 +36,9 @@ struct Opt { #[structopt(short, long, default_value = "data")] database: PathBuf, + + #[structopt(short, long, default_value = "999999999")] + max_id: u32, } // get command line arguments and make them static @@ -215,15 +217,23 @@ fn get(path: &str) -> Result { .fold(String::from(""), |a, b| format!("{a}\n{b}")); let c = content("index", &ops); - Ok(Response::new(Status::Ok, vec![], c.into())) + Ok(Response::new( + Status::Ok, + vec![("content-type", "text/html; charset=utf-8")], + c.into(), + )) } // TODO favicon.ico "/css" => Ok(Response::new( Status::Ok, - vec![], + vec![("content-type", "text/css; charset=utf-8")], String::from(STYLE).into(), )), - "/faq" => Ok(Response::new(Status::Ok, vec![], String::from(FAQ).into())), + "/faq" => Ok(Response::new( + Status::Ok, + vec![("content-type", "text/html; charset=utf-8")], + String::from(FAQ).into(), + )), "/favicon.ico" => Ok(Response::new( Status::Ok, vec![("content-type", "image/x-icon")], @@ -250,7 +260,11 @@ fn get(path: &str) -> Result { .iter() .fold(String::from(""), |a, b| format!("{a}\n{b}")); let c = content(&id.to_string(), &c); - Ok(Response::new(Status::Ok, vec![], c.into())) + Ok(Response::new( + Status::Ok, + vec![("content-type", "text/html; charset=utf-8")], + c.into(), + )) } } }