summaryrefslogtreecommitdiff
path: root/src/server/handler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/handler.rs')
-rw-r--r--src/server/handler.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/server/handler.rs b/src/server/handler.rs
index c15d600..f32a015 100644
--- a/src/server/handler.rs
+++ b/src/server/handler.rs
@@ -24,11 +24,13 @@ pub fn handle_request(config: &ServerConfig, mut stream: SslStream<TcpStream>) {
match stream.ssl_read(&mut buffer) {
Ok(s) => {
if s == 0 {
+ println!("received empty request buffer");
send_header(&mut stream, &response::bad_request());
return;
}
}
Err(_) => {
+ println!("received broken request");
send_header(&mut stream, &response::bad_request());
return;
}
@@ -37,6 +39,7 @@ pub fn handle_request(config: &ServerConfig, mut stream: SslStream<TcpStream>) {
let request = match String::from_utf8(buffer.to_vec()) {
Ok(request) => request,
Err(_) => {
+ println!("received empty request string");
send_header(&mut stream, &response::bad_request());
return;
}
@@ -79,8 +82,7 @@ fn handle_response(config: &ServerConfig, url: Url, mut stream: &mut SslStream<T
let rel_path = match Path::new(url.path()).strip_prefix("/") {
Ok(path) => path,
Err(_) => {
- send_header(&mut stream, &response::bad_request());
- return;
+ Path::new("")
}
};