Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/http/codec.h" 4 : #include "envoy/registry/registry.h" 5 : 6 : #include "source/common/common/assert.h" 7 : #include "source/common/common/logger.h" 8 : #include "source/common/quic/codec_impl.h" 9 : #include "source/common/quic/envoy_quic_server_session.h" 10 : #include "source/common/quic/server_connection_factory.h" 11 : 12 : namespace Envoy { 13 : namespace Quic { 14 : 15 : class QuicHttpServerConnectionImpl : public QuicHttpConnectionImplBase, 16 : public Http::ServerConnection { 17 : public: 18 : QuicHttpServerConnectionImpl( 19 : EnvoyQuicServerSession& quic_session, Http::ServerConnectionCallbacks& callbacks, 20 : Http::Http3::CodecStats& stats, 21 : const envoy::config::core::v3::Http3ProtocolOptions& http3_options, 22 : const uint32_t max_request_headers_kb, const uint32_t max_request_headers_count, 23 : envoy::config::core::v3::HttpProtocolOptions::HeadersWithUnderscoresAction 24 : headers_with_underscores_action); 25 : 26 : // Http::Connection 27 : void goAway() override; 28 : void shutdownNotice() override; 29 : void onUnderlyingConnectionAboveWriteBufferHighWatermark() override; 30 : void onUnderlyingConnectionBelowWriteBufferLowWatermark() override; 31 : 32 0 : EnvoyQuicServerSession& quicServerSession() { return quic_server_session_; } 33 : 34 : private: 35 : EnvoyQuicServerSession& quic_server_session_; 36 : }; 37 : 38 : class QuicHttpServerConnectionFactoryImpl : public QuicHttpServerConnectionFactory { 39 : public: 40 : std::unique_ptr<Http::ServerConnection> createQuicHttpServerConnectionImpl( 41 : Network::Connection& connection, Http::ServerConnectionCallbacks& callbacks, 42 : Http::Http3::CodecStats& stats, 43 : const envoy::config::core::v3::Http3ProtocolOptions& http3_options, 44 : const uint32_t max_request_headers_kb, const uint32_t max_request_headers_count, 45 : envoy::config::core::v3::HttpProtocolOptions::HeadersWithUnderscoresAction 46 0 : headers_with_underscores_action) override { 47 0 : return std::make_unique<QuicHttpServerConnectionImpl>( 48 0 : dynamic_cast<Quic::EnvoyQuicServerSession&>(connection), callbacks, stats, http3_options, 49 0 : max_request_headers_kb, max_request_headers_count, headers_with_underscores_action); 50 0 : } 51 14 : std::string name() const override { return "quic.http_server_connection.default"; } 52 : }; 53 : 54 : DECLARE_FACTORY(QuicHttpServerConnectionFactoryImpl); 55 : 56 : } // namespace Quic 57 : } // namespace Envoy