1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

fix response upgrade type

This commit is contained in:
Nikolay Kim 2019-03-18 05:26:12 -07:00
parent 3301a46264
commit fd86d73a03

View File

@ -106,6 +106,18 @@ impl Head for RequestHead {
}
}
fn upgrade(&self) -> bool {
if let Some(hdr) = self.headers().get(header::CONNECTION) {
if let Ok(s) = hdr.to_str() {
s.to_ascii_lowercase().contains("upgrade")
} else {
false
}
} else {
false
}
}
fn pool() -> &'static MessagePool<Self> {
REQUEST_POOL.with(|p| *p)
}
@ -194,6 +206,10 @@ impl Head for ResponseHead {
}
}
fn upgrade(&self) -> bool {
self.connection_type() == ConnectionType::Upgrade
}
fn pool() -> &'static MessagePool<Self> {
RESPONSE_POOL.with(|p| *p)
}