mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-28 12:10:37 +02:00
feat: added suport to http
crate 1.0
(#508)
* chore: use same feature * test: add test for new http version added * stylistic review --------- Co-authored-by: Luis Moreno <morenol@users.noreply.github.com> Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
@ -1,8 +1,21 @@
|
||||
use http::Uri;
|
||||
use http as http_02;
|
||||
|
||||
use super::Host;
|
||||
|
||||
impl Host for Uri {
|
||||
impl Host for http_02::Uri {
|
||||
fn hostname(&self) -> &str {
|
||||
self.host().unwrap_or("")
|
||||
}
|
||||
|
||||
fn port(&self) -> Option<u16> {
|
||||
match self.port_u16() {
|
||||
Some(port) => Some(port),
|
||||
None => scheme_to_port(self.scheme_str()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Host for http_1::Uri {
|
||||
fn hostname(&self) -> &str {
|
||||
self.host().unwrap_or("")
|
||||
}
|
||||
|
Reference in New Issue
Block a user