curl-fuzzer C++ reference
Loading...
Searching...
No Matches
h2_cleartext_mock_server.h
Go to the documentation of this file.
1/*
2 * Copyright (C) Max Dymond, <cmeister2@gmail.com>, et al.
3 *
4 * SPDX-License-Identifier: curl
5 */
6
9
10#ifndef PROTO_FUZZER_H2_CLEARTEXT_MOCK_SERVER_H_
11#define PROTO_FUZZER_H2_CLEARTEXT_MOCK_SERVER_H_
12
13#include <curl/curl.h>
14
15#include <cstddef>
16#include <memory>
17
20
21namespace proto_fuzzer {
22
27class H2CleartextMockServer final : public MockServer {
28 public:
29 explicit H2CleartextMockServer(bool connect_flush_probe = false);
30 ~H2CleartextMockServer() override;
31
32 void Install(CURL* easy) override;
33
34 const H2Runtime& runtime() const;
35 std::size_t cleaned_push_count() const;
36
37 protected:
38 std::unique_ptr<MockConnection> CreateConnection() override;
39
40 void RunLoop(CURLM* multi, CURL* easy, const curl::fuzzer::proto::Scenario& scenario) override;
41
42 void HandleDetachedMulti(CurlMultiPtr multi) override;
43
44 private:
45 const bool connect_flush_probe_;
46 H2Runtime runtime_;
47 CurlMultiPtr retained_multi_;
48};
49
50} // namespace proto_fuzzer
51
52#endif // PROTO_FUZZER_H2_CLEARTEXT_MOCK_SERVER_H_
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.
Definition h2_runtime.h:33
MockServer(MultiDrivePolicy drive_policy=MultiDrivePolicy::kPerform)
Construct an idle MockServer with no scripted responses or open peers.
std::unique_ptr< CURLM, CurlMultiDeleter > CurlMultiPtr
Unique ownership of a CURL multi handle.
Definition curl_raii.h:58
Shared HTTP/2 plan, push, and upkeep behavior for origin peers.
MockConnection and MockServer — the in-process peer that feeds canned response bytes to libcurl over ...