10#ifndef PROTO_FUZZER_PROXY_OPTION_MOCK_SERVER_H_
11#define PROTO_FUZZER_PROXY_OPTION_MOCK_SERVER_H_
19#include "curl_fuzzer.pb.h"
24namespace proto_fuzzer {
39 void Install(CURL* easy)
override;
48 void RunLoop(CURLM* multi, CURL* easy,
const curl::fuzzer::proto::Scenario& scenario)
override;
51 bool BeginProxyEnvironment();
52 void EndProxyEnvironment();
54 static constexpr std::size_t kMaxTranscriptBytes = 64 * 1024;
56 curl::fuzzer::proto::ProxySocketOptionMode mode_;
58 bool proxy_environment_active_;
59 bool saved_http_proxy_was_set_;
60 std::string saved_http_proxy_;
61 std::string client_transcript_;
69 InterfaceOptionMockServer() =
default;
70 ~InterfaceOptionMockServer()
override =
default;
72 InterfaceOptionMockServer(
const InterfaceOptionMockServer&) =
delete;
73 InterfaceOptionMockServer& operator=(
const InterfaceOptionMockServer&) =
delete;
75 void Install(CURL* easy)
override;
HappyEyeballsMockServer()
Construct an idle peer with no listener or accepted connections.
Receives bytes after any transport decoding.
void Install(CURL *easy) override
Install the inherited owned loopback TCP listener, then require curl to perform its normal INET setup...
MockServer(MultiDrivePolicy drive_policy=MultiDrivePolicy::kPerform)
Construct an idle MockServer with no scripted responses or open peers.
ProxyOptionMockServer(curl::fuzzer::proto::ProxySocketOptionMode mode)
Construct an idle peer for one policy-normalized mode.
void RunLoop(CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override
Refuse to perform if the scoped environment or fixed setopts failed.
void ObserveIncomingData(const unsigned char *data, std::size_t size) override
Retain a bounded request transcript for exact routing assertions.
void Install(CURL *easy) override
Install socket callbacks and one fixed routing option.
std::unique_ptr< MockConnection > CreateConnection() override
Attach the transcript observer to a fresh in-process connection.
const std::string & client_transcript() const
~ProxyOptionMockServer() override
Restore process environment after curl has released the easy handle.
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
HappyEyeballsMockServer — a loopback peer that lets curl's happy-eyeballs connection filter race seve...
Optional observer for application bytes consumed by mock peers.
MockConnection and MockServer — the in-process peer that feeds canned response bytes to libcurl over ...