chore: refactor
This commit is contained in:
parent
8ffd80ce94
commit
3e7240e4ca
2 changed files with 2 additions and 2 deletions
|
|
@ -200,7 +200,7 @@ where
|
||||||
// Handle StatusCode::SWITCHING_PROTOCOLS in response
|
// Handle StatusCode::SWITCHING_PROTOCOLS in response
|
||||||
let upgrade_in_response = extract_upgrade(res_backend.headers());
|
let upgrade_in_response = extract_upgrade(res_backend.headers());
|
||||||
let should_upgrade = match (upgrade_in_request.as_ref(), upgrade_in_response.as_ref()) {
|
let should_upgrade = match (upgrade_in_request.as_ref(), upgrade_in_response.as_ref()) {
|
||||||
(Some(u_req), Some(u_res)) => u_req.to_ascii_lowercase() == u_res.to_ascii_lowercase(),
|
(Some(u_req), Some(u_res)) => u_req.eq_ignore_ascii_case(u_res),
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ pub(super) fn extract_upgrade(headers: &HeaderMap) -> Option<String> {
|
||||||
.to_str()
|
.to_str()
|
||||||
.unwrap_or("")
|
.unwrap_or("")
|
||||||
.split(',')
|
.split(',')
|
||||||
.any(|w| w.trim().to_ascii_lowercase() == header::UPGRADE.as_str().to_ascii_lowercase())
|
.any(|w| w.trim().eq_ignore_ascii_case(header::UPGRADE.as_str()))
|
||||||
{
|
{
|
||||||
if let Some(u) = headers.get(header::UPGRADE) {
|
if let Some(u) = headers.get(header::UPGRADE) {
|
||||||
if let Ok(m) = u.to_str() {
|
if let Ok(m) = u.to_str() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue