|
curl-fuzzer C++ reference
|
In-process HTTP/3 server backed by ngtcp2 and OpenSSL TLS. More...
#include <http3_mock_server.h>
Public Member Functions | |
| Http3MockServer () | |
| Construct a peer with the default checked-in EC certificate. | |
| Http3MockServer (curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain) | |
| Construct a peer with a bounded, parseable certificate-chain profile. | |
| void | ObserveState () override |
| Retain protocol outcomes in coverage and introspector builds. | |
| void | Install (CURL *easy) override |
| Install UDP socket callbacks, the local trust anchor, and HTTP/3-only negotiation on an easy handle. | |
| bool | handshake_complete () const |
| bool | request_headers_received () const |
| std::size_t | executed_action_count () const |
| std::uint16_t | server_port () const |
| 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 | ConfigureRequestData (ScenarioRequestData *request_data) |
| Bind protocol-specific work to the request-data callbacks after their per-scenario state has been constructed. | |
| 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. | |
| virtual CURLcode | DriveEasyScenario (CURL *easy, const curl::fuzzer::proto::Scenario &scenario, bool use_events=false) |
| Run through the public easy entrypoint when a protocol mock can preload all peer work before curl takes control. | |
| virtual ConnectOnlyRunStats | DriveConnectOnlyScenario (CURL *easy, const curl::fuzzer::proto::Scenario &scenario) |
| Establish a CONNECT_ONLY transport, then perform bounded direct I/O. | |
| 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 | |
| curl_socket_t | HandleOpenSocket (curlsocktype purpose, struct curl_sockaddr *address) override |
| Create curl's real UDP descriptor and rewrite its destination to the private loopback QUIC listener. | |
| SocketSetupDisposition | GetSocketSetupDisposition (curl_socket_t curlfd, curlsocktype purpose) const override |
| HTTP/3 returns an unconnected UDP descriptor, so curl must perform its normal socket setup before using the rewritten loopback destination. | |
| void | RunLoop (CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override |
| Alternate nonblocking curl and QUIC server turns under fixed operation and idle budgets. | |
| 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 void | HandleDetachedMulti (CurlMultiPtr multi) |
| Dispose of or retain the multi after its easy handle has been removed. | |
| 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. | |
In-process HTTP/3 server backed by ngtcp2 and OpenSSL TLS.
The peer uses a real nonblocking IPv4 UDP socket, negotiates TLS 1.3 and ALPN h3, and lets nghttp3 generate protocol-valid structured responses. Raw Http3StreamWrite actions deliberately bypass nghttp3 and write their bytes straight to an established QUIC stream. Open-unidirectional-stream actions additionally create an unbound stream whose first byte is entirely mutation-controlled. ngtcp2 applies QUIC framing and uses OpenSSL's EVP/TLS integration for encryption, so malformed HTTP/3/QPACK plaintext reaches curl only after a valid transport handshake.
Definition at line 34 of file http3_mock_server.h.
|
explicit |
Construct a peer with a bounded, parseable certificate-chain profile.
| certificate_chain | Certificate material presented during QUIC TLS. |
Definition at line 1551 of file http3_mock_server.cc.
| std::size_t proto_fuzzer::Http3MockServer::executed_action_count | ( | ) | const |
Definition at line 1579 of file http3_mock_server.cc.
|
overrideprotectedvirtual |
HTTP/3 returns an unconnected UDP descriptor, so curl must perform its normal socket setup before using the rewritten loopback destination.
| curlfd | Descriptor returned by HandleOpenSocket. |
| purpose | Role curl assigned to the descriptor. |
Reimplemented from proto_fuzzer::MockServerBase.
Definition at line 1600 of file http3_mock_server.cc.
|
overrideprotectedvirtual |
Create curl's real UDP descriptor and rewrite its destination to the private loopback QUIC listener.
| purpose | Socket purpose supplied by curl's open-socket callback. |
| address | Mutable destination description supplied by curl. |
Implements proto_fuzzer::MockServerBase.
Definition at line 1591 of file http3_mock_server.cc.
| bool proto_fuzzer::Http3MockServer::handshake_complete | ( | ) | const |
Definition at line 1573 of file http3_mock_server.cc.
|
overridevirtual |
Install UDP socket callbacks, the local trust anchor, and HTTP/3-only negotiation on an easy handle.
| easy | Easy handle that will connect to the in-process QUIC peer. |
Reimplemented from proto_fuzzer::MockServerBase.
Definition at line 1560 of file http3_mock_server.cc.
| bool proto_fuzzer::Http3MockServer::request_headers_received | ( | ) | const |
Definition at line 1576 of file http3_mock_server.cc.
|
overrideprotectedvirtual |
Alternate nonblocking curl and QUIC server turns under fixed operation and idle budgets.
| multi | Multi handle containing the scenario's easy handle. |
| easy | Easy handle being driven; all work is reached through multi. |
| scenario | Scenario whose Http3Plan supplies ordered plaintext work. |
Implements proto_fuzzer::MockServerBase.
Definition at line 1610 of file http3_mock_server.cc.
| std::uint16_t proto_fuzzer::Http3MockServer::server_port | ( | ) | const |
Definition at line 1584 of file http3_mock_server.cc.