|
curl-fuzzer C++ reference
|
Builds HTTP headers or TELNET options, MIME state, and upload callbacks whose storage or userdata libcurl retains by pointer. More...
#include <request_data.h>
Public Member Functions | |
| ScenarioRequestData (CURL *easy, const curl::fuzzer::proto::Scenario &scenario, bool apply_resolve_entries=false) | |
| Construct and apply the protocol-specific pointer-valued fields in scenario to easy. | |
| ScenarioRequestData (CURL *easy, curl::fuzzer::proto::Scenario &&scenario, bool apply_resolve_entries=false)=delete | |
| A temporary Scenario cannot outlive the upload view retained for curl. | |
| ~ScenarioRequestData () | |
| Detach pointer options/callbacks while the easy handle is valid, then release request allocations. | |
| const RequestBuildStats & | stats () const |
| Return resource counts after caps and allocation failures were applied, without exposing or transferring the owned curl pointers themselves. | |
| const UploadScriptState & | upload_state () const |
| Return the callback state retained for the complete drive. | |
| bool | upload_callbacks_installed () const |
| Return whether this scenario needed raw upload callbacks. | |
| bool | resolve_entries_ready () const |
| Return whether resolver-only slist construction installed its mandatory final loopback mapping. | |
| void | SetBeforeUploadReadCallback (UploadScriptState::BeforeReadCallback callback, void *userdata) |
| Arrange protocol-specific work immediately before every upload read. | |
Builds HTTP headers or TELNET options, MIME state, and upload callbacks whose storage or userdata libcurl retains by pointer.
Keeping them in one scope makes their lifetime visibly encompass the complete multi-handle drive rather than relying on setopt copying data that its API explicitly does not copy.
Definition at line 112 of file request_data.h.
| proto_fuzzer::ScenarioRequestData::ScenarioRequestData | ( | CURL * | easy, |
| const curl::fuzzer::proto::Scenario & | scenario, | ||
| bool | apply_resolve_entries = false ) |
Construct and apply the protocol-specific pointer-valued fields in scenario to easy.
Setup errors are deliberately non-fatal: malformed or partially allocated scenarios should still exercise whatever curl state was built. easy must remain alive until this object is destroyed, because cleanup first detaches the pointers from the handle and only then frees them.
| easy | Easy handle that will perform this scenario. |
| scenario | Source headers/TELNET options, optional MIME body, and upload script. |
| apply_resolve_entries | Whether to install the scenario's bounded resolver mappings plus the mandatory loopback mapping. |
Definition at line 483 of file request_data.cc.
| proto_fuzzer::ScenarioRequestData::~ScenarioRequestData | ( | ) |
Detach pointer options/callbacks while the easy handle is valid, then release request allocations.
libcurl does not copy headers, MIME roots, or callback userdata, so releasing any one before the mock drive ends would create a use-after-free; relying on easy cleanup to own header/MIME allocations would instead leak iterations.
Definition at line 574 of file request_data.cc.
| bool proto_fuzzer::ScenarioRequestData::resolve_entries_ready | ( | ) | const |
Return whether resolver-only slist construction installed its mandatory final loopback mapping.
Ordinary lanes always report true.
Definition at line 626 of file request_data.cc.
| void proto_fuzzer::ScenarioRequestData::SetBeforeUploadReadCallback | ( | UploadScriptState::BeforeReadCallback | callback, |
| void * | userdata ) |
Arrange protocol-specific work immediately before every upload read.
This is intentionally a narrow callback seam rather than exposing curl's retained READFUNCTION userdata or the mutable upload cursor.
| callback | Function to invoke, or nullptr to clear the hook. |
| userdata | Borrowed pointer passed to callback. |
Definition at line 633 of file request_data.cc.
| const RequestBuildStats & proto_fuzzer::ScenarioRequestData::stats | ( | ) | const |
Return resource counts after caps and allocation failures were applied, without exposing or transferring the owned curl pointers themselves.
Definition at line 610 of file request_data.cc.
| bool proto_fuzzer::ScenarioRequestData::upload_callbacks_installed | ( | ) | const |
Return whether this scenario needed raw upload callbacks.
Exposing the decision lets ownership tests ensure ordinary requests avoid redundant setopt/teardown work without exposing either userdata pointer.
Definition at line 621 of file request_data.cc.
| const UploadScriptState & proto_fuzzer::ScenarioRequestData::upload_state | ( | ) | const |
Return the callback state retained for the complete drive.
This is mainly useful to ownership tests; the runner itself lets libcurl mutate it.
Definition at line 615 of file request_data.cc.