mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 22:10:01 -04:00
add useragent to ws requests
This commit is contained in:
parent
0aec6e563c
commit
b5263a06fa
5 changed files with 8 additions and 6 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -522,7 +522,7 @@ checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
|
|||
|
||||
[[package]]
|
||||
name = "epoxy-client"
|
||||
version = "2.0.0"
|
||||
version = "2.0.2"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"async-trait",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "epoxy-client"
|
||||
version = "2.0.1"
|
||||
version = "2.0.2"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@mercuryworkshop/epoxy-tls",
|
||||
"version": "2.0.1-1",
|
||||
"version": "2.0.2-1",
|
||||
"description": "A wasm library for using raw encrypted tls/ssl/https/websocket streams on the browser",
|
||||
"scripts": {
|
||||
"build": "./build.sh"
|
||||
|
|
|
@ -247,7 +247,7 @@ impl EpoxyClient {
|
|||
protocols: Vec<String>,
|
||||
headers: JsValue,
|
||||
) -> Result<EpoxyWebSocket, EpoxyError> {
|
||||
EpoxyWebSocket::connect(self, handlers, url, protocols, headers).await
|
||||
EpoxyWebSocket::connect(self, handlers, url, protocols, headers, &self.user_agent).await
|
||||
}
|
||||
|
||||
pub async fn connect_tcp(
|
||||
|
|
|
@ -9,7 +9,7 @@ use futures_util::lock::Mutex;
|
|||
use getrandom::getrandom;
|
||||
use http::{
|
||||
header::{
|
||||
CONNECTION, HOST, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_PROTOCOL, SEC_WEBSOCKET_VERSION, UPGRADE,
|
||||
CONNECTION, HOST, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_PROTOCOL, SEC_WEBSOCKET_VERSION, UPGRADE, USER_AGENT,
|
||||
},
|
||||
Method, Request, Response, StatusCode, Uri,
|
||||
};
|
||||
|
@ -38,6 +38,7 @@ impl EpoxyWebSocket {
|
|||
url: String,
|
||||
protocols: Vec<String>,
|
||||
headers: JsValue,
|
||||
user_agent: &str,
|
||||
) -> Result<Self, EpoxyError> {
|
||||
let EpoxyHandlers {
|
||||
onopen,
|
||||
|
@ -61,7 +62,8 @@ impl EpoxyWebSocket {
|
|||
.header(CONNECTION, "upgrade")
|
||||
.header(UPGRADE, "websocket")
|
||||
.header(SEC_WEBSOCKET_KEY, key)
|
||||
.header(SEC_WEBSOCKET_VERSION, "13");
|
||||
.header(SEC_WEBSOCKET_VERSION, "13")
|
||||
.header(USER_AGENT, user_agent);
|
||||
|
||||
if !protocols.is_empty() {
|
||||
request = request.header(SEC_WEBSOCKET_PROTOCOL, protocols.join(","));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue