Fix #216 packets get mangled when handling multiple connections

This commit is contained in:
Σrebe - Romain GERARD 2024-01-20 11:11:32 +01:00
parent 365ddd7875
commit cab43376e8
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
4 changed files with 47 additions and 45 deletions

View file

@ -116,10 +116,11 @@ pub async fn connect(
&client_cfg.http_upgrade_path_prefix
))
.header(COOKIE, tunnel_to_jwt_token(request_id, dest_addr))
.header(CONTENT_TYPE, "application/grpc+proto")
.header(CONTENT_TYPE, "application/json")
.version(hyper::Version::HTTP_2);
for (k, v) in &client_cfg.http_headers {
let _ = req.headers_mut().unwrap().remove(k);
req = req.header(k, v);
}
if let Some(auth) = &client_cfg.http_upgrade_credentials {

View file

@ -17,7 +17,7 @@ use std::io;
use std::io::ErrorKind;
use std::ops::DerefMut;
use tokio::io::{AsyncWrite, AsyncWriteExt, ReadHalf, WriteHalf};
use tracing::trace;
use tracing::{error, trace};
use uuid::Uuid;
pub struct WebsocketTunnelWrite {
@ -104,7 +104,7 @@ impl WebsocketTunnelRead {
}
fn frame_reader(x: Frame<'_>) -> futures_util::future::Ready<anyhow::Result<()>> {
debug!("frame {:?} {:?}", x.opcode, x.payload);
error!("frame {:?} {:?}", x.opcode, x.payload);
futures_util::future::ready(anyhow::Ok(()))
}
@ -157,6 +157,7 @@ pub async fn connect(
.version(hyper::Version::HTTP_11);
for (k, v) in &client_cfg.http_headers {
let _ = req.headers_mut().unwrap().remove(k);
req = req.header(k, v);
}
if let Some(auth) = &client_cfg.http_upgrade_credentials {