Browse Source

Fix typo

master
Garrit Franke 4 years ago
parent
commit
e5548e02e9
  1. 6
      src/gemini.rs
  2. 6
      src/main.rs

6
src/gemini.rs

@ -28,15 +28,15 @@ fn parse_path(req: &str) -> Option<&str> {
req.split("\r\n").next()
}
pub struct GeminiResonse {
pub struct GeminiResponse {
pub status: [u8; 2],
pub meta: Vec<u8>,
pub body: Option<Vec<u8>>,
}
impl GeminiResonse {
impl GeminiResponse {
pub fn new() -> Self {
GeminiResonse {
GeminiResponse {
status: [b'2', b'0'],
meta: "text/gemini; charset=utf-8".as_bytes().to_vec(),
body: None,

6
src/main.rs

@ -92,7 +92,7 @@ fn read_file(file_path: &str) -> Result<Vec<u8>, io::Error> {
}
/// Send file as a response
fn send_file(path: &str, response: &mut gemini::GeminiResonse) {
fn send_file(path: &str, response: &mut gemini::GeminiResponse) {
match read_file(path) {
Ok(buf) => {
response.body = Some(buf);
@ -108,7 +108,7 @@ fn send_file(path: &str, response: &mut gemini::GeminiResonse) {
}
}
fn not_found(response: &mut gemini::GeminiResonse) {
fn not_found(response: &mut gemini::GeminiResponse) {
response.status = [b'5', b'1'];
response.meta = "Resource not found".into();
}
@ -127,7 +127,7 @@ fn handle_client(mut stream: TlsStream<TcpStream>, static_root: &str) -> Result<
}
let request = gemini::GeminiRequest::from_string(&raw_request).unwrap();
let mut response = gemini::GeminiResonse::new();
let mut response = gemini::GeminiResponse::new();
let url_path = request.file_path();
let file_path = path::Path::new(url_path);

Loading…
Cancel
Save