This is an automated email from the ASF dual-hosted git repository.
maskit 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 2416a781cf http3: Separate out Http3SettingsFramer (#11082)
2416a781cf is described below
commit 2416a781cff9c0dd56f6d554cded1cd605acf385
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Mon Feb 19 09:23:00 2024 -0700
http3: Separate out Http3SettingsFramer (#11082)
---
include/proxy/http3/Http3App.h | 16 --------
include/proxy/http3/Http3SettingsFramer.h | 42 +++++++++++++++++++
src/proxy/http3/CMakeLists.txt | 1 +
src/proxy/http3/Http3App.cc | 46 +--------------------
src/proxy/http3/Http3SettingsFramer.cc | 67 +++++++++++++++++++++++++++++++
5 files changed, 111 insertions(+), 61 deletions(-)
diff --git a/include/proxy/http3/Http3App.h b/include/proxy/http3/Http3App.h
index 8b9d1cad02..50c05137a2 100644
--- a/include/proxy/http3/Http3App.h
+++ b/include/proxy/http3/Http3App.h
@@ -35,7 +35,6 @@
#include "proxy/http3/Http3Types.h"
#include "proxy/http3/Http3FrameDispatcher.h"
#include "proxy/http3/Http3FrameCollector.h"
-#include "proxy/http3/Http3FrameGenerator.h"
#include "proxy/http3/Http3FrameHandler.h"
#include "proxy/http3/QPACK.h"
@@ -94,18 +93,3 @@ private:
bool _is_control_stream_initialized = false;
};
-
-class Http3SettingsFramer : public Http3FrameGenerator
-{
-public:
- Http3SettingsFramer(NetVConnectionContext_t context) : _context(context){};
-
- // Http3FrameGenerator
- Http3FrameUPtr generate_frame() override;
- bool is_done() const override;
-
-private:
- NetVConnectionContext_t _context;
- bool _is_done = false; ///< Be careful when setting FIN flag on CONTROL
stream. Maybe never?
- bool _is_sent = false; ///< Send SETTINGS frame only once
-};
diff --git a/include/proxy/http3/Http3SettingsFramer.h
b/include/proxy/http3/Http3SettingsFramer.h
new file mode 100644
index 0000000000..c72a840e2a
--- /dev/null
+++ b/include/proxy/http3/Http3SettingsFramer.h
@@ -0,0 +1,42 @@
+/** @file
+ *
+ * A brief file description
+ *
+ * @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 "proxy/http3/Http3FrameGenerator.h"
+#include "proxy/http3/Http3.h"
+
+class Http3SettingsFramer : public Http3FrameGenerator
+{
+public:
+ Http3SettingsFramer(NetVConnectionContext_t context) : _context(context){};
+
+ // Http3FrameGenerator
+ Http3FrameUPtr generate_frame() override;
+ bool is_done() const override;
+
+private:
+ NetVConnectionContext_t _context;
+ bool _is_done = false; ///< Be careful when setting FIN flag on CONTROL
stream. Maybe never?
+ bool _is_sent = false; ///< Send SETTINGS frame only once
+};
diff --git a/src/proxy/http3/CMakeLists.txt b/src/proxy/http3/CMakeLists.txt
index 37e00b918d..9089b72cad 100644
--- a/src/proxy/http3/CMakeLists.txt
+++ b/src/proxy/http3/CMakeLists.txt
@@ -35,6 +35,7 @@ add_library(
Http3HeaderVIOAdaptor.cc
Http3ProtocolEnforcer.cc
Http3SettingsHandler.cc
+ Http3SettingsFramer.cc
Http3StreamDataVIOAdaptor.cc
QPACK.cc
)
diff --git a/src/proxy/http3/Http3App.cc b/src/proxy/http3/Http3App.cc
index c453950b6e..579b55eaef 100644
--- a/src/proxy/http3/Http3App.cc
+++ b/src/proxy/http3/Http3App.cc
@@ -39,6 +39,7 @@
#include "proxy/http3/Http3Transaction.h"
#include "proxy/http3/Http3ProtocolEnforcer.h"
#include "proxy/http3/Http3SettingsHandler.h"
+#include "proxy/http3/Http3SettingsFramer.h"
static constexpr char debug_tag[] = "http3";
static constexpr char debug_tag_v[] = "v_http3";
@@ -424,48 +425,3 @@ Http3App::_handle_bidi_stream_on_write_complete(int event,
VIO *vio)
this->_qc->stream_manager()->delete_stream(stream_id);
this->_streams.erase(stream_id);
}
-
-//
-// SETTINGS frame framer
-//
-Http3FrameUPtr
-Http3SettingsFramer::generate_frame()
-{
- if (this->_is_sent) {
- return Http3FrameFactory::create_null_frame();
- }
-
- this->_is_sent = true;
-
- ts::Http3Config::scoped_config params;
-
- Http3SettingsFrame *frame = http3SettingsFrameAllocator.alloc();
- new (frame) Http3SettingsFrame();
-
- if (params->header_table_size() != HTTP3_DEFAULT_HEADER_TABLE_SIZE) {
- frame->set(Http3SettingsId::HEADER_TABLE_SIZE,
params->header_table_size());
- }
-
- if (params->max_field_section_size() !=
HTTP3_DEFAULT_MAX_FIELD_SECTION_SIZE) {
- frame->set(Http3SettingsId::MAX_FIELD_SECTION_SIZE,
params->max_field_section_size());
- }
-
- if (params->qpack_blocked_streams() != HTTP3_DEFAULT_QPACK_BLOCKED_STREAMS) {
- frame->set(Http3SettingsId::QPACK_BLOCKED_STREAMS,
params->qpack_blocked_streams());
- }
-
- // Server side only
- if (this->_context == NET_VCONNECTION_IN) {
- if (params->num_placeholders() != HTTP3_DEFAULT_NUM_PLACEHOLDERS) {
- frame->set(Http3SettingsId::NUM_PLACEHOLDERS,
params->num_placeholders());
- }
- }
-
- return Http3SettingsFrameUPtr(frame,
&Http3FrameDeleter::delete_settings_frame);
-}
-
-bool
-Http3SettingsFramer::is_done() const
-{
- return this->_is_done;
-}
diff --git a/src/proxy/http3/Http3SettingsFramer.cc
b/src/proxy/http3/Http3SettingsFramer.cc
new file mode 100644
index 0000000000..9ba20af754
--- /dev/null
+++ b/src/proxy/http3/Http3SettingsFramer.cc
@@ -0,0 +1,67 @@
+/** @file
+ *
+ * A brief file description
+ *
+ * @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 "proxy/http3/Http3SettingsFramer.h"
+#include "proxy/http3/Http3Config.h"
+
+Http3FrameUPtr
+Http3SettingsFramer::generate_frame()
+{
+ if (this->_is_sent) {
+ return Http3FrameFactory::create_null_frame();
+ }
+
+ this->_is_sent = true;
+
+ ts::Http3Config::scoped_config params;
+
+ Http3SettingsFrame *frame = http3SettingsFrameAllocator.alloc();
+ new (frame) Http3SettingsFrame();
+
+ if (params->header_table_size() != HTTP3_DEFAULT_HEADER_TABLE_SIZE) {
+ frame->set(Http3SettingsId::HEADER_TABLE_SIZE,
params->header_table_size());
+ }
+
+ if (params->max_field_section_size() !=
HTTP3_DEFAULT_MAX_FIELD_SECTION_SIZE) {
+ frame->set(Http3SettingsId::MAX_FIELD_SECTION_SIZE,
params->max_field_section_size());
+ }
+
+ if (params->qpack_blocked_streams() != HTTP3_DEFAULT_QPACK_BLOCKED_STREAMS) {
+ frame->set(Http3SettingsId::QPACK_BLOCKED_STREAMS,
params->qpack_blocked_streams());
+ }
+
+ // Server side only
+ if (this->_context == NET_VCONNECTION_IN) {
+ if (params->num_placeholders() != HTTP3_DEFAULT_NUM_PLACEHOLDERS) {
+ frame->set(Http3SettingsId::NUM_PLACEHOLDERS,
params->num_placeholders());
+ }
+ }
+
+ return Http3SettingsFrameUPtr(frame,
&Http3FrameDeleter::delete_settings_frame);
+}
+
+bool
+Http3SettingsFramer::is_done() const
+{
+ return this->_is_done;
+}