TPdfCryptoFetchSession relies on away from Windows
function CryptoCurlAvailable: Boolean;
function CryptoCurlGet(const Url: AnsiString; TimeoutMs: Cardinal;
MaxBytes: Integer; out Data: TBytes; out DownloadedBytes: Integer;
const ConnectTo: AnsiString = ''): Boolean;
function CryptoCurlPost(const Url: AnsiString; const Body: TBytes;
const ContentType: AnsiString; TimeoutMs: Cardinal; MaxBytes: Integer;
out Data: TBytes; out DownloadedBytes: Integer;
const ConnectTo: AnsiString = ''): Boolean;
FPdfCryptoHttpCurl supplies the non-Windows half of the online retrieval transport in FPdfCryptoHttp. On Linux and macOS, each HTTP(S) fetch that TPdfCryptoFetchSession.Fetch and TPdfCryptoFetchSession.FetchPost make for AIA intermediates, CRL distribution points and OCSP requests travels through CryptoCurlGet or CryptoCurlPost; Windows targets instead take the WinHttp path inside FPdfCryptoHttp, where CryptoHttpAvailable simply hands over to CryptoCurlAvailable away from Windows
libcurl is bound by name at run time rather than linked in: libcurl.so.4 on Linux, libcurl.4.dylib on macOS, and libcurl.dll or libcurl-4.dll on FPC Windows targets — although there the fetch session prefers WinHttp and nothing calls into this unit. A module only counts when it reports both the CURL_VERSION_ASYNCHDNS and CURL_VERSION_THREADSAFE features, because transfers run with signals suppressed inside a millisecond-level budget and the global initialiser has to be safe alongside worker threads; any other libcurl is reported as missing rather than used
The timestamp transport is gated by the same availability check: TsaHttpAvailable in FPdfTsaFpc demands CryptoCurlAvailable on top of its own entry points, so a single feature-qualified libcurl module backs certificate retrieval and RFC 3161 requests alike
No failure path raises an exception: every one returns False, leaves Data nil and records in DownloadedBytes how many bytes arrived, so a caller such as the fetch session can charge that count against its shared byte budget. Under Delphi the interface compiles yet all three functions return False, because Delphi targets Windows, where the WinHttp path in FPdfCryptoHttp serves as the backend
| Function | Description |
|---|---|
CryptoCurlAvailable | Binds libcurl once under a lock on the first call, returning True only when every entry point has resolved and the module reports asynchronous DNS and thread safety |
CryptoCurlGet | Runs a bounded HTTP or HTTPS GET that succeeds only with an exact status 200 and a non-empty body, keeps at most MaxBytes bytes and reports the complete received count via DownloadedBytes |
CryptoCurlPost | Runs a bounded HTTP or HTTPS POST for a non-empty Body using the caller's ContentType; the GET's status, size and byte-count rules apply here too |
http and https URLs no longer than 8192 bytes are accepted; a URL containing control characters, a backslash, a fragment or @ userinfo in the authority is refused. Redirects are never followed, the protocol set is pinned to HTTP and HTTPS, and proxying, HTTP authentication and proxy authentication are all switched offTimeoutMs is a whole-call budget taken from routine entry and divided between the connect and total libcurl timeouts, so the first call's binding time counts against itMaxBytes is cut to the limit and the transfer is aborted; DownloadedBytes still tells the caller the true sizeCryptoCurlAvailable call and the module remains mapped until the process exits, since asynchronous resolver threads can outlive a global cleanupFPdfCryptoHttp and are documented with TPdfCryptoFetchSession