Commit a7af54f1 authored by jan.koester's avatar jan.koester
Browse files

test

parent b34cbd9a
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -260,6 +260,7 @@ void libhttppp::HttpClient::resetConnection(){
  _h2PrefaceSent = false;
  _h2NextStreamId = 1;
  _h2Decoder.reset();
  _h3ControlSent = false;
  if (_url.getProtocol() == HttpUrl::HTTP3) {
    _cltsock = std::make_unique<netplus::quic>();
    _cltsock->connect(_url.getHost(), _url.getPort(), false);
@@ -1020,6 +1021,30 @@ const std::vector<char> libhttppp::HttpClient::_h2Request(
      throw ee;
    }

    // Send HTTP/3 control streams once per connection (RFC 9114 §6.2)
    if (!_h3ControlSent) {
      // 1) Control stream: unidirectional, stream type 0x00, then SETTINGS frame
      uint64_t ctrl_id = q->openStream(false);
      std::vector<uint8_t> ctrl_payload;
      ctrl_payload.push_back(0x00); // stream type: control
      // SETTINGS frame: type=0x04, length=0 (accept all defaults)
      ctrl_payload.push_back(0x04); // frame type
      ctrl_payload.push_back(0x00); // frame length (empty)
      q->sendStreamData(ctrl_id, ctrl_payload, false);

      // 2) QPACK encoder stream: unidirectional, stream type 0x02
      uint64_t enc_id = q->openStream(false);
      std::vector<uint8_t> enc_payload = {0x02};
      q->sendStreamData(enc_id, enc_payload, false);

      // 3) QPACK decoder stream: unidirectional, stream type 0x03
      uint64_t dec_id = q->openStream(false);
      std::vector<uint8_t> dec_payload = {0x03};
      q->sendStreamData(dec_id, dec_payload, false);

      _h3ControlSent = true;
    }

    const int kMaxRedirects = 1;
    int redirects = 0;

+3 −0
Original line number Diff line number Diff line
@@ -112,6 +112,9 @@ namespace libhttppp {
      // HTTP/2 client helpers
      bool _isH2 = false;
      bool _h2PrefaceSent = false;       // true after connection preface sent

      // HTTP/3 client helpers
      bool _h3ControlSent = false;       // true after H3 control streams sent
      uint32_t _h2NextStreamId = 1;     // next client-initiated stream ID (odd)
      std::unique_ptr<hpack::Decoder> _h2Decoder; // persistent HPACK decoder for connection
      const std::vector<char> _h2Request(const std::string &method,