@@ -770,6 +770,7 @@ impl Http3Connection {
770
770
output
771
771
}
772
772
773
+ // TODO: Rename?
773
774
fn create_fetch_headers < ' b , ' t , T > ( request : & RequestDescription < ' b , ' t , T > ) -> Res < Vec < Header > >
774
775
where
775
776
T : AsRequestTarget < ' t > + ?Sized + Debug ,
@@ -780,12 +781,28 @@ impl Http3Connection {
780
781
. map_err ( |_| Error :: InvalidRequestTarget ) ?;
781
782
782
783
// Transform pseudo-header fields
783
- let mut final_headers = vec ! [
784
- Header :: new( ":method" , request. method) ,
785
- Header :: new( ":scheme" , target. scheme( ) ) ,
786
- Header :: new( ":authority" , target. authority( ) ) ,
787
- Header :: new( ":path" , target. path( ) ) ,
788
- ] ;
784
+ // TODO: Remove hack for classic CONNECT
785
+ let is_classic_connect = request. connect_type . is_none ( )
786
+ && request
787
+ . headers
788
+ . iter ( )
789
+ . any ( |h| h. name ( ) == ":method" && h. value ( ) == "CONNECT" ) ;
790
+ let mut final_headers = if is_classic_connect {
791
+ // > The :scheme and :path pseudo-header fields are omitted
792
+ //
793
+ // <https://datatracker.ietf.org/doc/html/rfc9114#section-4.4>
794
+ vec ! [
795
+ Header :: new( ":method" , request. method) ,
796
+ Header :: new( ":authority" , target. authority( ) ) ,
797
+ ]
798
+ } else {
799
+ vec ! [
800
+ Header :: new( ":method" , request. method) ,
801
+ Header :: new( ":scheme" , target. scheme( ) ) ,
802
+ Header :: new( ":authority" , target. authority( ) ) ,
803
+ Header :: new( ":path" , target. path( ) ) ,
804
+ ]
805
+ } ;
789
806
if let Some ( conn_type) = request. connect_type {
790
807
final_headers. push ( Header :: new ( ":protocol" , conn_type. string ( ) ) ) ;
791
808
}
@@ -847,6 +864,7 @@ impl Http3Connection {
847
864
{
848
865
let final_headers = Self :: create_fetch_headers ( request) ?;
849
866
867
+ // TODO: Why is this here? WebTransport goes a different route, no?
850
868
let stream_type = if request. connect_type . is_some ( ) {
851
869
Http3StreamType :: ExtendedConnect
852
870
} else {
@@ -1109,7 +1127,6 @@ impl Http3Connection {
1109
1127
where
1110
1128
T : AsRequestTarget < ' x > + ?Sized + Debug ,
1111
1129
{
1112
-
1113
1130
let id = self . create_bidi_transport_stream ( conn) ?;
1114
1131
1115
1132
let extended_conn = Rc :: new ( RefCell :: new ( Session :: new (
@@ -1632,11 +1649,7 @@ impl Http3Connection {
1632
1649
Ok ( ( ) )
1633
1650
}
1634
1651
1635
- fn remove_extended_connect (
1636
- & mut self ,
1637
- wt : & Rc < RefCell < Session > > ,
1638
- conn : & mut Connection ,
1639
- ) {
1652
+ fn remove_extended_connect ( & mut self , wt : & Rc < RefCell < Session > > , conn : & mut Connection ) {
1640
1653
let ( recv, send) = wt. borrow_mut ( ) . take_sub_streams ( ) ;
1641
1654
1642
1655
#[ expect(
@@ -1690,7 +1703,11 @@ impl Http3Connection {
1690
1703
let stream = self . send_streams . remove ( & stream_id) ;
1691
1704
if let Some ( s) = & stream {
1692
1705
if s. stream_type ( ) == Http3StreamType :: ExtendedConnect {
1693
- if let Some ( wt) = self . recv_streams . remove ( & stream_id) ?. extended_connect_session ( ) {
1706
+ if let Some ( wt) = self
1707
+ . recv_streams
1708
+ . remove ( & stream_id) ?
1709
+ . extended_connect_session ( )
1710
+ {
1694
1711
self . remove_extended_connect ( & wt, conn) ;
1695
1712
}
1696
1713
}
0 commit comments