mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 01:32:57 +01:00
fix response upgrade type
This commit is contained in:
parent
3301a46264
commit
fd86d73a03
@ -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> {
|
fn pool() -> &'static MessagePool<Self> {
|
||||||
REQUEST_POOL.with(|p| *p)
|
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> {
|
fn pool() -> &'static MessagePool<Self> {
|
||||||
RESPONSE_POOL.with(|p| *p)
|
RESPONSE_POOL.with(|p| *p)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user