Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump the tungstenite group across 1 directory with 2 updates #136

Merged
merged 3 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ http-body-util = "0.1.0"
hyper = "1.1.0"
hyper-rustls = { version = "0.27.0", default-features = false, features = ["http1", "logging", "tls12", "webpki-tokio"], optional = true }
hyper-tls = { version = "0.6.0", optional = true }
hyper-tungstenite = "0.15.0"
hyper-tungstenite = "0.17.0"
hyper-util = { version="0.1.3", features = ["client-legacy", "server", "http1"] }
moka = { version = "0.12.0", features = ["future"], optional = true }
openssl = { version = "0.10.46", optional = true }
rand = { version = "0.8.0", optional = true }
rcgen = { version = "0.13.0", features = ["x509-parser"], optional = true }
thiserror = "2.0.0"
thiserror = "2.0.7"
time = { version = "0.3.35", optional = true }
tokio = { version = "1.24.2", features = ["macros", "rt"] }
tokio-graceful = "0.2.0"
tokio-native-tls = { version = "0.3.1", optional = true }
tokio-rustls = { version = "0.26.0", features = ["logging", "tls12"] }
tokio-tungstenite = "0.24.0"
tokio-tungstenite = "0.26.1"
tokio-util = { version = "0.7.1", features = ["io"], optional = true }
tracing = { version = "0.1.35", features = ["log"] }

Expand Down
8 changes: 4 additions & 4 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use hudsucker::{
server::conn::auto,
},
rustls,
tokio_tungstenite::tungstenite::Message,
tokio_tungstenite::tungstenite::{Message, Utf8Bytes},
Body, HttpContext, HttpHandler, Proxy, RequestOrResponse, WebSocketContext, WebSocketHandler,
};
use reqwest::tls::Certificate;
Expand All @@ -34,8 +34,8 @@ use tokio_graceful::Shutdown;
use tokio_native_tls::native_tls;
use tokio_util::io::ReaderStream;

pub const HELLO_WORLD: &str = "Hello, World!";
pub const WORLD: &str = "world";
pub const HELLO_WORLD: &str = "Hello, World";
pub const WORLD: Utf8Bytes = Utf8Bytes::from_static("world");

async fn test_server(req: Request<Incoming>) -> Result<Response<Body>, Infallible> {
if hyper_tungstenite::is_upgrade_request(&req) {
Expand All @@ -49,7 +49,7 @@ async fn test_server(req: Request<Incoming>) -> Result<Response<Body>, Infallibl
if msg.is_close() {
break;
}
ws.send(Message::Text(WORLD.to_owned())).await.unwrap();
ws.send(Message::Text(WORLD)).await.unwrap();
}
});

Expand Down
24 changes: 13 additions & 11 deletions tests/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ use hudsucker::{
certificate_authority::RcgenAuthority,
rcgen::{CertificateParams, KeyPair},
rustls::crypto::aws_lc_rs,
tokio_tungstenite::tungstenite::Message,
tokio_tungstenite::tungstenite::{Message, Utf8Bytes},
};
use std::sync::atomic::Ordering;
use tokio::net::TcpStream;

#[allow(unused)]
mod common;

const HELLO: Utf8Bytes = Utf8Bytes::from_static("hello");

fn build_ca() -> RcgenAuthority {
let key_pair = include_str!("../examples/ca/hudsucker.key");
let ca_cert = include_str!("../examples/ca/hudsucker.cer");
Expand Down Expand Up @@ -49,11 +51,11 @@ async fn http() {
.await
.unwrap();

ws.send(Message::Text("hello".to_owned())).await.unwrap();
ws.send(Message::Text(HELLO)).await.unwrap();

let msg = ws.next().await.unwrap().unwrap();

assert_eq!(msg.to_string(), common::WORLD);
assert_eq!(msg.into_text().unwrap(), common::WORLD);
assert_eq!(handler.message_counter.load(Ordering::Relaxed), 2);

stop_server.send(()).unwrap();
Expand Down Expand Up @@ -86,11 +88,11 @@ async fn https_rustls() {
.await
.unwrap();

ws.send(Message::Text("hello".to_owned())).await.unwrap();
ws.send(Message::Text(HELLO)).await.unwrap();

let msg = ws.next().await.unwrap().unwrap();

assert_eq!(msg.to_string(), common::WORLD);
assert_eq!(msg.into_text().unwrap(), common::WORLD);
assert_eq!(handler.message_counter.load(Ordering::Relaxed), 2);

stop_server.send(()).unwrap();
Expand Down Expand Up @@ -123,11 +125,11 @@ async fn https_native_tls() {
.await
.unwrap();

ws.send(Message::Text("hello".to_owned())).await.unwrap();
ws.send(Message::Text(HELLO)).await.unwrap();

let msg = ws.next().await.unwrap().unwrap();

assert_eq!(msg.to_string(), common::WORLD);
assert_eq!(msg.into_text().unwrap(), common::WORLD);
assert_eq!(handler.message_counter.load(Ordering::Relaxed), 2);

stop_server.send(()).unwrap();
Expand Down Expand Up @@ -159,11 +161,11 @@ async fn without_intercept() {
.await
.unwrap();

ws.send(Message::Text("hello".to_owned())).await.unwrap();
ws.send(Message::Text(HELLO)).await.unwrap();

let msg = ws.next().await.unwrap().unwrap();

assert_eq!(msg.to_string(), common::WORLD);
assert_eq!(msg.into_text().unwrap(), common::WORLD);
assert_eq!(handler.message_counter.load(Ordering::Relaxed), 0);

stop_server.send(()).unwrap();
Expand All @@ -188,10 +190,10 @@ async fn noop() {
.await
.unwrap();

ws.send(Message::Text("hello".to_owned())).await.unwrap();
ws.send(Message::Text(HELLO)).await.unwrap();
let msg = ws.next().await.unwrap().unwrap();

assert_eq!(msg.to_string(), common::WORLD);
assert_eq!(msg.into_text().unwrap(), common::WORLD);

stop_server.send(()).unwrap();
stop_proxy.send(()).unwrap();
Expand Down
Loading