diff options
Diffstat (limited to 'src/server/mod.rs')
| -rw-r--r-- | src/server/mod.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/server/mod.rs b/src/server/mod.rs index 5b7aedb..d7826f6 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -2,17 +2,19 @@ use crate::server::response::Response; use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod, SslStream}; use std::collections::HashMap; use std::net::{SocketAddr, TcpListener, TcpStream}; +use std::path::{Path, PathBuf}; +use std::sync::Arc; use std::thread; use std::vec::Vec; -use std::sync::Arc; use url::Url; -pub mod response; pub mod handler; +pub mod response; #[derive(Clone)] pub struct ServerConfig { defaultHost: Url, + wwwRoot: PathBuf, } pub struct Server { @@ -21,8 +23,11 @@ pub struct Server { } impl Server { - pub fn new(host: &str) -> Server { - let config = ServerConfig{defaultHost: Url::parse(host).unwrap()}; + pub fn new(host: &str, wwwRoot: &Path) -> Server { + let config = ServerConfig { + defaultHost: Url::parse(host).unwrap(), + wwwRoot: PathBuf::from(wwwRoot), + }; Server { acceptor: build_acceptor(), |
