0.6.2: fixes #7
This commit is contained in:
parent
229526cbe1
commit
87b79b5bd2
4 changed files with 9 additions and 4 deletions
|
@ -1 +1 @@
|
|||
5
|
||||
6
|
||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4,7 +4,7 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "herb"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
dependencies = [
|
||||
"packeteer",
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "herb"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
|
@ -170,7 +170,7 @@ fn get_page(filename: String) -> GetPageResult {
|
|||
resultstruct.contents = result.to_string().into_bytes();
|
||||
return resultstruct;
|
||||
} else {
|
||||
let f = File::open(filename);
|
||||
let f = File::open(filename.clone());
|
||||
if f.is_ok() {
|
||||
let mut buf: Vec<u8> = vec![];
|
||||
let result = f.unwrap().read_to_end(&mut buf);
|
||||
|
@ -183,6 +183,11 @@ fn get_page(filename: String) -> GetPageResult {
|
|||
return resultstruct;
|
||||
}
|
||||
} else {
|
||||
if filename == "index.html" {
|
||||
let newresult = generate_index(".".to_string());
|
||||
resultstruct.contents = newresult.to_string().into_bytes();
|
||||
return resultstruct;
|
||||
}
|
||||
resultstruct.contents = "<!DOCTYPE HTML><html><body><h1>500 Internal Server Error</h1><p>The resource you are trying to access cannot be read by the server.</p></body></html>".to_string().into_bytes();
|
||||
resultstruct.is500 = true;
|
||||
return resultstruct;
|
||||
|
|
Loading…
Reference in a new issue