Use client-supplied path instead of external configuration to switch between ECHO and DISCARD mode in QuicTransportSimpleServer
gfe-relnote: n/a (not used in production)
PiperOrigin-RevId: 284186862
Change-Id: Iaed82071af43f509c3d8104b143f2ff9f76efdb1
diff --git a/quic/tools/quic_transport_simple_server_session.cc b/quic/tools/quic_transport_simple_server_session.cc
index 40e5af3..9a0a667 100644
--- a/quic/tools/quic_transport_simple_server_session.cc
+++ b/quic/tools/quic_transport_simple_server_session.cc
@@ -133,7 +133,6 @@
const ParsedQuicVersionVector& supported_versions,
const QuicCryptoServerConfig* crypto_config,
QuicCompressedCertsCache* compressed_certs_cache,
- Mode mode,
std::vector<url::Origin> accepted_origins)
: QuicTransportServerSession(connection,
owner,
@@ -144,7 +143,7 @@
this),
connection_(connection),
owns_connection_(owns_connection),
- mode_(mode),
+ mode_(DISCARD),
accepted_origins_(accepted_origins) {}
QuicTransportSimpleServerSession::~QuicTransportSimpleServerSession() {
@@ -203,8 +202,17 @@
}
bool QuicTransportSimpleServerSession::ProcessPath(const GURL& url) {
- QUIC_DLOG(INFO) << "Path requested: " << url;
- return true;
+ if (url.path() == "/discard") {
+ mode_ = DISCARD;
+ return true;
+ }
+ if (url.path() == "/echo") {
+ mode_ = ECHO;
+ return true;
+ }
+
+ QUIC_DLOG(WARNING) << "Unknown path requested: " << url.path();
+ return false;
}
void QuicTransportSimpleServerSession::MaybeEchoStreamsBack() {