volo-http 0.5.5

HTTP framework implementation of volo.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use http::uri::Scheme;

use crate::utils::consts;

pub fn get_default_port(scheme: &Scheme) -> u16 {
    #[cfg(feature = "__tls")]
    if scheme == &Scheme::HTTPS {
        return consts::HTTPS_DEFAULT_PORT;
    }
    if scheme == &Scheme::HTTP {
        return consts::HTTP_DEFAULT_PORT;
    }
    unreachable!("[Volo-HTTP] https is not allowed when feature `tls` is not enabled")
}

pub fn is_default_port(scheme: &Scheme, port: u16) -> bool {
    get_default_port(scheme) == port
}