summaryrefslogtreecommitdiff
path: root/src/server/handler.rs
blob: ceb65514fd433fcf2c85b4044d15ded93e6c560b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::server::response;
use crate::server::ServerConfig;
use std::path::Path;
use url::Url;

pub fn handle(config: &ServerConfig, url: Url) -> Option<response::Response> {
    if url.scheme() != "gemini" {
        return Some(response::invalid_protocol());
    }

    let path = Path::new(url.path());
    if !path.has_root() {
        return Some(response::not_understood());
    }

    None
}