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]]
|
[[package]]
|
||||||
name = "herb"
|
name = "herb"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"packeteer",
|
"packeteer",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "herb"
|
name = "herb"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# 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();
|
resultstruct.contents = result.to_string().into_bytes();
|
||||||
return resultstruct;
|
return resultstruct;
|
||||||
} else {
|
} else {
|
||||||
let f = File::open(filename);
|
let f = File::open(filename.clone());
|
||||||
if f.is_ok() {
|
if f.is_ok() {
|
||||||
let mut buf: Vec<u8> = vec![];
|
let mut buf: Vec<u8> = vec![];
|
||||||
let result = f.unwrap().read_to_end(&mut buf);
|
let result = f.unwrap().read_to_end(&mut buf);
|
||||||
|
@ -183,6 +183,11 @@ fn get_page(filename: String) -> GetPageResult {
|
||||||
return resultstruct;
|
return resultstruct;
|
||||||
}
|
}
|
||||||
} else {
|
} 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.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;
|
resultstruct.is500 = true;
|
||||||
return resultstruct;
|
return resultstruct;
|
||||||
|
|
Loading…
Reference in a new issue