Skip to content

libcURL.cURLSession.Perform

Andrew Lambert edited this page Jan 25, 2023 · 9 revisions

Method Signatures

 Sub Perform(URL As String, ReadFrom As Readable, WriteTo As Writeable)
 Sub Perform(URL As libcURL.URLParser, ReadFrom As Readable, WriteTo As Writeable)
 Function Perform(URL As String, ReadFrom As Readable, WriteTo As Writeable) As Boolean
 Function Perform(URL As libcURL.URLParser, ReadFrom As Readable, WriteTo As Writeable) As Boolean

Parameters

Name Type Comment
URL String or URLParser The RFC 3986 URI to operate upon. In libcurl 7.62.0 and newer, you may also pass an instance of URLParser.
ReadFrom Readable Uploaded data (if any) will be read from this object.
WriteTo Writeable Downloaded data (if any) will be written to this object.

Return value

The synchronous version of this method returns True on success. Check cURLSession.LastError if this method returns False.

Remarks

This method initiates a generic request against the specified URL. Details such as the request method, headers, etc. must already have been set. Retrieval semantics will be inferred unless the transfer has been configured otherwise. Synchronous transfers are performed on the calling thread; asynchronous transfers run on the event loop/main thread.

If the URL parameter is empty ("") then the previous URL is reused; if there is no previous URL then the transfer will fail with error code CURLE_URL_MALFORMAT(3). If the previous transfer involved any sort of redirection then the "previous URL" is the URL enclosed in the final redirect. In versions of this method that accept a URLParser instead of a String, the URL parameter may not be a literal Nil. The equivalent to an "empty" URL in these versions is a Nil reference of type URLParser (don't bother; just use the empty string version).

ReadFrom and/or WriteTo may be Nil. Beware that the status of being Nil has important implications for these streams:

  • If WriteTo is Nil and data is received then this data will be buffered in memory, and may be retrieved by calling GetDownloadedData after the transfer completes.
  • If ReadFrom is Nil and data is requested then the transfer will fail with error code CURLE_ABORTED_BY_CALLBACK(42).
Clone this wiki locally