update meta handling
This commit is contained in:
parent
c2f79d5a23
commit
65297831c8
3 changed files with 9 additions and 3 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -218,7 +218,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "starfig"
|
name = "starfig"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"native-tls",
|
"native-tls",
|
||||||
"packeteer",
|
"packeteer",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "starfig"
|
name = "starfig"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
@ -44,7 +44,13 @@ fn serve(mut stream: TlsStream<TcpStream>) {
|
||||||
if file == "# 51 Not Found\nThe resource you were looking for couldn't be found :(\nStarfig, gemini server by threeoh6000" {
|
if file == "# 51 Not Found\nThe resource you were looking for couldn't be found :(\nStarfig, gemini server by threeoh6000" {
|
||||||
res.code = 51;
|
res.code = 51;
|
||||||
}
|
}
|
||||||
res.meta = "text/gemini".to_string();
|
if res.code == 20 {
|
||||||
|
res.meta = "text/gemini".to_string();
|
||||||
|
} else if res.code == 51 {
|
||||||
|
res.meta = "Not Found".to_string();
|
||||||
|
} else {
|
||||||
|
res.meta = "Err".to_string();
|
||||||
|
}
|
||||||
let (res_head, res_bod) = unpack_response(res);
|
let (res_head, res_bod) = unpack_response(res);
|
||||||
stream.write(res_head.as_bytes()).unwrap();
|
stream.write(res_head.as_bytes()).unwrap();
|
||||||
stream.flush().unwrap();
|
stream.flush().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue