This is an automated email from the ASF dual-hosted git repository.

duke8253 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 211caf6b05 add config to disable http/0.9 over QUIC by default (#9983)
211caf6b05 is described below

commit 211caf6b05a2958a00c2dcfd456ff88e896aef22
Author: Fei Deng <[email protected]>
AuthorDate: Tue Jul 11 10:36:41 2023 -0500

    add config to disable http/0.9 over QUIC by default (#9983)
---
 doc/admin-guide/files/records.yaml.en.rst | 4 ++++
 iocore/net/QUICNetProcessor_quiche.cc     | 9 ++++++++-
 iocore/net/quic/QUICConfig.cc             | 7 +++++++
 iocore/net/quic/QUICConfig.h              | 4 ++++
 proxy/http3/Http3SessionAccept.cc         | 1 -
 src/records/RecordsConfig.cc              | 2 ++
 6 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index e71f9d0e7f..78fbecb565 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -4854,6 +4854,10 @@ removed in the future without prior notice.
 
    Specified the maximum outgoing UDP payload size.
 
+.. ts:cv:: CONFIG proxy.config.quic.disable_http_0_9 INT 1
+
+   Disables HTTP/0.9 over QUIC by default.
+
 
 UDP Configuration
 =====================
diff --git a/iocore/net/QUICNetProcessor_quiche.cc 
b/iocore/net/QUICNetProcessor_quiche.cc
index 8bb8fe501c..3db2975138 100644
--- a/iocore/net/QUICNetProcessor_quiche.cc
+++ b/iocore/net/QUICNetProcessor_quiche.cc
@@ -79,7 +79,14 @@ QUICNetProcessor::start(int, size_t stacksize)
 
   quiche_enable_debug_logging(debug_log, NULL);
   this->_quiche_config = quiche_config_new(QUICHE_PROTOCOL_VERSION);
-  quiche_config_set_application_protos(this->_quiche_config, (uint8_t 
*)"\02h3\x05h3-29\x05hq-29\x05h3-27\x05hq-27", 27);
+
+  std::string quic_app_protos = "\02h3\x05h3-29\x05h3-27";
+  if (!params->disable_http_0_9()) {
+    quic_app_protos = "\02h3\x05h3-29\x05hq-29\x05h3-27\x05hq-27\0";
+  }
+  quiche_config_set_application_protos(this->_quiche_config,
+                                       const_cast<uint8_t 
*>(reinterpret_cast<const uint8_t *>(quic_app_protos.c_str())),
+                                       quic_app_protos.size());
 
   quiche_config_set_max_idle_timeout(this->_quiche_config, 
params->no_activity_timeout_in());
   quiche_config_set_max_recv_udp_payload_size(this->_quiche_config, 
params->get_max_recv_udp_payload_size_in());
diff --git a/iocore/net/quic/QUICConfig.cc b/iocore/net/quic/QUICConfig.cc
index 9c91441f28..7a948eb855 100644
--- a/iocore/net/quic/QUICConfig.cc
+++ b/iocore/net/quic/QUICConfig.cc
@@ -160,6 +160,7 @@ QUICConfigParams::initialize()
   REC_EstablishStaticConfigInt32U(this->_max_recv_udp_payload_size_out, 
"proxy.config.quic.max_recv_udp_payload_size_out");
   REC_EstablishStaticConfigInt32U(this->_max_send_udp_payload_size_in, 
"proxy.config.quic.max_send_udp_payload_size_in");
   REC_EstablishStaticConfigInt32U(this->_max_send_udp_payload_size_out, 
"proxy.config.quic.max_send_udp_payload_size_out");
+  REC_EstablishStaticConfigInt32U(this->_disable_http_0_9, 
"proxy.config.quic.disable_http_0_9");
 
   // Loss Detection
   REC_EstablishStaticConfigInt32U(this->_ld_packet_threshold, 
"proxy.config.quic.loss_detection.packet_threshold");
@@ -478,6 +479,12 @@ QUICConfigParams::get_qlog_file_base_name() const
   return this->_qlog_file_base_name;
 }
 
+bool
+QUICConfigParams::disable_http_0_9() const
+{
+  return this->_disable_http_0_9;
+}
+
 //
 // QUICConfig
 //
diff --git a/iocore/net/quic/QUICConfig.h b/iocore/net/quic/QUICConfig.h
index 7f0377a9a7..ccbdace0ca 100644
--- a/iocore/net/quic/QUICConfig.h
+++ b/iocore/net/quic/QUICConfig.h
@@ -98,6 +98,8 @@ public:
   static int connection_table_size();
   static uint8_t scid_len();
 
+  bool disable_http_0_9() const;
+
 private:
   static int _connection_table_size;
   // TODO: make configurable
@@ -150,6 +152,8 @@ private:
   uint32_t _max_send_udp_payload_size_in  = 0;
   uint32_t _max_send_udp_payload_size_out = 0;
 
+  uint32_t _disable_http_0_9 = 1;
+
   // [draft-17 recovery] 6.4.1.  Constants of interest
   uint32_t _ld_packet_threshold = 3;
   float _ld_time_threshold      = 1.25;
diff --git a/proxy/http3/Http3SessionAccept.cc 
b/proxy/http3/Http3SessionAccept.cc
index 4ad848605f..ab00d0aa20 100644
--- a/proxy/http3/Http3SessionAccept.cc
+++ b/proxy/http3/Http3SessionAccept.cc
@@ -64,7 +64,6 @@ Http3SessionAccept::accept(NetVConnection *netvc, MIOBuffer 
*iobuf, IOBufferRead
 
   if (IP_PROTO_TAG_HTTP_QUIC.compare(alpn) == 0 || 
IP_PROTO_TAG_HTTP_QUIC_D29.compare(alpn) == 0) {
     Debug("http3", "[%s] start HTTP/0.9 app (ALPN=%.*s)", qvc->cids().data(), 
static_cast<int>(alpn.length()), alpn.data());
-
     new Http09App(qvc, std::move(session_acl), this->options);
   } else if (IP_PROTO_TAG_HTTP_3.compare(alpn) == 0 || 
IP_PROTO_TAG_HTTP_3_D29.compare(alpn) == 0) {
     Debug("http3", "[%s] start HTTP/3 app (ALPN=%.*s)", qvc->cids().data(), 
static_cast<int>(alpn.length()), alpn.data());
diff --git a/src/records/RecordsConfig.cc b/src/records/RecordsConfig.cc
index c827cb4be1..65a00a6b02 100644
--- a/src/records/RecordsConfig.cc
+++ b/src/records/RecordsConfig.cc
@@ -1470,6 +1470,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.quic.max_send_udp_payload_size_out", RECD_INT, 
"65527", RECU_DYNAMIC, RR_NULL, RECC_NULL, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.quic.disable_http_0_9", RECD_INT, "1", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "[0-1]", RECA_NULL}
+  ,
 
   // Constants of Loss Detection
   {RECT_CONFIG, "proxy.config.quic.loss_detection.packet_threshold", RECD_INT, 
"3", RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}

Reply via email to