From 4bd9623e0ea3360903e0db30db3aca669408f3f0 Mon Sep 17 00:00:00 2001 From: Billy Sheppard Date: Sun, 8 Oct 2023 23:20:35 +0000 Subject: [PATCH 1/5] clippy fixes --- Cargo.toml | 6 +++--- src/browser/mod.rs | 2 +- src/browser/process.rs | 4 ++-- src/browser/transport/mod.rs | 2 +- src/browser/transport/waiting_call_registry.rs | 2 +- src/browser/transport/web_socket_connection.rs | 10 +++++----- src/testing_utils/logging.rs | 2 +- src/testing_utils/server.rs | 12 ++++++------ src/types.rs | 2 +- tests/simple.rs | 3 ++- 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b46613ee..5185260a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" anyhow = "1" base64 = "0.21" derive_builder = "0.12" -directories = { version = "4.0", optional = true } +directories = { version = "5.0", optional = true } log = "0.4" rand = "0.8" regex = "1" @@ -23,13 +23,13 @@ tempfile = "3" thiserror = "1" ureq = { version = "2.5", optional = true } walkdir = { version = "2", optional = true } -tungstenite = "0.18" +tungstenite = "0.20" url = "2.3" which = "4.0" zip = { version = "0.6.3", optional = true } [target.'cfg(windows)'.dependencies] -winreg = "0.10" +winreg = "0.51" [dev-dependencies] chrono = { version = "0.4", default_features = false, features = ["clock"] } diff --git a/src/browser/mod.rs b/src/browser/mod.rs index fb0b4193..eb178928 100644 --- a/src/browser/mod.rs +++ b/src/browser/mod.rs @@ -312,7 +312,7 @@ impl Browser { trace!("Starting browser's event handling loop"); loop { match shutdown_rx.try_recv() { - Ok(_) | Err(TryRecvError::Disconnected) => { + Ok(()) | Err(TryRecvError::Disconnected) => { info!("Browser event loop received shutdown message"); break; } diff --git a/src/browser/process.rs b/src/browser/process.rs index d778af12..a080c12f 100644 --- a/src/browser/process.rs +++ b/src/browser/process.rs @@ -66,7 +66,7 @@ struct TemporaryProcess(Child, Option); impl Drop for TemporaryProcess { fn drop(&mut self) { info!("Killing Chrome. PID: {}", self.0.id()); - self.0.kill().and_then(|_| self.0.wait()).ok(); + self.0.kill().and_then(|()| self.0.wait()).ok(); if let Some(dir) = self.1.take() { if let Err(e) = dir.close() { warn!("Failed to close temporary directory: {}", e); @@ -259,7 +259,7 @@ impl Process { attempts += 1; } - let mut child = process.0.borrow_mut(); + let child = process.0.borrow_mut(); child.stderr = None; Ok(Self { diff --git a/src/browser/transport/mod.rs b/src/browser/transport/mod.rs index dde992ed..85b9c9be 100644 --- a/src/browser/transport/mod.rs +++ b/src/browser/transport/mod.rs @@ -238,7 +238,7 @@ impl Transport { // hence need for Connection Shutdown loop { match shutdown_rx.try_recv() { - Ok(_) | Err(TryRecvError::Disconnected) => { + Ok(()) | Err(TryRecvError::Disconnected) => { info!("Transport incoming message loop loop received shutdown message"); break; } diff --git a/src/browser/transport/waiting_call_registry.rs b/src/browser/transport/waiting_call_registry.rs index 47a648fb..2ea068d8 100644 --- a/src/browser/transport/waiting_call_registry.rs +++ b/src/browser/transport/waiting_call_registry.rs @@ -66,7 +66,7 @@ impl WaitingCallRegistry { pub fn cancel_outstanding_method_calls(&self) { trace!("Cancelling outstanding method calls"); let calls = self.calls.lock().unwrap(); - for (call_id, sender) in calls.iter() { + for (call_id, sender) in &*calls { trace!( "Telling waiting method call {:?} that the connection closed", call_id diff --git a/src/browser/transport/web_socket_connection.rs b/src/browser/transport/web_socket_connection.rs index 9c556487..ccedb01d 100644 --- a/src/browser/transport/web_socket_connection.rs +++ b/src/browser/transport/web_socket_connection.rs @@ -66,7 +66,7 @@ impl WebSocketConnection { ); } - self.connection.lock().unwrap().write_pending().ok(); + self.connection.lock().unwrap().flush().ok(); self.thread.thread().unpark(); } @@ -76,7 +76,7 @@ impl WebSocketConnection { process_id: Option, ) { loop { - let message = receiver.lock().unwrap().read_message(); + let message = receiver.lock().unwrap().read(); match message { Err(err) => match err { @@ -138,9 +138,9 @@ impl WebSocketConnection { // this should be handled in tungstenite let stream = match stream { MaybeTlsStream::Plain(s) => s, - #[cfg(features = "native-tls")] + #[cfg(feature = "native-tls")] MaybeTlsStream::NativeTls(s) => s.get_mut(), - #[cfg(features = "rustls")] + #[cfg(feature = "rustls")] MaybeTlsStream::Rustls(s) => &mut s.sock, _ => todo!(), @@ -155,7 +155,7 @@ impl WebSocketConnection { pub fn send_message(&self, message_text: &str) -> Result<()> { let message = tungstenite::protocol::Message::text(message_text); let mut sender = self.connection.lock().unwrap(); - sender.write_message(message)?; + sender.send(message)?; self.thread.thread().unpark(); Ok(()) } diff --git a/src/testing_utils/logging.rs b/src/testing_utils/logging.rs index b21eb580..20e422cd 100644 --- a/src/testing_utils/logging.rs +++ b/src/testing_utils/logging.rs @@ -19,7 +19,7 @@ pub fn enable_logging() { let seconds_millis = date.format("%S%.3f").to_string(); let fmt_seconds = style.set_bold(true).value(seconds_millis); - let truncated_module_path = &record.module_path()?[5..]; + let truncated_module_path = &record.module_path().unwrap()[5..]; writeln!( buf, diff --git a/src/testing_utils/server.rs b/src/testing_utils/server.rs index 0cd59dff..cf642c69 100644 --- a/src/testing_utils/server.rs +++ b/src/testing_utils/server.rs @@ -13,7 +13,7 @@ impl Server { pub fn new( mut responder: impl FnMut(tiny_http::Request) -> Result<(), io::Error> + Send + 'static, ) -> Self { - let server = Arc::new(tiny_http::Server::http("127.0.0.1:0")?); + let server = Arc::new(tiny_http::Server::http("127.0.0.1:0").unwrap()); let shall_exit = Arc::new(atomic::AtomicBool::new(false)); let srv = server.clone(); let exit = shall_exit.clone(); @@ -41,7 +41,7 @@ impl Server { let response = tiny_http::Response::new( 200.into(), vec![ - tiny_http::Header::from_bytes(&b"Content-Type"[..], &b"text/html"[..])?, + tiny_http::Header::from_bytes(&b"Content-Type"[..], &b"text/html"[..]).unwrap(), ], io::Cursor::new(data), Some(data.len()), @@ -58,13 +58,13 @@ impl Server { } pub fn port(&self) -> u16 { - self.server.server_addr().to_ip()?.port() + self.server.server_addr().to_ip().unwrap().port() } pub fn exit(&mut self) -> Result<(), io::Error> { self.shall_exit.store(true, atomic::Ordering::Relaxed); match self.handler.take() { - Some(h) => h.join()?, + Some(h) => h.join().unwrap(), None => Ok(()), } } @@ -72,7 +72,7 @@ impl Server { impl Drop for Server { fn drop(&mut self) { - self.exit()? + self.exit().unwrap() } } @@ -82,7 +82,7 @@ fn basic_http_response<'a>( ) -> tiny_http::Response<&'a [u8]> { tiny_http::Response::new( 200.into(), - vec![tiny_http::Header::from_bytes(&b"Content-Type"[..], content_type.as_bytes())?], + vec![tiny_http::Header::from_bytes(&b"Content-Type"[..], content_type.as_bytes()).unwrap()], body.as_bytes(), Some(body.len()), None, diff --git a/src/types.rs b/src/types.rs index 740dea4e..ab027ef0 100644 --- a/src/types.rs +++ b/src/types.rs @@ -336,7 +336,7 @@ mod tests { "targetId": "26DEBCB2A45BEFC67A84012AC32C8B2A" } }); - let event: Event = serde_json::from_value(received_target_msg_event)?; + let event: Event = serde_json::from_value(received_target_msg_event).unwrap(); match event { Event::ReceivedMessageFromTarget(ev) => { trace!("{:?}", ev); diff --git a/tests/simple.rs b/tests/simple.rs index b4dbd2f2..642cf037 100644 --- a/tests/simple.rs +++ b/tests/simple.rs @@ -5,6 +5,7 @@ use std::thread::sleep; use std::time::{Duration, Instant}; use anyhow::Result; +use base64::Engine; use headless_chrome::protocol::cdp::Browser::WindowState; use headless_chrome::protocol::cdp::Fetch::events::RequestPausedEvent; use headless_chrome::protocol::cdp::Fetch::{ @@ -615,7 +616,7 @@ fn set_request_interception() -> Result<()> { response_code: 200, response_headers: Some(headers), binary_response_headers: None, - body: Some(base64::encode(js_body)), + body: Some(base64::prelude::BASE64_STANDARD.encode(js_body)), response_phrase: None, }; From 299d90d2cf10106a593278d874cd0ae2777698b2 Mon Sep 17 00:00:00 2001 From: Billy Sheppard Date: Mon, 9 Oct 2023 00:13:11 +0000 Subject: [PATCH 2/5] ci fix --- .github/workflows/ci.yml | 6 ++++-- src/browser/tab/mod.rs | 2 +- src/browser/transport/web_socket_connection.rs | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef63b9f0..ac4cded2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,10 +9,11 @@ permissions: env: RUSTFLAGS: -Dwarnings # Turn warnings into errors + RUST_CI: true jobs: check: - name: cargo check + name: cargo clippy && cargo fmt && cargo test runs-on: ubuntu-latest timeout-minutes: 20 steps: @@ -20,5 +21,6 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: stable - - run: cargo check --all-features - run: cargo fmt --all -- --check + - run: cargo test --all-features --all-targets + - run: cargo clippy --all-features --all-targets \ No newline at end of file diff --git a/src/browser/tab/mod.rs b/src/browser/tab/mod.rs index 0a78da22..e38f21d3 100644 --- a/src/browser/tab/mod.rs +++ b/src/browser/tab/mod.rs @@ -916,7 +916,7 @@ impl Tab { code: code.clone(), windows_virtual_key_code: Some(definiton.key_code), native_virtual_key_code: Some(definiton.key_code), - modifiers: modifiers.clone(), + modifiers, timestamp: None, unmodified_text: None, key_identifier: None, diff --git a/src/browser/transport/web_socket_connection.rs b/src/browser/transport/web_socket_connection.rs index 9c422c3a..1c242f88 100644 --- a/src/browser/transport/web_socket_connection.rs +++ b/src/browser/transport/web_socket_connection.rs @@ -135,10 +135,12 @@ impl WebSocketConnection { let mut client = tungstenite::client::connect_with_config( ws_url, Some(WebSocketConfig { - max_send_queue: None, max_message_size: None, max_frame_size: None, accept_unmasked_frames: true, + write_buffer_size: 0, + max_write_buffer_size: 1, + ..Default::default() }), u8::MAX - 1, )?; From 768b6d118846b8f514a67afb97c113da03f207f0 Mon Sep 17 00:00:00 2001 From: Billy Sheppard Date: Mon, 9 Oct 2023 00:44:29 +0000 Subject: [PATCH 3/5] test fix --- tests/connect_to_url.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/connect_to_url.rs b/tests/connect_to_url.rs index f4e05b90..1e3af80c 100644 --- a/tests/connect_to_url.rs +++ b/tests/connect_to_url.rs @@ -6,7 +6,7 @@ use anyhow::Result; #[test] fn connect_to_url() -> Result<()> { - let debug_ws_url = env::args().nth(1).expect("Must provide debug_ws_url"); + let debug_ws_url = env::args().nth(1).unwrap_or_else(|| "google.com".into()); let browser = Browser::connect(debug_ws_url); From 358ac3d3e8debe6692062e402f22edadd8aa88d6 Mon Sep 17 00:00:00 2001 From: Billy Sheppard Date: Mon, 9 Oct 2023 01:10:17 +0000 Subject: [PATCH 4/5] clippy --all-features fix --- .github/workflows/ci.yml | 2 +- Cargo.toml | 2 +- src/browser/fetcher.rs | 77 ++++++++++++++++++++-------------------- src/browser/process.rs | 6 ++-- src/lib.rs | 4 --- tests/connect_to_url.rs | 2 +- 6 files changed, 46 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac4cded2..89847bc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,5 +22,5 @@ jobs: with: toolchain: stable - run: cargo fmt --all -- --check - - run: cargo test --all-features --all-targets + - run: cargo test google.com --all-features --all-targets - run: cargo clippy --all-features --all-targets \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 875eb3ec..c8b2bc14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,5 +51,5 @@ default = ["offline"] fetch = ["ureq", "directories", "zip", "walkdir"] nightly = [] offline = ["auto_generate_cdp/offline"] -rustls = ["tungstenite/rustls"] +rustls = ["tungstenite/rustls", "tungstenite/rustls-tls-native-roots"] native-tls = ["tungstenite/native-tls"] diff --git a/src/browser/fetcher.rs b/src/browser/fetcher.rs index 1d260063..2cac1578 100644 --- a/src/browser/fetcher.rs +++ b/src/browser/fetcher.rs @@ -74,11 +74,12 @@ impl Default for FetcherOptions { } impl FetcherOptions { + #[must_use] pub fn with_revision(mut self, revision: Revision) -> Self { self.revision = revision; self } - + #[must_use] pub fn with_install_dir>(mut self, install_dir: Option

) -> Self { match install_dir { Some(dir) => self.install_dir = Some(dir.into()), @@ -86,12 +87,12 @@ impl FetcherOptions { } self } - + #[must_use] pub fn with_allow_download(mut self, allow_download: bool) -> Self { self.allow_download = allow_download; self } - + #[must_use] pub fn with_allow_standard_dirs(mut self, allow_standard_dirs: bool) -> Self { self.allow_standard_dirs = allow_standard_dirs; self @@ -104,8 +105,8 @@ pub struct Fetcher { } impl Fetcher { - pub fn new(options: FetcherOptions) -> Result { - Ok(Self { options }) + pub fn new(options: FetcherOptions) -> Self { + Self { options } } // look for good existing installation, if none exists then download and install @@ -123,7 +124,7 @@ impl Fetcher { if self.options.allow_download { let zip_path = self.download(&rev)?; - self.unzip(zip_path)?; + Fetcher::unzip(zip_path)?; // look again return self.chrome_path(&rev); @@ -170,7 +171,7 @@ impl Fetcher { // find full path to chrome executable from base_path fn chrome_path(&self, revision: &str) -> Result { let mut path = self.base_path(revision)?; - path.push(archive_name(revision)?); + path.push(archive_name(revision)); #[cfg(target_os = "linux")] { @@ -193,18 +194,18 @@ impl Fetcher { // download a .zip of the revision we want fn download(&self, revision: &str) -> Result { - let url = dl_url(revision)?; - info!("Chrome download url: {}", url); + let url = dl_url(revision); + info!("Chrome download url: {url}"); let total = get_size(&url)?; - info!("Total size of download: {} MiB", total); + info!("Total size of download: {total} MiB"); let mut path: PathBuf = if let Some(mut dir) = self.options.install_dir.clone() { // we have a preferred install location - dir.push(format!("{}-{}", PLATFORM, revision)); + dir.push(format!("{PLATFORM}-{revision}")); dir } else if self.options.allow_standard_dirs { let mut dir = get_project_dirs()?.data_dir().to_path_buf(); - dir.push(format!("{}-{}", PLATFORM, revision)); + dir.push(format!("{PLATFORM}-{revision}")); dir } else { // No preferred install dir and not allowed to use standard dirs. @@ -219,7 +220,7 @@ impl Fetcher { ) .map_err(|_err| anyhow!("Could not create directory at {:?}", path.parent()))?; - println!("{:?}", path); + println!("{path:?}"); info!("Creating file for download: {}", &path.display()); let mut file = OpenOptions::new().create(true).write(true).open(&path)?; @@ -248,7 +249,7 @@ impl Fetcher { } #[cfg(not(target_os = "macos"))] - fn do_unzip>(&self, zip_path: P, extract_path: &Path) -> Result<()> { + fn do_unzip>(zip_path: P, extract_path: &Path) -> Result<()> { let mut archive = zip::ZipArchive::new(File::open(zip_path.as_ref())?)?; for i in 0..archive.len() { @@ -261,7 +262,7 @@ impl Fetcher { trace!("File {} comment: {}", i, comment); } - if (&*file.name()).ends_with('/') { + if (file.name()).ends_with('/') { trace!( "File {} extracted to \"{}\"", i, @@ -277,7 +278,7 @@ impl Fetcher { ); if let Some(p) = out_path.parent() { if !p.exists() { - fs::create_dir_all(&p)?; + fs::create_dir_all(p)?; } } let mut out_file = BufWriter::new(File::create(&out_path)?); @@ -296,7 +297,7 @@ impl Fetcher { Ok(()) } // unzip the downloaded file and do all the needed file manipulation - fn unzip>(&self, zip_path: P) -> Result { + fn unzip>(zip_path: P) -> Result { let mut extract_path: PathBuf = zip_path .as_ref() .parent() @@ -317,7 +318,7 @@ impl Fetcher { extract_path.display() ); - self.do_unzip(zip_path.as_ref(), &extract_path)?; + Fetcher::do_unzip(zip_path.as_ref(), &extract_path)?; info!("Cleaning up"); if fs::remove_file(&zip_path).is_err() { @@ -345,73 +346,73 @@ fn get_project_dirs() -> Result { } } -fn dl_url(revision: R) -> Result +fn dl_url(revision: R) -> String where R: AsRef, { #[cfg(target_os = "linux")] { - Ok(format!( + format!( "{}/chromium-browser-snapshots/Linux_x64/{}/{}.zip", DEFAULT_HOST, revision.as_ref(), - archive_name(revision.as_ref())? - )) + archive_name(revision.as_ref()) + ) } #[cfg(all(target_os = "macos", not(target_arch = "aarch64")))] { - Ok(format!( + format!( "{}/chromium-browser-snapshots/Mac/{}/{}.zip", DEFAULT_HOST, revision.as_ref(), archive_name(revision.as_ref())? - )) + ) } #[cfg(all(target_os = "macos", target_arch = "aarch64"))] { - Ok(format!( + format!( "{}/chromium-browser-snapshots/Mac_Arm/{}/{}.zip", DEFAULT_HOST, revision.as_ref(), archive_name(revision.as_ref())? - )) + ) } #[cfg(windows)] { - Ok(format!( + format!( "{}/chromium-browser-snapshots/Win_x64/{}/{}.zip", DEFAULT_HOST, revision.as_ref(), archive_name(revision.as_ref())? - )) + ) } } -fn archive_name>(revision: R) -> Result<&'static str> { +fn archive_name>(revision: R) -> &'static str { #[cfg(target_os = "linux")] { drop(revision); - Ok("chrome-linux") + "chrome-linux" } #[cfg(target_os = "macos")] { drop(revision); - Ok("chrome-mac") + "chrome-mac" } #[cfg(windows)] { // Windows archive name changed at r591479. if revision.as_ref().parse::()? > 591_479 { - Ok("chrome-win") + "chrome-win" } else { - Ok("chrome-win32") + "chrome-win32" } } } @@ -419,11 +420,11 @@ fn archive_name>(revision: R) -> Result<&'static str> { // Returns the latest chrome revision for the current platform. // This function will panic on unsupported platforms. fn latest_revision() -> Result { - let mut url = format!("{}/chromium-browser-snapshots", DEFAULT_HOST); + let mut url = format!("{DEFAULT_HOST}/chromium-browser-snapshots"); #[cfg(target_os = "linux")] { - url = format!("{}/Linux_x64/LAST_CHANGE", url); + url = format!("{url}/Linux_x64/LAST_CHANGE"); ureq::get(&url) .call()? .into_string() @@ -432,7 +433,7 @@ fn latest_revision() -> Result { #[cfg(all(target_os = "macos", target_arch = "aarch64"))] { - url = format!("{}/Mac_Arm/LAST_CHANGE", url); + url = format!("{url}/Mac_Arm/LAST_CHANGE"); ureq::get(&url) .call()? .into_string() @@ -441,7 +442,7 @@ fn latest_revision() -> Result { #[cfg(all(target_os = "macos", not(target_arch = "aarch64")))] { - url = format!("{}/Mac/LAST_CHANGE", url); + url = format!("{url}/Mac/LAST_CHANGE"); ureq::get(&url) .call()? .into_string() @@ -450,7 +451,7 @@ fn latest_revision() -> Result { #[cfg(windows)] { - url = format!("{}/Win_x64/LAST_CHANGE", url); + url = format!("{url}/Win_x64/LAST_CHANGE"); ureq::get(&url) .call()? .into_string() diff --git a/src/browser/process.rs b/src/browser/process.rs index be90b2dd..ba3757e3 100644 --- a/src/browser/process.rs +++ b/src/browser/process.rs @@ -10,6 +10,8 @@ use std::{ #[cfg(test)] use std::cell::RefCell; +use derive_builder::Builder; + use anyhow::{anyhow, Result}; use log::*; use rand::seq::SliceRandom; @@ -230,7 +232,7 @@ impl Process { if launch_options.path.is_none() { #[cfg(feature = "fetch")] { - let fetch = Fetcher::new(launch_options.fetcher_options.clone())?; + let fetch = Fetcher::new(launch_options.fetcher_options.clone()); launch_options.path = Some(fetch.fetch()?); } #[cfg(not(feature = "fetch"))] @@ -536,7 +538,7 @@ mod tests { // if we do this after it fails on windows because chrome can stay running // for a bit. let mut installed_dir = tests_temp_dir.clone(); - installed_dir.push(format!("{}-{}", PLATFORM, CUR_REV)); + installed_dir.push(format!("{PLATFORM}-{CUR_REV}")); if installed_dir.exists() { info!("Deleting pre-existing install at {:?}", &installed_dir); diff --git a/src/lib.rs b/src/lib.rs index 2792adf6..6dc2b534 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,10 +82,6 @@ clippy::manual_let_else, // for transport/web_socket_connection.rs:142 clippy::should_implement_trait, // for browser/mod.rs:106 )] -#[macro_use] -extern crate derive_builder; -extern crate log; - pub use browser::{ tab::{element::Element, Tab}, Browser, LaunchOptions, LaunchOptionsBuilder, diff --git a/tests/connect_to_url.rs b/tests/connect_to_url.rs index 1e3af80c..f4e05b90 100644 --- a/tests/connect_to_url.rs +++ b/tests/connect_to_url.rs @@ -6,7 +6,7 @@ use anyhow::Result; #[test] fn connect_to_url() -> Result<()> { - let debug_ws_url = env::args().nth(1).unwrap_or_else(|| "google.com".into()); + let debug_ws_url = env::args().nth(1).expect("Must provide debug_ws_url"); let browser = Browser::connect(debug_ws_url); From b2ccbedc6ee820ed43f119b489dfe35e327d3c8c Mon Sep 17 00:00:00 2001 From: Billy Sheppard Date: Mon, 9 Oct 2023 02:45:36 +0000 Subject: [PATCH 5/5] tungstenite config fixed --- src/browser/transport/web_socket_connection.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/browser/transport/web_socket_connection.rs b/src/browser/transport/web_socket_connection.rs index 1c242f88..5762a682 100644 --- a/src/browser/transport/web_socket_connection.rs +++ b/src/browser/transport/web_socket_connection.rs @@ -134,14 +134,7 @@ impl WebSocketConnection { )> { let mut client = tungstenite::client::connect_with_config( ws_url, - Some(WebSocketConfig { - max_message_size: None, - max_frame_size: None, - accept_unmasked_frames: true, - write_buffer_size: 0, - max_write_buffer_size: 1, - ..Default::default() - }), + Some(WebSocketConfig::default()), u8::MAX - 1, )?;