Skip to content

Commit 2de374f

Browse files
Joanna Jometa-codesync[bot]
authored andcommitted
Add WT_ENABLED setting
Summary: Adding new WT_ENABLED setting from H3 WebTransport draft 15: > When an HTTP/3 connection is established, the server sends a SETTINGS_WT_ENABLED setting to indicate support for WebTransport over HTTP/3. Reviewed By: hanidamlaj Differential Revision: D100703616 fbshipit-source-id: 1cbf5ea427e74be956078c94de1e2d169b759fda
1 parent 5a4806c commit 2de374f

8 files changed

Lines changed: 18 additions & 0 deletions

File tree

proxygen/lib/http/codec/H3EarlyDataHandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ bool isLimitSetting(hq::SettingId id) {
5151
case hq::SettingId::H3_DATAGRAM_DRAFT_8:
5252
case hq::SettingId::H3_DATAGRAM_RFC:
5353
case hq::SettingId::ENABLE_WEBTRANSPORT:
54+
case hq::SettingId::WT_ENABLED:
5455
return false;
5556
}
5657
// Unknown settings are treated as limits

proxygen/lib/http/codec/HQControlCodec.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ ParseResult HQControlCodec::parseSettings(Cursor& cursor,
105105
case hq::SettingId::H3_DATAGRAM_DRAFT_8:
106106
case hq::SettingId::H3_DATAGRAM_RFC:
107107
case hq::SettingId::ENABLE_WEBTRANSPORT:
108+
case hq::SettingId::WT_ENABLED:
108109
// only 0/1 are legal
109110
if (setting.second > 1) {
110111
return HTTP3::ErrorCode::HTTP_SETTINGS_ERROR;
@@ -234,6 +235,7 @@ size_t HQControlCodec::generateSettings(folly::IOBufQueue& writeBuf) {
234235
case hq::SettingId::ENABLE_WEBTRANSPORT:
235236
case hq::SettingId::H3_WT_MAX_SESSIONS:
236237
case hq::SettingId::WT_INITIAL_MAX_DATA:
238+
case hq::SettingId::WT_ENABLED:
237239
break;
238240
}
239241
settings.emplace_back(*id, (SettingValue)setting.value);

proxygen/lib/http/codec/HQFramer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ decodeSettingValue(folly::io::Cursor& cursor,
101101
case SettingId::ENABLE_WEBTRANSPORT:
102102
case SettingId::H3_WT_MAX_SESSIONS:
103103
case SettingId::WT_INITIAL_MAX_DATA:
104+
case SettingId::WT_ENABLED:
104105
return value;
105106
}
106107
return folly::none;

proxygen/lib/http/codec/HQFramer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ enum class SettingId : uint64_t {
103103
ENABLE_WEBTRANSPORT = 0x2b603742,
104104
H3_WT_MAX_SESSIONS = 0x14e9cd29,
105105
WT_INITIAL_MAX_DATA = 0x2b61,
106+
WT_ENABLED = 0x2c7cf000,
106107
};
107108

108109
using SettingValue = uint64_t;

proxygen/lib/http/codec/HQUtils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ folly::Optional<hq::SettingId> httpToHqSettingsId(proxygen::SettingsId id) {
9999
return hq::SettingId::H3_WT_MAX_SESSIONS;
100100
case proxygen::SettingsId::WT_INITIAL_MAX_DATA:
101101
return hq::SettingId::WT_INITIAL_MAX_DATA;
102+
case proxygen::SettingsId::WT_ENABLED:
103+
return hq::SettingId::WT_ENABLED;
102104
default:
103105
return folly::none; // this setting has no meaning in HQ
104106
}
@@ -126,6 +128,8 @@ folly::Optional<proxygen::SettingsId> hqToHttpSettingsId(hq::SettingId id) {
126128
return proxygen::SettingsId::H3_WT_MAX_SESSIONS;
127129
case hq::SettingId::WT_INITIAL_MAX_DATA:
128130
return proxygen::SettingsId::WT_INITIAL_MAX_DATA;
131+
case hq::SettingId::WT_ENABLED:
132+
return proxygen::SettingsId::WT_ENABLED;
129133
}
130134
return folly::none;
131135
}

proxygen/lib/http/codec/SettingsId.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ enum class SettingsId : uint64_t {
5151
_HQ_DATAGRAM_RFC = HQ_SETTINGS_MASK | 0x33,
5252
ENABLE_WEBTRANSPORT = 0x2b603742,
5353
H3_WT_MAX_SESSIONS = 0x14e9cd29,
54+
WT_ENABLED = 0x2c7cf000,
5455
};
5556

5657
using SettingPair = std::pair<SettingsId, uint32_t>;

proxygen/lib/http/coro/HTTPCoroSession.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ void HTTPQuicCoroSession::applyEgressSettings() {
775775
case hq::SettingId::ENABLE_WEBTRANSPORT:
776776
case hq::SettingId::H3_WT_MAX_SESSIONS:
777777
case hq::SettingId::WT_INITIAL_MAX_DATA:
778+
case hq::SettingId::WT_ENABLED:
778779
// TODO
779780
break;
780781
}
@@ -1608,6 +1609,7 @@ void HTTPQuicCoroSession::onSettings(const SettingsList& settings) {
16081609
case hq::SettingId::ENABLE_WEBTRANSPORT:
16091610
case hq::SettingId::H3_WT_MAX_SESSIONS:
16101611
case hq::SettingId::WT_INITIAL_MAX_DATA:
1612+
case hq::SettingId::WT_ENABLED:
16111613
// TODO
16121614
break;
16131615
}

proxygen/lib/http/session/HQSession.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ size_t HQSession::sendSettings() {
804804
case hq::SettingId::H3_DATAGRAM_RFC:
805805
case hq::SettingId::H3_WT_MAX_SESSIONS:
806806
case hq::SettingId::WT_INITIAL_MAX_DATA:
807+
case hq::SettingId::WT_ENABLED:
807808
break;
808809
case hq::SettingId::ENABLE_WEBTRANSPORT:
809810
if (setting.value) {
@@ -1585,6 +1586,11 @@ void HQSession::applySettings(const SettingsList& settings) {
15851586
VLOG(3) << "Peer sent WT_INITIAL_MAX_DATA=" << setting.value;
15861587
wtInitialSendWindow_ = setting.value;
15871588
break;
1589+
case hq::SettingId::WT_ENABLED:
1590+
// TODO: This part of the code needs a larger refactor. We shouldn't
1591+
// be setting supportsWebTransport_ unless: 1) WT_ENABLED =
1592+
// ENABLE_CONNECT_PROTOCOL = H3_DATAGRAM == 1 or 2) H3_DATAGRAM == 1
1593+
break;
15881594
}
15891595
}
15901596
}

0 commit comments

Comments
 (0)