mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 14:00:01 -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>
|
||||
<title>epoxy</title>
|
||||
<script src="out.cjs"></script>
|
||||
<script src="index.js"></script>
|
||||
<script src="demo.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -26,7 +26,6 @@ pub struct EpxWebSocket {
|
|||
#[wasm_bindgen]
|
||||
impl EpxWebSocket {
|
||||
#[wasm_bindgen(constructor)]
|
||||
/// DO NOT CALL THIS!!!!!!!!!!!!!!!!!!!
|
||||
pub fn new() -> Result<EpxWebSocket, JsError> {
|
||||
Err(jerr!("Use EpoxyClient.connect_ws() instead."))
|
||||
}
|
||||
|
@ -51,9 +50,16 @@ impl EpxWebSocket {
|
|||
let rand: [u8; 16] = rand::random();
|
||||
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()
|
||||
.method("GET")
|
||||
.uri(url.clone())
|
||||
.uri(pathstr)
|
||||
.header("Host", host)
|
||||
.header("Origin", origin)
|
||||
.header(UPGRADE, "websocket")
|
||||
|
@ -69,8 +75,9 @@ impl EpxWebSocket {
|
|||
|
||||
let stream = tcp.get_http_io(&url).await?;
|
||||
|
||||
let (mut sender, conn) =
|
||||
hyper_conn::handshake::<TokioIo<EpxStream>, Empty<Bytes>>(TokioIo::new(stream))
|
||||
let (mut sender, conn) = Builder::new()
|
||||
.title_case_headers(true)
|
||||
.preserve_header_case(true).handshake::<TokioIo<EpxStream>, Empty<Bytes>>(TokioIo::new(stream))
|
||||
.await?;
|
||||
|
||||
wasm_bindgen_futures::spawn_local(async move {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue