Skip to content
Snippets Groups Projects
Commit d611125a authored by codecraft's avatar codecraft :crocodile:
Browse files

Remove unnecessary println!s of file bytes

parent 299909a8
No related branches found
No related tags found
1 merge request!1Initial feature merge
...@@ -22,15 +22,11 @@ impl NamedFile { ...@@ -22,15 +22,11 @@ impl NamedFile {
let path = proove_path(path); let path = proove_path(path);
let data = fs::read(&path); let data = fs::read(&path);
let data = match data { let data = match data {
Ok(dat) => { Ok(dat) => dat,
println!("{:?}", dat);
dat
}
Err(_) => { Err(_) => {
return Err(Status { code: 404 }); return Err(Status { code: 404 });
} }
}; };
println!("{:?}", data);
Ok(NamedFile { Ok(NamedFile {
content_len: data.len(), content_len: data.len(),
content_type: find_mimetype(path.to_str().unwrap()), content_type: find_mimetype(path.to_str().unwrap()),
......
...@@ -56,7 +56,6 @@ pub fn handle_connection(mut stream: TcpStream, _mountpoint: &str) { ...@@ -56,7 +56,6 @@ pub fn handle_connection(mut stream: TcpStream, _mountpoint: &str) {
fs::read("./404.html").unwrap(), fs::read("./404.html").unwrap(),
), ),
}; };
println!("{:?}", handled_response);
stream.write_all(handled_response.0.as_bytes()).unwrap(); stream.write_all(handled_response.0.as_bytes()).unwrap();
stream.write(&handled_response.1).unwrap(); stream.write(&handled_response.1).unwrap();
...@@ -79,7 +78,6 @@ fn parse_request<'a>(request: &'a str, mountpoint: &'a str) -> Result<PathBuf, & ...@@ -79,7 +78,6 @@ fn parse_request<'a>(request: &'a str, mountpoint: &'a str) -> Result<PathBuf, &
fn handler(request: Request, _data: Data) -> Outcome<Response, Status, Data> { fn handler(request: Request, _data: Data) -> Outcome<Response, Status, Data> {
let response = fileserver(request.uri); let response = fileserver(request.uri);
println!("{:?}", response);
let response = match response { let response = match response {
Ok(dat) => Response { Ok(dat) => Response {
headers: vec![ headers: vec![
...@@ -95,6 +93,5 @@ fn handler(request: Request, _data: Data) -> Outcome<Response, Status, Data> { ...@@ -95,6 +93,5 @@ fn handler(request: Request, _data: Data) -> Outcome<Response, Status, Data> {
} }
fn fileserver(path: &str) -> Result<NamedFile, Status> { fn fileserver(path: &str) -> Result<NamedFile, Status> {
println!("fileserver started");
NamedFile::open(PathBuf::from("static/".to_string() + path)) NamedFile::open(PathBuf::from("static/".to_string() + path))
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment