Commit 1e733ef1 authored by jan.koester's avatar jan.koester
Browse files

test

parent f47dd313
Loading
Loading
Loading
Loading
+5 −29
Original line number Diff line number Diff line
@@ -6812,7 +6812,7 @@ void quic::sendHandshakeDone() {

    // If ALPN is HTTP/3, send the mandatory control streams (RFC 9114 §6.2.1)
    if (_selected_alpn == "h3" || _selected_alpn == "h3-29") {
        sendHttp3ControlStreams();
        sendControlStreams();
    }
}

@@ -6976,35 +6976,11 @@ void quic::processNewSessionTicket(const std::vector<uint8_t>& msg) {
// ============================================================================
// HTTP/3: Send mandatory control streams (RFC 9114 §6.2.1)
// ============================================================================
// Base is a no-op: the control/QPACK-encoder/QPACK-decoder stream framing
// is HTTP/3 (application-layer) knowledge, not QUIC transport. libhttppp
// provides the real implementation via an override (Http3QuicSocket).

void quic::sendHttp3ControlStreams() {
    if (_h3_ctrl_sent) return;
    _h3_ctrl_sent = true;
    QUIC_DBG("sendHttp3ControlStreams: sending control, QPACK encoder, QPACK decoder streams");
    
    // 1. Control stream (stream type 0x00) with SETTINGS frame
    //    RFC 9114 §6.2.1: Each side MUST initiate a single control stream
    //    and send its SETTINGS frame as the first frame on this stream.
    uint64_t ctrl_id = openStream(false);  // server-initiated unidirectional
    std::vector<uint8_t> ctrl_data;
    ctrl_data.push_back(0x00);  // Stream type: Control
    // SETTINGS frame (type 0x04) with empty payload (use defaults)
    ctrl_data.push_back(0x04);  // Frame type: SETTINGS
    ctrl_data.push_back(0x00);  // Frame length: 0
    sendStreamData(ctrl_id, ctrl_data, false);
    
    // 2. QPACK encoder stream (stream type 0x02)
    //    RFC 9204 §4.2: required for QPACK header compression
    uint64_t enc_id = openStream(false);
    std::vector<uint8_t> enc_data;
    enc_data.push_back(0x02);  // Stream type: QPACK Encoder
    sendStreamData(enc_id, enc_data, false);
    
    // 3. QPACK decoder stream (stream type 0x03)
    uint64_t dec_id = openStream(false);
    std::vector<uint8_t> dec_data;
    dec_data.push_back(0x03);  // Stream type: QPACK Decoder
    sendStreamData(dec_id, dec_data, false);
void quic::sendControlStreams() {
}

// ============================================================================
+5 −2
Original line number Diff line number Diff line
@@ -1188,7 +1188,11 @@ namespace netplus {
		// stream — independently rederives the same resumption PSK the
		// server used and stores the ticket for getSessionTicket().
		void processNewSessionTicket(const std::vector<uint8_t>& msg);
		void sendHttp3ControlStreams();
		// HTTP/3-specific (SETTINGS + QPACK encoder/decoder streams); the
		// base implementation is a no-op since that framing is HTTP-layer
		// knowledge, not QUIC transport. libhttppp overrides this with the
		// real implementation — see libhttppp::Http3QuicSocket.
		virtual void sendControlStreams();
		void completeHandshake();

		// Packet number handling
@@ -1199,7 +1203,6 @@ namespace netplus {
		bool _is_server = false;
		bool _handshake_complete = false;
		bool _serverhello_sent = false;  // Track if ServerHello has been sent
		bool _h3_ctrl_sent = false;      // Track if HTTP/3 control streams have been sent
		uint32_t _version = QUIC_VERSION_1;

		// SNI (Server Name Indication)