14namespace proto_fuzzer {
18constexpr int kConnectFlushBufferBytes = 2048;
27H2CleartextMockServer::~H2CleartextMockServer() {
30 retained_multi_.reset();
38 (void)curl_easy_setopt(easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
39 (void)curl_easy_setopt(easy, CURLOPT_UPKEEP_INTERVAL_MS, 0L);
47 if (connect_flush_probe_) {
51 connection->ApplyBackpressure(kConnectFlushBufferBytes, 0);
68 runtime_.PrepareMulti(multi, scenario.accept_h2_push());
69 if (connect_flush_probe_) {
74 (void)curl_easy_setopt(easy, CURLOPT_CONNECT_ONLY, 1L);
78 }
else if (!scenario.has_http2_plan()) {
85 runtime_.ResetPlan(scenario.http2_plan(),
"http");
89 runtime_.ApplyPostHeadersTransition(easy);
std::size_t cleaned_push_count() const
const H2Runtime & runtime() const
Expose shared protocol observations without allowing carrier state changes.
void HandleDetachedMulti(CurlMultiPtr multi) override
Retain the detached connection cache until after caller-owned easy cleanup.
void Install(CURL *easy) override
Install the socketpair peer and force HTTP/2 prior-knowledge mode.
void RunLoop(CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override
Drive raw or structured H2 peer work and probe server push and upkeep.
std::unique_ptr< MockConnection > CreateConnection() override
Attach the reusable H2 client-frame tracker to the plaintext connection.
H2CleartextMockServer(bool connect_flush_probe=false)
Construct a prior-knowledge peer, optionally with a full client send path.
Protocol state shared by TLS and plaintext HTTP/2 origin peers.
virtual void Install(CURL *easy)
Install the common OPENSOCKETFUNCTION / OPENSOCKETDATA / SOCKOPTFUNCTION callbacks on 'easy'.
std::size_t additional_handle_cleanup_count() const
MockConnection * connection()
static constexpr int kMaxDriveIterations
Hard operation budget for one scenario.
void ResumeResponseIfRequested(CURL *easy)
Resume receive-side callback output at one bounded drive boundary when the dedicated API plan request...
static constexpr int kMaxIdleIterations
Consecutive no-progress budget for ordinary scenarios.
void ResetConnections()
Release all current and retired socketpairs before resetting transport- specific state.
void SetKeepConnectionsOpen(bool keep_open)
Keep completed response sockets writable instead of half-closing them.
void RunLoop(CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override
Seed the mock from the scenario, then drive the perform loop until curl is done or a deterministic op...
void SetScripts(const curl::fuzzer::proto::Scenario &scenario)
Build the complete borrowed script table before entering curl.
virtual std::unique_ptr< MockConnection > CreateConnection()
Construct the transport used for one HTTP exchange.
virtual void ObserveActiveTransfer(CURL *easy)
Observe curl while its connection filters are still attached.
std::unique_ptr< CURLM, CurlMultiDeleter > CurlMultiPtr
Unique ownership of a CURL multi handle.
Plaintext HTTP/2 prior-knowledge origin peer.