Commit 4b925100 authored by jan.koester's avatar jan.koester
Browse files

move http crap to libhttppp

parent 1e733ef1
Loading
Loading
Loading
Loading
+14 −17
Original line number Diff line number Diff line
@@ -6983,6 +6983,17 @@ void quic::processNewSessionTicket(const std::vector<uint8_t>& msg) {
void quic::sendControlStreams() {
}

// ============================================================================
// TLS 1.3: Build ALPN extension (0x0010) for EncryptedExtensions
// ============================================================================
// Base is a no-op: which protocol string to advertise (and to whom) is
// HTTP-layer policy, not QUIC transport. libhttppp provides the real
// implementation via an override (Http3QuicSocket).

std::vector<uint8_t> quic::buildAlpnExtension(const std::string& /*alpn*/) {
    return {};
}

// ============================================================================
// Socket Interface: sendData (Send application data)
// ============================================================================
@@ -8405,23 +8416,9 @@ void quic::sendServerHandshakeFlight() {
    // Build extensions data
    std::vector<uint8_t> ext_data;
    
    // Extension 1: ALPN (0x0010) - negotiate h3 for HTTP/3
    if (!_selected_alpn.empty()) {
        ext_data.push_back(0x00);
        ext_data.push_back(0x10);  // ALPN extension type
        // Extension length: 2 (list len) + 1 (proto len) + proto.size()
        size_t alpn_ext_len = 2 + 1 + _selected_alpn.size();
        ext_data.push_back(static_cast<uint8_t>(alpn_ext_len >> 8));
        ext_data.push_back(static_cast<uint8_t>(alpn_ext_len));
        // ALPN list length
        size_t alpn_list_len = 1 + _selected_alpn.size();
        ext_data.push_back(static_cast<uint8_t>(alpn_list_len >> 8));
        ext_data.push_back(static_cast<uint8_t>(alpn_list_len));
        // Protocol length and value
        ext_data.push_back(static_cast<uint8_t>(_selected_alpn.size()));
        ext_data.insert(ext_data.end(), _selected_alpn.begin(), _selected_alpn.end());
        
    }
    // Extension 1: ALPN (0x0010)
    std::vector<uint8_t> alpn_ext = buildAlpnExtension(_selected_alpn);
    ext_data.insert(ext_data.end(), alpn_ext.begin(), alpn_ext.end());
    
    // Extension 2: quic_transport_parameters (0x0039)
    std::vector<uint8_t> transport_params = buildTransportParameters();
+6 −0
Original line number Diff line number Diff line
@@ -1193,6 +1193,12 @@ namespace netplus {
		// knowledge, not QUIC transport. libhttppp overrides this with the
		// real implementation — see libhttppp::Http3QuicSocket.
		virtual void sendControlStreams();
		// ALPN extension (0x0010) for the EncryptedExtensions message. Which
		// protocol string to advertise and how is HTTP-layer policy, not
		// QUIC transport, so the base implementation is a no-op (no ALPN
		// extension sent). libhttppp overrides this with the real
		// implementation — see libhttppp::Http3QuicSocket.
		virtual std::vector<uint8_t> buildAlpnExtension(const std::string& alpn);
		void completeHandshake();

		// Packet number handling