|
curl-fuzzer C++ reference
|
Resolver-lane peer that answers curl's internal DoH queries from a loopback HTTP or HTTPS listener and completes the selected outer HTTPS/ALPN h2 exchange through a separate in-process TLS transport. More...
#include <doh_https_rr_mock_server.h>
Public Member Functions | |
| DohHttpsRrMockServer (const curl::fuzzer::proto::Scenario &scenario) | |
| Construct an idle responder. | |
| ~DohHttpsRrMockServer () override | |
| Release the loopback listener and restore the proxy environment before the base carrier tears down its TLS context. | |
| void | Install (CURL *easy) override |
| Bind the DoH listener, point CURLOPT_DOH_URL at it, and bypass ambient proxies for curl's internal handle. | |
| void | ConfigureRequestData (ScenarioRequestData *request_data) override |
| Reassert the listener URL and fixed H2 selection after the scenario's option prefix has run. | |
| std::size_t | doh_request_count () const |
| std::size_t | httpsrr_answer_count () const |
| const std::string & | doh_url () const |
| std::size_t | doh_tls_handshake_count () const |
| std::string | doh_tls_alpn () const |
| std::string | custom_stderr_contents () |
| Read a bounded prefix without changing the stream position retained by libcurl. | |
| bool | tls_path_fixture_ready () const |
| std::size_t | internal_ssl_ctx_callback_count () const |
| Public Member Functions inherited from proto_fuzzer::H2OriginMockServer | |
| H2OriginMockServer (curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain=curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC, curl::fuzzer::proto::TlsGroupProfile group_profile=curl::fuzzer::proto::TLS_GROUP_X25519) | |
| Construct an HTTP/2 TLS peer with the selected certificate chain. | |
| void | Install (CURL *easy) override |
| Keep transport selection out of the mutation grammar. | |
| const H2Runtime & | runtime () const |
| Expose shared protocol observations without allowing carrier state changes. | |
| std::size_t | cleaned_push_count () const |
| Public Member Functions inherited from proto_fuzzer::TlsMockServer | |
| TlsMockServer () | |
| Build one reusable in-process server context per fuzz iteration. | |
| TlsMockServer (curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain, curl::fuzzer::proto::TlsHandshakeProfile handshake_profile=curl::fuzzer::proto::TLS_HANDSHAKE_DEFAULT) | |
| Select one bounded certificate-chain profile for an HTTP/1.1 TLS peer. | |
| ~TlsMockServer () override | |
| Release SSL objects before their owning server context. | |
| void | Install (CURL *easy) override |
| Install common socket callbacks and a stable local trust anchor. | |
| bool | saw_live_tls_session () const |
| std::size_t | exported_session_count () const |
| std::size_t | imported_session_count () const |
| int | negotiated_tls_version () const |
| std::size_t | completed_handshake_count () const |
| std::size_t | reused_session_count () const |
| std::size_t | write_retry_count () const |
| std::string | negotiated_alpn () const |
| std::string | negotiated_group () const |
| int | ech_status () const |
| std::string | ech_inner_name () const |
| std::string | ech_outer_name () const |
| Public Member Functions inherited from proto_fuzzer::MockServer | |
| MockServer (MultiDrivePolicy drive_policy=MultiDrivePolicy::kPerform) | |
| Construct an idle MockServer with no scripted responses or open peers. | |
| ~MockServer () override | |
| Default destructor; current and previous MockConnections clean up their server-side descriptors only after curl has been removed from the multi. | |
| void | SetScripts (const curl::fuzzer::proto::Scenario &scenario) |
| Build the complete borrowed script table before entering curl. | |
| void | SetKeepConnectionsOpen (bool keep_open) |
| Keep completed response sockets writable instead of half-closing them. | |
| CURLcode | DriveEasyScenario (CURL *easy, const curl::fuzzer::proto::Scenario &scenario, bool use_events=false) override |
| Preload all bounded response bytes from inside OPENSOCKETFUNCTION, where the mock still owns both socketpair ends, and half-close the peer when the preload finishes. | |
| ConnectOnlyRunStats | DriveConnectOnlyScenario (CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override |
| Establish only the HTTP transport, then pass bounded application bytes through curl's public direct-I/O wrappers. | |
| bool | DeliverNextChunk () |
| Push the next queued chunk. | |
| bool | has_more_chunks () const |
| bool | ServiceConnections () |
| Service one deterministic application event-loop turn by draining all available request bytes and releasing at most one response chunk. | |
| std::size_t | opened_connection_count () const |
| Report how many peer sockets curl opened during the current script run. | |
| Public Member Functions inherited from proto_fuzzer::MockServerBase | |
| virtual | ~MockServerBase () |
| Out-of-line destructor so MockConnection can stay forward-declared in the base header (its complete type is only needed where unique_ptr is instantiated for destruction). | |
| virtual void | ObserveState () |
| Default no-op for peers without protocol-specific observations. | |
| CURLcode | DriveScenario (CURL *easy, const curl::fuzzer::proto::Scenario &scenario) |
| Run 'scenario' to completion on 'easy': allocate a multi, attach 'easy', delegate protocol-specific work to RunLoop, consume its completion message, and clean up. | |
| void | SetMultiObserver (MultiObserver observer) |
| Register an observer invoked with the live multi handle after 'easy' is attached and before the drive loop starts. | |
| MockConnection * | connection () |
Protected Member Functions | |
| void | ObserveActiveTransfer (CURL *easy) override |
| Observe the outer transfer and advance every pending DoH exchange. | |
| void | RunLoop (CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override |
| Refuse to enter libcurl when any local resolver setup step failed. | |
| Protected Member Functions inherited from proto_fuzzer::H2OriginMockServer | |
| std::unique_ptr< MockConnection > | CreateConnection () override |
| Attach the reusable H2 client-frame tracker after TLS decryption. | |
| void | RunLoop (CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override |
| Run the raw HTTP/2 response driver and probe server push and upkeep APIs. | |
| void | HandleDetachedMulti (CurlMultiPtr multi) override |
| Keep the connection cache alive until this mock is destroyed, after the caller has cleaned the detached easy handle. | |
| Protected Member Functions inherited from proto_fuzzer::TlsMockServer | |
| TlsMockServer (TlsApplicationProtocol protocol, curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain=curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC, TlsGroupPolicy group_policy=TlsGroupPolicy::kProviderDefault, curl::fuzzer::proto::TlsHandshakeProfile handshake_profile=curl::fuzzer::proto::TLS_HANDSHAKE_DEFAULT) | |
| Construct the shared TLS transport for a protocol-specific derived peer with one fixed ALPN outcome. | |
| TlsGroupPolicy | group_policy () const |
| std::unique_ptr< MockConnection > | CreateConnection () override |
| Wrap one socketpair server endpoint in an OpenSSL acceptor consumed by MockServer. | |
| void | ObserveActiveTransfer (CURL *easy) override |
| Query while the connection filters are attached. | |
| Protected Member Functions inherited from proto_fuzzer::MockServer | |
| void | ResetConnections () |
| Release all current and retired socketpairs before resetting transport- specific state. | |
| virtual bool | SupportsRepeatedPollsetProbe () const |
| Ordinary HTTP and compatibility peers retain the historical perform-only loop even if an append-only scenario field is present. | |
| curl_socket_t | HandleOpenSocket (curlsocktype purpose=CURLSOCKTYPE_IPCXN, struct curl_sockaddr *address=nullptr) override |
| Called by the OPENSOCKETFUNCTION trampoline in the base class. | |
| 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 operation/idle budget is hit. | |
| Protected Member Functions inherited from proto_fuzzer::MockServerBase | |
| MockServerBase (MultiDrivePolicy drive_policy=MultiDrivePolicy::kPerform) | |
| Construct an empty base instance with a fixed multi-drive policy. | |
| virtual SocketSetupDisposition | GetSocketSetupDisposition (curl_socket_t curlfd, curlsocktype purpose) const |
| Describe the socket returned by HandleOpenSocket without issuing native descriptor queries. | |
| MultiSocketDriver * | multi_socket_driver () |
| Expose the callback state installed for the current socket-action drive. | |
| std::size_t | additional_handle_cleanup_count () const |
| void | ResumeResponseIfRequested (CURL *easy) |
| Resume receive-side callback output at one bounded drive boundary when the dedicated API plan requested it. | |
| void | ApplyPendingBackpressure () |
| Apply the BackpressureConfig cached by DriveScenario to the new connection_. | |
Additional Inherited Members | |
| Public Types inherited from proto_fuzzer::MockServerBase | |
| using | MultiObserver = std::function<void(CURLM*)> |
| Callback type used to publish the driving multi handle to observers. | |
| Static Protected Member Functions inherited from proto_fuzzer::MockServerBase | |
| static int | WaitOnMultiFdset (CURLM *multi, CURLMcode *rc) |
| Wait on curl's fdset with a short timeout. | |
| static void | ProbeMultiPollset (CURLM *multi) |
| Ask curl to construct and inspect its connection-filter pollset without waiting. | |
| static bool | MultiPollsetWantsWrite (CURLM *multi, curl_socket_t socket) |
| Inspect one socket's current writable interest through curl's public multi fdset API. | |
| static bool | UsesTimedDrive (const curl::fuzzer::proto::Scenario &scenario) |
| Treat a non-default BackpressureConfig as an explicit request for the slower, timed drive policy. | |
| Protected Attributes inherited from proto_fuzzer::MockServerBase | |
| std::unique_ptr< MockConnection > | connection_ |
| The per-scenario MockConnection, lazily created by HandleOpenSocket(). | |
| int | pending_recv_buf_bytes_ |
| Cached SO_RCVBUF/SO_SNDBUF setting in bytes. | |
| std::size_t | pending_drain_limit_ |
| Cached per-call DrainIncoming byte budget. | |
| MultiSocketDriver * | multi_socket_driver_ |
| Non-owning pointer into DriveScenario's stack. | |
| std::size_t | additional_handle_cleanup_count_ |
| Number of application-created handles, excluding the caller's parent, successfully removed from the current multi and cleaned up. | |
| bool | resume_response_ |
| True only for an API-plan multi drive with its one-shot write callback. | |
| MultiObserver | multi_observer_ |
| Observer receiving the live multi handle at the start of a drive. | |
| Static Protected Attributes inherited from proto_fuzzer::MockServerBase | |
| static constexpr int | kMaxDriveIterations = 512 |
| Hard operation budget for one scenario. | |
| static constexpr int | kMaxIdleIterations = 8 |
| Consecutive no-progress budget for ordinary scenarios. | |
| static constexpr int | kMaxTimedIdleIterations = 256 |
| Explicit backpressure scenarios get a larger idle budget and may use the short timed wait above. | |
Resolver-lane peer that answers curl's internal DoH queries from a loopback HTTP or HTTPS listener and completes the selected outer HTTPS/ALPN h2 exchange through a separate in-process TLS transport.
curl creates and drives the DoH easy handle itself, so the harness socket callbacks do not reach it. A real 127.0.0.1 listener is therefore the only way to answer the HTTPS resource-record query that cf-https-connect reads. The synthesized answer advertises alpn=h2,h3; this peer owns the fixed h2 application protocol, so the selected transfer can complete when the build supports HTTP/2.
Definition at line 40 of file doh_https_rr_mock_server.h.
|
explicit |
Construct an idle responder.
The listener and proxy bypass are installed by Install(), after the TLS carrier has prepared the outer peer.
| scenario | Source of the fixed TLS, DoH, and ECH configuration. |
Definition at line 277 of file doh_https_rr_mock_server.cc.
|
overridevirtual |
Reassert the listener URL and fixed H2 selection after the scenario's option prefix has run.
The DoH URL is absent from the mutation grammar, but CURLOPT_HTTP_VERSION is useful in the ordinary resolver lane and must not override this peer's transport.
| request_data | Installed request state; unused by this transport. |
Reimplemented from proto_fuzzer::MockServerBase.
Definition at line 375 of file doh_https_rr_mock_server.cc.
| std::string proto_fuzzer::DohHttpsRrMockServer::custom_stderr_contents | ( | ) |
Read a bounded prefix without changing the stream position retained by libcurl.
The internal DoH request line appears before the outer transfer can connect, so the prefix is sufficient to distinguish internal diagnostics.
Definition at line 321 of file doh_https_rr_mock_server.cc.
|
inline |
Definition at line 53 of file doh_https_rr_mock_server.h.
|
inline |
Definition at line 67 of file doh_https_rr_mock_server.h.
|
inline |
Definition at line 62 of file doh_https_rr_mock_server.h.
|
inline |
Definition at line 59 of file doh_https_rr_mock_server.h.
|
inline |
Definition at line 56 of file doh_https_rr_mock_server.h.
|
overridevirtual |
Bind the DoH listener, point CURLOPT_DOH_URL at it, and bypass ambient proxies for curl's internal handle.
RunLoop refuses to drive the transfer after any partial setup so curl cannot fall back to an unrelated resolver.
| easy | Easy handle that will perform the HTTPS transfer. |
Reimplemented from proto_fuzzer::MockServerBase.
Definition at line 346 of file doh_https_rr_mock_server.cc.
|
inline |
Definition at line 76 of file doh_https_rr_mock_server.h.
|
overrideprotectedvirtual |
Observe the outer transfer and advance every pending DoH exchange.
curl owns the DoH easy handle, so this runs from the same deterministic outer loop that advances the mocked TLS connection.
| easy | Active easy handle whose TLS state is observed. |
Reimplemented from proto_fuzzer::MockServer.
Definition at line 407 of file doh_https_rr_mock_server.cc.
|
overrideprotectedvirtual |
Refuse to enter libcurl when any local resolver setup step failed.
Without a usable CURLOPT_DOH_URL, the HTTPS transfer would otherwise fall back to the process's native resolver before the socket callback can confine its destination.
| multi | Multi handle already containing easy. |
| easy | Easy handle driving the outer HTTPS transfer. |
| scenario | Source of the bounded HTTP/2 response plan. |
Implements proto_fuzzer::MockServerBase.
Definition at line 396 of file doh_https_rr_mock_server.cc.
| bool proto_fuzzer::DohHttpsRrMockServer::tls_path_fixture_ready | ( | ) | const |
Definition at line 338 of file doh_https_rr_mock_server.cc.