mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 01:32:57 +01:00
export ws::hash_key
This commit is contained in:
parent
2b5f9f0511
commit
85c2887b30
43
src/error.rs
43
src/error.rs
@ -981,23 +981,6 @@ mod tests {
|
|||||||
from!(httparse::Error::Version => ParseError::Version);
|
from!(httparse::Error::Version => ParseError::Version);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn failure_error() {
|
|
||||||
// const NAME: &str = "RUST_BACKTRACE";
|
|
||||||
// let old_tb = env::var(NAME);
|
|
||||||
// env::set_var(NAME, "0");
|
|
||||||
// let error = failure::err_msg("Hello!");
|
|
||||||
// let resp: Error = error.into();
|
|
||||||
// assert_eq!(
|
|
||||||
// format!("{:?}", resp),
|
|
||||||
// "Compat { error: ErrorMessage { msg: \"Hello!\" } }\n\n"
|
|
||||||
// );
|
|
||||||
// match old_tb {
|
|
||||||
// Ok(x) => env::set_var(NAME, x),
|
|
||||||
// _ => env::remove_var(NAME),
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_internal_error() {
|
fn test_internal_error() {
|
||||||
let err =
|
let err =
|
||||||
@ -1006,32 +989,6 @@ mod tests {
|
|||||||
assert_eq!(resp.status(), StatusCode::OK);
|
assert_eq!(resp.status(), StatusCode::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn test_error_downcasting_direct() {
|
|
||||||
// #[derive(Debug, Display)]
|
|
||||||
// #[display(fmt = "demo error")]
|
|
||||||
// struct DemoError;
|
|
||||||
|
|
||||||
// impl ResponseError for DemoError {}
|
|
||||||
|
|
||||||
// let err: Error = DemoError.into();
|
|
||||||
// let err_ref: &DemoError = err.downcast_ref().unwrap();
|
|
||||||
// assert_eq!(err_ref.to_string(), "demo error");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn test_error_downcasting_compat() {
|
|
||||||
// #[derive(Debug, Display)]
|
|
||||||
// #[display(fmt = "demo error")]
|
|
||||||
// struct DemoError;
|
|
||||||
|
|
||||||
// impl ResponseError for DemoError {}
|
|
||||||
|
|
||||||
// let err: Error = failure::Error::from(DemoError).into();
|
|
||||||
// let err_ref: &DemoError = err.downcast_ref().unwrap();
|
|
||||||
// assert_eq!(err_ref.to_string(), "demo error");
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_error_helpers() {
|
fn test_error_helpers() {
|
||||||
let r: Response = ErrorBadRequest("err").into();
|
let r: Response = ErrorBadRequest("err").into();
|
||||||
|
@ -24,7 +24,7 @@ mod transport;
|
|||||||
pub use self::client::{Client, ClientError, Connect};
|
pub use self::client::{Client, ClientError, Connect};
|
||||||
pub use self::codec::{Codec, Frame, Message};
|
pub use self::codec::{Codec, Frame, Message};
|
||||||
pub use self::frame::Parser;
|
pub use self::frame::Parser;
|
||||||
pub use self::proto::{CloseCode, CloseReason, OpCode};
|
pub use self::proto::{hash_key, CloseCode, CloseReason, OpCode};
|
||||||
pub use self::service::VerifyWebSockets;
|
pub use self::service::VerifyWebSockets;
|
||||||
pub use self::transport::Transport;
|
pub use self::transport::Transport;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ impl<T: Into<String>> From<(CloseCode, T)> for CloseReason {
|
|||||||
static WS_GUID: &'static str = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
static WS_GUID: &'static str = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
||||||
|
|
||||||
// TODO: hash is always same size, we dont need String
|
// TODO: hash is always same size, we dont need String
|
||||||
pub(crate) fn hash_key(key: &[u8]) -> String {
|
pub fn hash_key(key: &[u8]) -> String {
|
||||||
let mut hasher = sha1::Sha1::new();
|
let mut hasher = sha1::Sha1::new();
|
||||||
|
|
||||||
hasher.update(key);
|
hasher.update(key);
|
||||||
|
Loading…
Reference in New Issue
Block a user