1
0
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:
morenol
2023-12-05 20:18:17 -04:00
committed by GitHub
parent 923a443950
commit 1945fa0675
4 changed files with 36 additions and 3 deletions

View File

@ -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("")
}