Skip to content

Commit

Permalink
session_request: don't expose proto-headers, use std hashmap
Browse files Browse the repository at this point in the history
  • Loading branch information
BiagioFesta committed Jul 29, 2023
1 parent 06d8293 commit 55d9a7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions wtransport-proto/src/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ where
}
}

impl AsRef<HashMap<String, String>> for Headers {
fn as_ref(&self) -> &HashMap<String, String> {
&self.0
}
}

impl From<StreamId> for ls_qpack::StreamId {
#[inline(always)]
fn from(value: StreamId) -> Self {
Expand Down
7 changes: 4 additions & 3 deletions wtransport/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::driver::Driver;
use crate::error::ConnectingError;
use crate::error::ConnectionError;
use quinn::Endpoint as QuicEndpoint;
use std::collections::HashMap;
use std::future::Future;
use std::marker::PhantomData;
use std::net::SocketAddr;
Expand Down Expand Up @@ -311,9 +312,9 @@ impl SessionRequest {
self.stream_session.request().user_agent()
}

/// Returns the whole headers associated with the request.
pub fn headers(&self) -> &Headers {
self.stream_session.request().headers()
/// Returns all header fields associated with the request.
pub fn headers(&self) -> &HashMap<String, String> {
self.stream_session.request().headers().as_ref()
}

/// Accepts the client request and it establishes the WebTransport session.
Expand Down

0 comments on commit 55d9a7f

Please sign in to comment.