And the resource has been isolated!
This commit is contained in:
parent
cf0066abce
commit
0ef8e438db
2 changed files with 11 additions and 7 deletions
|
@ -22,7 +22,7 @@ The stuff I need to make it usable.
|
||||||
|
|
||||||
[x] Read the stream
|
[x] Read the stream
|
||||||
|
|
||||||
[ ] Detect which resource the client wants to access
|
[x] Detect which resource the client wants to access
|
||||||
|
|
||||||
[ ] Detect missing files and return a 404 page
|
[ ] Detect missing files and return a 404 page
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ The stuff I need to make it usable.
|
||||||
|
|
||||||
[ ] Properly generate headers
|
[ ] Properly generate headers
|
||||||
|
|
||||||
[ ] Read other pages from filesystem
|
[ ] Read and serve other pages from filesystem
|
||||||
|
|
||||||
### SUPAR Chonklist
|
### SUPAR Chonklist
|
||||||
Whatever is on here, just to make it extra spicy.
|
Whatever is on here, just to make it extra spicy.
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -35,18 +35,22 @@ fn process_request(request: Vec<u8>) -> String {
|
||||||
|
|
||||||
if input == "/" {
|
if input == "/" {
|
||||||
// And now for ignoring the entire variable!
|
// And now for ignoring the entire variable!
|
||||||
output = "index.html".to_string();
|
output = "index.html"
|
||||||
} else {
|
} else {
|
||||||
output = "index.html".to_string();
|
let mut chars = input.chars();
|
||||||
|
chars.next();
|
||||||
|
output = chars.as_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// It's get_page()'s problem now.
|
// It's get_page()'s problem now.
|
||||||
println!("Stream sent unhandlable request type.");
|
println!("Stream sent unhandlable request type.");
|
||||||
output = ".503".to_string();
|
output = ".503"
|
||||||
}
|
}
|
||||||
println!("{}", output);
|
println!("{}", output.to_string());
|
||||||
return output;
|
|
||||||
|
// Did you want to see chars.as_str().to_string()?
|
||||||
|
return output.to_string();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue