Ignore invalid values in WT-Protocol header rather than rejecting them. New version of the draft says we MUST. https://www.ietf.org/archive/id/draft-ietf-webtrans-http3-13.html#name-application-protocol-negoti PiperOrigin-RevId: 788890876
diff --git a/quiche/quic/core/http/quic_spdy_stream_test.cc b/quiche/quic/core/http/quic_spdy_stream_test.cc index 95e3ffb..575a64f 100644 --- a/quiche/quic/core/http/quic_spdy_stream_test.cc +++ b/quiche/quic/core/http/quic_spdy_stream_test.cc
@@ -3325,7 +3325,7 @@ EXPECT_EQ(stream_->web_transport()->GetNegotiatedSubprotocol(), "moqt-01"); } -TEST_P(QuicSpdyStreamTest, WebTransportRejectSubprotocolsThatWereNotOffered) { +TEST_P(QuicSpdyStreamTest, WebTransportIgnoreSubprotocolsThatWereNotOffered) { if (!UsesHttp3()) { return; } @@ -3354,7 +3354,7 @@ response_headers["wt-protocol"] = "\"moqt-02\""; stream_->web_transport()->HeadersReceived(response_headers); EXPECT_EQ(stream_->web_transport()->rejection_reason(), - WebTransportHttp3RejectionReason::kSubprotocolMismatch); + WebTransportHttp3RejectionReason::kNone); EXPECT_EQ(stream_->web_transport()->GetNegotiatedSubprotocol(), std::nullopt); } @@ -3387,7 +3387,7 @@ response_headers["wt-protocol"] = "12345.67"; stream_->web_transport()->HeadersReceived(response_headers); EXPECT_EQ(stream_->web_transport()->rejection_reason(), - WebTransportHttp3RejectionReason::kSubprotocolParseError); + WebTransportHttp3RejectionReason::kNone); EXPECT_EQ(stream_->web_transport()->GetNegotiatedSubprotocol(), std::nullopt); }
diff --git a/quiche/quic/core/http/web_transport_http3.cc b/quiche/quic/core/http/web_transport_http3.cc index 86d6086..e2d1466 100644 --- a/quiche/quic/core/http/web_transport_http3.cc +++ b/quiche/quic/core/http/web_transport_http3.cc
@@ -188,12 +188,7 @@ rejection_reason_ = WebTransportHttp3RejectionReason::kWrongStatusCode; return; } - WebTransportHttp3RejectionReason subprotocol_result = - MaybeSetSubprotocolFromResponseHeaders(headers); - if (subprotocol_result != WebTransportHttp3RejectionReason::kNone) { - rejection_reason_ = subprotocol_result; - return; - } + MaybeSetSubprotocolFromResponseHeaders(headers); } QUIC_DVLOG(1) << ENDPOINT << "WebTransport session " << id_ << " ready."; @@ -483,12 +478,11 @@ webtransport_error_code / 0x1e; } -WebTransportHttp3RejectionReason -WebTransportHttp3::MaybeSetSubprotocolFromResponseHeaders( +void WebTransportHttp3::MaybeSetSubprotocolFromResponseHeaders( const quiche::HttpHeaderBlock& headers) { auto subprotocol_it = headers.find(webtransport::kSubprotocolResponseHeader); if (subprotocol_it == headers.end()) { - return WebTransportHttp3RejectionReason::kNone; + return; } absl::StatusOr<std::string> subprotocol = @@ -496,8 +490,8 @@ if (!subprotocol.ok()) { QUIC_DVLOG(1) << ENDPOINT << "WebTransport server has malformed WT-Protocol " - "header, rejecting."; - return WebTransportHttp3RejectionReason::kSubprotocolParseError; + "header, ignoring."; + return; } if (session_->perspective() == Perspective::IS_CLIENT && @@ -505,12 +499,11 @@ QUIC_DVLOG(1) << ENDPOINT << "WebTransport server has offered a subprotocol value \"" << *subprotocol - << "\", which was not one of the ones offered, rejecting."; - return WebTransportHttp3RejectionReason::kSubprotocolMismatch; + << "\", which was not one of the ones offered, ignoring."; + return; } subprotocol_selected_ = *std::move(subprotocol); - return WebTransportHttp3RejectionReason::kNone; } } // namespace quic
diff --git a/quiche/quic/core/http/web_transport_http3.h b/quiche/quic/core/http/web_transport_http3.h index 789dc52..a360986 100644 --- a/quiche/quic/core/http/web_transport_http3.h +++ b/quiche/quic/core/http/web_transport_http3.h
@@ -38,8 +38,6 @@ kWrongStatusCode, kMissingDraftVersion, kUnsupportedDraftVersion, - kSubprotocolMismatch, - kSubprotocolParseError, }; // A session of WebTransport over HTTP/3. The session is owned by @@ -132,7 +130,7 @@ std::optional<std::string> GetNegotiatedSubprotocol() const override { return subprotocol_selected_; } - WebTransportHttp3RejectionReason MaybeSetSubprotocolFromResponseHeaders( + void MaybeSetSubprotocolFromResponseHeaders( const quiche::HttpHeaderBlock& headers); private: