mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-13 06:20:02 -04:00
fix r58 dum
This commit is contained in:
parent
656eb67bfb
commit
4081ea6cce
2 changed files with 12 additions and 5 deletions
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>epoxy</title>
|
<title>epoxy</title>
|
||||||
<script src="out.cjs"></script>
|
|
||||||
<script src="index.js"></script>
|
<script src="index.js"></script>
|
||||||
|
<script src="demo.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -26,7 +26,6 @@ pub struct EpxWebSocket {
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
impl EpxWebSocket {
|
impl EpxWebSocket {
|
||||||
#[wasm_bindgen(constructor)]
|
#[wasm_bindgen(constructor)]
|
||||||
/// DO NOT CALL THIS!!!!!!!!!!!!!!!!!!!
|
|
||||||
pub fn new() -> Result<EpxWebSocket, JsError> {
|
pub fn new() -> Result<EpxWebSocket, JsError> {
|
||||||
Err(jerr!("Use EpoxyClient.connect_ws() instead."))
|
Err(jerr!("Use EpoxyClient.connect_ws() instead."))
|
||||||
}
|
}
|
||||||
|
@ -51,9 +50,16 @@ impl EpxWebSocket {
|
||||||
let rand: [u8; 16] = rand::random();
|
let rand: [u8; 16] = rand::random();
|
||||||
let key = STANDARD.encode(rand);
|
let key = STANDARD.encode(rand);
|
||||||
|
|
||||||
|
|
||||||
|
let pathstr = if let Some(p) = url.path_and_query() {
|
||||||
|
p.to_string()
|
||||||
|
} else {
|
||||||
|
url.path().to_string()
|
||||||
|
};
|
||||||
|
|
||||||
let mut builder = Request::builder()
|
let mut builder = Request::builder()
|
||||||
.method("GET")
|
.method("GET")
|
||||||
.uri(url.clone())
|
.uri(pathstr)
|
||||||
.header("Host", host)
|
.header("Host", host)
|
||||||
.header("Origin", origin)
|
.header("Origin", origin)
|
||||||
.header(UPGRADE, "websocket")
|
.header(UPGRADE, "websocket")
|
||||||
|
@ -69,8 +75,9 @@ impl EpxWebSocket {
|
||||||
|
|
||||||
let stream = tcp.get_http_io(&url).await?;
|
let stream = tcp.get_http_io(&url).await?;
|
||||||
|
|
||||||
let (mut sender, conn) =
|
let (mut sender, conn) = Builder::new()
|
||||||
hyper_conn::handshake::<TokioIo<EpxStream>, Empty<Bytes>>(TokioIo::new(stream))
|
.title_case_headers(true)
|
||||||
|
.preserve_header_case(true).handshake::<TokioIo<EpxStream>, Empty<Bytes>>(TokioIo::new(stream))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
wasm_bindgen_futures::spawn_local(async move {
|
wasm_bindgen_futures::spawn_local(async move {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue