Skip to content

Commit e07e694

Browse files
authored
fix(client): Correct behavior of standard CONNECT (#322)
1 parent 18df8ce commit e07e694

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

h3/src/proto/headers.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,14 @@ impl Pseudo {
383383
None
384384
};
385385

386+
// For standard CONNECT (that is, without :protocol pseudo-header) scheme and path
387+
// are not set. See: [https://www.rfc-editor.org/rfc/rfc9114#section-4.4]
388+
let (scheme, path) = if method == Method::CONNECT && protocol.is_none() {
389+
(None, None)
390+
} else {
391+
(scheme.or(Some(Scheme::HTTPS)), Some(path))
392+
};
393+
386394
let len = 3 + authority.is_some() as usize + protocol.is_some() as usize;
387395

388396
//= https://www.rfc-editor.org/rfc/rfc9114#section-4.3
@@ -398,9 +406,9 @@ impl Pseudo {
398406
//# CONNECT request; see Section 4.4.
399407
Self {
400408
method: Some(method),
401-
scheme: scheme.or(Some(Scheme::HTTPS)),
409+
scheme,
402410
authority,
403-
path: Some(path),
411+
path,
404412
status: None,
405413
protocol,
406414
len,

0 commit comments

Comments
 (0)