curl-fuzzer C++ reference
Loading...
Searching...
No Matches
option_apply.h File Reference

Translates Scenario SetOption messages into curl_easy_setopt calls, plus the fixed baseline setopts the harness always applies. More...

Go to the source code of this file.

Classes

class  proto_fuzzer::ScopedTraceReset
 Reset curl's global trace configuration to a known off baseline for the lifetime of one input. More...

Functions

CurlSlistPtr proto_fuzzer::ApplyBaselineOptions (CURL *easy, curl::fuzzer::proto::Scheme scheme, bool trace_ids, const std::string &trace_config)
 Apply deterministic routing, timeout, output, and persistence defaults.
CURLcode proto_fuzzer::ApplySetOption (CURL *easy, const curl::fuzzer::proto::SetOption &option)
 Translate and apply one generated scalar/string SetOption to the easy handle.
CURLcode proto_fuzzer::ApplyTlsClientCredentialProfile (CURL *easy, curl::fuzzer::proto::TlsClientCredentialProfile profile)
 Apply one closed, harness-owned TLS client-credential configuration.
std::size_t proto_fuzzer::RuntimeOptionCount (const curl::fuzzer::proto::Scenario &scenario)
 Return the runtime-visible option prefix length.
std::size_t proto_fuzzer::ApplyScenarioOptions (CURL *easy, const curl::fuzzer::proto::Scenario &scenario)
 Apply the bounded runtime-visible prefix of Scenario.options.

Detailed Description

Translates Scenario SetOption messages into curl_easy_setopt calls, plus the fixed baseline setopts the harness always applies.

Definition in file option_apply.h.

Function Documentation

◆ ApplyBaselineOptions()

CurlSlistPtr proto_fuzzer::ApplyBaselineOptions ( CURL * easy,
curl::fuzzer::proto::Scheme scheme,
bool trace_ids,
const std::string & trace_config )

Apply deterministic routing, timeout, output, and persistence defaults.

Call before applying scenario options. scheme identifies the dedicated in-process mock that will service the transfer and selects the safe direct- protocol allowlist.

Parameters
easyThe curl easy handle to configure.
schemeProtocol whose dedicated in-process mock will service it.
trace_idsEnable verbose LIB-IDS tracing for this scenario.
trace_configOptional curl_global_trace() configuration.
Returns
Owner of the CURLOPT_CONNECT_TO list, which must outlive easy cleanup.

Definition at line 96 of file option_apply.cc.

◆ ApplyScenarioOptions()

std::size_t proto_fuzzer::ApplyScenarioOptions ( CURL * easy,
const curl::fuzzer::proto::Scenario & scenario )

Apply the bounded runtime-visible prefix of Scenario.options.

Individual CURLcode values remain intentionally ignored, matching the fuzzer runner's historical behavior. Bounding here also covers standalone compatibility seeds that reach RunScenario without normalization.

Parameters
easyEasy handle receiving each supported option.
scenarioStructured input that owns all borrowed option strings.
Returns
Number of option entries attempted.

Definition at line 402 of file option_apply.cc.

◆ ApplySetOption()

CURLcode proto_fuzzer::ApplySetOption ( CURL * easy,
const curl::fuzzer::proto::SetOption & option )

Translate and apply one generated scalar/string SetOption to the easy handle.

Pointer-valued options borrow the SetOption's protobuf-owned string storage, so its containing Scenario must remain alive and unmodified until the transfer has stopped and the easy handle has been cleaned up. Borrowing avoids a duplicate backing allocation on every iteration; the lifetime is especially important for CURLOPT_POSTFIELDS, which curl does not copy.

Parameters
easyThe curl easy handle to configure.
optionThe SetOption proto describing which option and value to set.
Returns
curl's setopt result, or CURLE_UNKNOWN_OPTION for an unknown id.

Definition at line 310 of file option_apply.cc.

◆ ApplyTlsClientCredentialProfile()

CURLcode proto_fuzzer::ApplyTlsClientCredentialProfile ( CURL * easy,
curl::fuzzer::proto::TlsClientCredentialProfile profile )

Apply one closed, harness-owned TLS client-credential configuration.

No protobuf bytes become a path, provider, or engine identifier.

Parameters
easyHandle receiving the fixed credential options.
profileSafe credential setup selected by the HTTPS lane.
Returns
The first curl_easy_setopt error, or CURLE_OK.

Definition at line 247 of file option_apply.cc.

◆ RuntimeOptionCount()

std::size_t proto_fuzzer::RuntimeOptionCount ( const curl::fuzzer::proto::Scenario & scenario)

Return the runtime-visible option prefix length.

Fixed targets normally trim the protobuf in their postprocessor, but the compatibility target must preserve its historical message unchanged; applying the same bound here prevents that lane from doing mutation-sized setopt work while exposing the same option prefix as postprocessed fixed lanes.

Parameters
scenarioStructured input whose option prefix will be consumed.
Returns
Number of options visible to the runtime.

Definition at line 391 of file option_apply.cc.