Name
easy:SetOpt_TrailerFunction -- callback for sending trailing headers (V2.0)
Synopsis
easy:SetOpt_TrailerFunction(trailer_callback[, userdata])
Function
Pass a callback function. This callback function will be called once right before sending the final CRLF in an HTTP chunked transfer to fill a list of trailing headers to be sent before finishing the HTTP transfer.

The callback function looks like this:

 
res, list = trailer_callback([userdata])

The return value can either be #CURL_TRAILERFUNC_OK or #CURL_TRAILERFUNC_ABORT which would respectively instruct libcurl to either continue with sending the trailers or to abort the request.

The trailing headers must be stored as strings in a table and the strings must not be CRLF-terminated, because libcurl will add the appropriate line termination characters after each header item. Your callback function must return the table containing the trailers as the list return value.

If one of the trailing header fields is not formatted correctly it will be ignored and an info message will be emitted.

If you pass the optional userdata argument, the value you pass in userdata will be passed to your callback function as a parameter. The userdata parameter can be of any type.

Inputs
trailer_callback
input value
userdata
optional: user data to pass to callback function

Show TOC