This is an automated email from the ASF dual-hosted git repository. masaori pushed a commit to branch quic-latest in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push: new 59014a4 HTTP/3: load settings from records.config 59014a4 is described below commit 59014a46f0f07c0d60a16fa8bb1144e40c61f882 Author: Masaori Koshiba <masa...@apache.org> AuthorDate: Tue Feb 5 10:30:07 2019 +0900 HTTP/3: load settings from records.config Below configs are added - proxy.config.http3.header_table_size - proxy.config.http3.max_header_list_size - proxy.config.http3.qpack_blocked_streams - proxy.config.http3.num_placeholders --- mgmt/RecordsConfig.cc | 15 ++++++ proxy/http3/Http3App.cc | 28 +++++++++-- proxy/http3/Http3Config.cc | 93 ++++++++++++++++++++++++++++++++++++ proxy/http3/Http3Config.h | 60 +++++++++++++++++++++++ proxy/http3/Makefile.am | 3 +- src/traffic_server/traffic_server.cc | 4 ++ 6 files changed, 199 insertions(+), 4 deletions(-) diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index 624f44d..8e0cdce 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -1334,6 +1334,21 @@ static const RecordElement RecordsConfig[] = //############ //# + //# HTTP/3 global configuration. + //# + //############ + {RECT_CONFIG, "proxy.config.http3.header_table_size", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} + , + {RECT_CONFIG, "proxy.config.http3.max_header_list_size", RECD_INT, "4096", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} + , + {RECT_CONFIG, "proxy.config.http3.qpack_blocked_streams", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} + , + {RECT_CONFIG, "proxy.config.http3.num_placeholders", RECD_INT, "100", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} + , + + + //############ + //# //# QUIC global configuration. //# //############ diff --git a/proxy/http3/Http3App.cc b/proxy/http3/Http3App.cc index 0718862..7369908 100644 --- a/proxy/http3/Http3App.cc +++ b/proxy/http3/Http3App.cc @@ -26,6 +26,7 @@ #include "P_Net.h" #include "P_VConnection.h" +#include "Http3Config.h" #include "Http3DebugNames.h" #include "Http3ClientSession.h" #include "Http3ClientTransaction.h" @@ -33,6 +34,12 @@ static constexpr char tag[] = "http3"; static constexpr char tag_v[] = "v_http3"; +// Default values of settings defined by specs. +static constexpr uint32_t HTTP3_DEFAULT_HEADER_TABLE_SIZE = 0; +static constexpr uint32_t HTTP3_DEFAULT_MAX_HEADER_LIST_SIZE = UINT32_MAX; +static constexpr uint32_t HTTP3_DEFAULT_QPACK_BLOCKED_STREAMS = 0; +static constexpr uint32_t HTTP3_DEFAULT_NUM_PLACEHOLDERS = 0; + Http3App::Http3App(QUICNetVConnection *client_vc, IpAllow::ACL session_acl) : QUICApplication(client_vc) { this->_client_session = new Http3ClientSession(client_vc); @@ -303,7 +310,6 @@ Http3SettingsHandler::handle_frame(std::shared_ptr<const Http3Frame> frame) // // SETTINGS frame framer // -// TODO: load values from config Http3FrameUPtr Http3SettingsFramer::generate_frame(uint16_t max_size) { @@ -313,10 +319,26 @@ Http3SettingsFramer::generate_frame(uint16_t max_size) this->_is_sent = true; + Http3Config::scoped_config params; + Http3SettingsFrame *frame = http3SettingsFrameAllocator.alloc(); new (frame) Http3SettingsFrame(); - frame->set(Http3SettingsId::HEADER_TABLE_SIZE, 0x0); - frame->set(Http3SettingsId::NUM_PLACEHOLDERS, 100); + + if (params->header_table_size() != HTTP3_DEFAULT_HEADER_TABLE_SIZE) { + frame->set(Http3SettingsId::HEADER_TABLE_SIZE, params->header_table_size()); + } + + if (params->max_header_list_size() != HTTP3_DEFAULT_MAX_HEADER_LIST_SIZE) { + frame->set(Http3SettingsId::NUM_PLACEHOLDERS, params->max_header_list_size()); + } + + if (params->qpack_blocked_streams() != HTTP3_DEFAULT_QPACK_BLOCKED_STREAMS) { + frame->set(Http3SettingsId::QPACK_BLOCKED_STREAMS, params->qpack_blocked_streams()); + } + + if (params->num_placeholders() != HTTP3_DEFAULT_NUM_PLACEHOLDERS) { + frame->set(Http3SettingsId::NUM_PLACEHOLDERS, params->num_placeholders()); + } return Http3SettingsFrameUPtr(frame, &Http3FrameDeleter::delete_settings_frame); } diff --git a/proxy/http3/Http3Config.cc b/proxy/http3/Http3Config.cc new file mode 100644 index 0000000..87c33f7 --- /dev/null +++ b/proxy/http3/Http3Config.cc @@ -0,0 +1,93 @@ +/** @file + * + * HTTP/3 Config + * + * @section license License + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "Http3Config.h" + +int Http3Config::_config_id = 0; + +// +// Http3ConfigParams +// +void +Http3ConfigParams::initialize() +{ + REC_EstablishStaticConfigInt32U(this->_header_table_size, "proxy.config.http3.header_table_size"); + REC_EstablishStaticConfigInt32U(this->_max_header_list_size, "proxy.config.http3.max_header_list_size"); + REC_EstablishStaticConfigInt32U(this->_qpack_blocked_streams, "proxy.config.http3.qpack_blocked_streams"); + REC_EstablishStaticConfigInt32U(this->_num_placeholders, "proxy.config.http3.num_placeholders"); +} + +uint32_t +Http3ConfigParams::header_table_size() const +{ + return this->_header_table_size; +} + +uint32_t +Http3ConfigParams::max_header_list_size() const +{ + return this->_max_header_list_size; +} + +uint32_t +Http3ConfigParams::qpack_blocked_streams() const +{ + return this->_qpack_blocked_streams; +} + +uint32_t +Http3ConfigParams::num_placeholders() const +{ + return this->_num_placeholders; +} + +// +// Http3Config +// +void +Http3Config::startup() +{ + reconfigure(); +} + +void +Http3Config::reconfigure() +{ + Http3ConfigParams *params; + params = new Http3ConfigParams; + // re-read configuration + params->initialize(); + Http3Config::_config_id = configProcessor.set(Http3Config::_config_id, params); +} + +Http3ConfigParams * +Http3Config::acquire() +{ + return static_cast<Http3ConfigParams *>(configProcessor.get(Http3Config::_config_id)); +} + +void +Http3Config::release(Http3ConfigParams *params) +{ + configProcessor.release(Http3Config::_config_id, params); +} diff --git a/proxy/http3/Http3Config.h b/proxy/http3/Http3Config.h new file mode 100644 index 0000000..9694765 --- /dev/null +++ b/proxy/http3/Http3Config.h @@ -0,0 +1,60 @@ +/** @file + * + * HTTP/3 Config + * + * @section license License + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "ProxyConfig.h" + +class Http3ConfigParams : public ConfigInfo +{ +public: + Http3ConfigParams(){}; + ~Http3ConfigParams(){}; + + void initialize(); + + uint32_t header_table_size() const; + uint32_t max_header_list_size() const; + uint32_t qpack_blocked_streams() const; + uint32_t num_placeholders() const; + +private: + uint32_t _header_table_size = 0; + uint32_t _max_header_list_size = 0; + uint32_t _qpack_blocked_streams = 0; + uint32_t _num_placeholders = 0; +}; + +class Http3Config +{ +public: + static void startup(); + static void reconfigure(); + static Http3ConfigParams *acquire(); + static void release(Http3ConfigParams *params); + + using scoped_config = ConfigProcessor::scoped_config<Http3Config, Http3ConfigParams>; + +private: + static int _config_id; +}; diff --git a/proxy/http3/Makefile.am b/proxy/http3/Makefile.am index 5fd1c50..50e51b8 100644 --- a/proxy/http3/Makefile.am +++ b/proxy/http3/Makefile.am @@ -1,5 +1,5 @@ # -# Makefile.am for HTTP over QUIC +# Makefile.am for HTTP/3 # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -36,6 +36,7 @@ noinst_LIBRARIES = libhttp3.a libhttp3_a_SOURCES = \ Http3.cc \ + Http3Config.cc \ Http3App.cc \ Http3Types.cc \ Http3SessionAccept.cc \ diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index 478469a..477fa79 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -99,6 +99,7 @@ extern "C" int plock(int); #if TS_USE_QUIC == 1 #include "Http3.h" +#include "Http3Config.h" #endif #include "tscore/ink_cap.h" @@ -1741,6 +1742,9 @@ main(int /* argc ATS_UNUSED */, const char **argv) // We want to initialize Machine as early as possible because it // has other dependencies. Hopefully not in prep_HttpProxyServer(). HttpConfig::startup(); +#if TS_USE_QUIC == 1 + Http3Config::startup(); +#endif /* Set up the machine with the outbound address if that's set, or the inbound address if set, otherwise let it default.