diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 2dba6c16fa..05bdf3371e 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -15,6 +15,6 @@ hyper = { version = "0.14.10", features = ["full"] } log = "0.4" serde = { version = "1", default-features = false, features = ["derive"] } serde_json = "1" -soketto = "0.6" +soketto = "0.7" tokio = { version = "1", features = ["net", "rt-multi-thread", "macros", "time"] } tokio-util = { version = "0.6", features = ["compat"] } diff --git a/types/Cargo.toml b/types/Cargo.toml index cd18e52861..a170456b0a 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -19,5 +19,5 @@ log = { version = "0.4", default-features = false } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["alloc", "raw_value", "std"] } thiserror = "1.0" -soketto = "0.6" +soketto = "0.7" hyper = "0.14.10" diff --git a/ws-client/Cargo.toml b/ws-client/Cargo.toml index aee5e93c56..54dd2add9b 100644 --- a/ws-client/Cargo.toml +++ b/ws-client/Cargo.toml @@ -14,6 +14,7 @@ tokio = { version = "1", features = ["net", "time", "rt-multi-thread", "macros"] tokio-rustls = "0.22" tokio-util = { version = "0.6", features = ["compat"] } +arrayvec = "0.7.1" async-trait = "0.1" fnv = "1" futures = { version = "0.3.14", default-features = false, features = ["std"] } @@ -21,7 +22,7 @@ jsonrpsee-types = { path = "../types", version = "0.3.0" } log = "0.4" serde = "1" serde_json = "1" -soketto = "0.6" +soketto = "0.7" pin-project = "1" thiserror = "1" url = "2" diff --git a/ws-client/src/transport.rs b/ws-client/src/transport.rs index 7b999a4833..c7cbd8a64b 100644 --- a/ws-client/src/transport.rs +++ b/ws-client/src/transport.rs @@ -24,10 +24,11 @@ // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. +use arrayvec::ArrayVec; use futures::io::{BufReader, BufWriter}; use futures::prelude::*; use soketto::connection; -use soketto::handshake::client::{Client as WsRawClient, ServerResponse}; +use soketto::handshake::client::{Client as WsRawClient, Header, ServerResponse}; use std::{borrow::Cow, io, net::SocketAddr, sync::Arc, time::Duration}; use thiserror::Error; use tokio::net::TcpStream; @@ -234,10 +235,15 @@ impl<'a> WsTransportClientBuilder<'a> { &self.target.host_header, &self.target.path_and_query, ); + + let mut headers: ArrayVec = ArrayVec::new(); + if let Some(origin) = self.origin_header.as_ref() { - client.set_origin(origin); + headers.push(Header { name: "Origin", value: origin.as_bytes() }); } + client.set_headers(&headers); + // Perform the initial handshake. match client.handshake().await? { ServerResponse::Accepted { .. } => {} diff --git a/ws-server/Cargo.toml b/ws-server/Cargo.toml index 489e5f2017..6e9612b8e6 100644 --- a/ws-server/Cargo.toml +++ b/ws-server/Cargo.toml @@ -16,7 +16,7 @@ jsonrpsee-types = { path = "../types", version = "0.3.0" } jsonrpsee-utils = { path = "../utils", version = "0.3.0", features = ["server"] } log = "0.4" serde_json = { version = "1", features = ["raw_value"] } -soketto = "0.6" +soketto = "0.7" tokio = { version = "1", features = ["net", "rt-multi-thread", "macros"] } tokio-util = { version = "0.6", features = ["compat"] }