diff --git a/Cargo.lock b/Cargo.lock index 4fc9457..bdc53b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1468,7 +1468,7 @@ dependencies = [ [[package]] name = "webtransport-quinn" -version = "0.6.0" +version = "0.6.1" dependencies = [ "anyhow", "async-std", diff --git a/webtransport-quinn/Cargo.toml b/webtransport-quinn/Cargo.toml index 3c0b8ea..49f9dd6 100644 --- a/webtransport-quinn/Cargo.toml +++ b/webtransport-quinn/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Luke Curley"] repository = "https://github.com/kixelated/webtransport-rs" license = "MIT" -version = "0.6.0" +version = "0.6.1" edition = "2021" keywords = ["quic", "http3", "webtransport"] @@ -25,6 +25,7 @@ thiserror = "1" futures = "0.3" async-std = "1" url = "2" +log = "0.4" # This is just for AsyncRead/AsyncWrite and does NOT pull in anything else tokio = "1" @@ -37,4 +38,3 @@ tokio = { version = "1", features = ["full"] } rustls = { version = "0.21", features = ["dangerous_configuration", "quic"] } env_logger = "0.10" clap = { version = "4", features = ["derive"] } -log = "0.4" diff --git a/webtransport-quinn/src/connect.rs b/webtransport-quinn/src/connect.rs index e0210ea..6215d16 100644 --- a/webtransport-quinn/src/connect.rs +++ b/webtransport-quinn/src/connect.rs @@ -61,12 +61,17 @@ impl Connect { Ok(req) => req, // We didn't have enough data in the buffer, so we'll read more and try again. - Err(webtransport_proto::ConnectError::UnexpectedEnd) => continue, + Err(webtransport_proto::ConnectError::UnexpectedEnd) => { + log::debug!("buffering CONNECT request"); + continue; + } // Some other fatal error. Err(e) => return Err(e.into()), }; + log::debug!("received CONNECT request: {:?}", request); + // The request was successfully decoded, so we can send a response. return Ok(Self { request, @@ -80,6 +85,8 @@ impl Connect { pub async fn respond(&mut self, status: http::StatusCode) -> Result<(), quinn::WriteError> { let resp = ConnectResponse { status }; + log::debug!("sending CONNECT response: {:?}", resp); + let mut buf = Vec::new(); resp.encode(&mut buf); @@ -95,6 +102,8 @@ impl Connect { // Create a new CONNECT request that we'll send using HTTP/3 let request = ConnectRequest { url: url.clone() }; + log::debug!("sending CONNECT request: {:?}", request); + // Encode our connect request into a buffer and write it to the stream. let mut buf = Vec::new(); request.encode(&mut buf); @@ -119,12 +128,17 @@ impl Connect { Ok(res) => res, // We didn't have enough data in the buffer, so we'll read more and try again. - Err(webtransport_proto::ConnectError::UnexpectedEnd) => continue, + Err(webtransport_proto::ConnectError::UnexpectedEnd) => { + log::debug!("buffering CONNECT response"); + continue; + } // Some other fatal error. Err(e) => return Err(e.into()), }; + log::debug!("received CONNECT response: {:?}", res); + // Throw an error if we didn't get a 200 OK. if res.status != http::StatusCode::OK { return Err(ConnectError::ErrorStatus(res.status)); diff --git a/webtransport-quinn/src/session.rs b/webtransport-quinn/src/session.rs index 13c4649..034eea3 100644 --- a/webtransport-quinn/src/session.rs +++ b/webtransport-quinn/src/session.rs @@ -248,7 +248,10 @@ impl SessionAccept { StreamUni::QPACK_ENCODER => { self.qpack_encoder = Some(recv); } - _ => {} // ignore unknown streams + _ => { + // ignore unknown streams + log::debug!("ignoring unknown unidirectional stream: {:?}", typ); + } } } } @@ -314,6 +317,7 @@ impl SessionAccept { ) -> Result, SessionError> { let typ = Self::read_varint(&mut recv).await?; if Frame(typ) != Frame::WEBTRANSPORT { + log::debug!("ignoring unknown bidirectional stream: {:?}", typ); return Ok(None); } diff --git a/webtransport-quinn/src/settings.rs b/webtransport-quinn/src/settings.rs index 3d72d8d..34b71b2 100644 --- a/webtransport-quinn/src/settings.rs +++ b/webtransport-quinn/src/settings.rs @@ -63,6 +63,8 @@ impl Settings { Err(e) => return Err(e.into()), }; + log::debug!("received SETTINGS frame: {:?}", settings); + if settings.supports_webtransport() == 0 { return Err(SettingsError::WebTransportUnsupported); } @@ -75,6 +77,8 @@ impl Settings { let mut settings = webtransport_proto::Settings::default(); settings.enable_webtransport(1); + log::debug!("sending SETTINGS frame: {:?}", settings); + let mut buf = Vec::new(); settings.encode(&mut buf);