mirror of
https://github.com/moparisthebest/curl
synced 2025-01-11 14:08:07 -05:00
http: minor whitespace cleanup from f464535b
This commit is contained in:
parent
f464535bfd
commit
04b69c744c
@ -21,24 +21,18 @@
|
|||||||
.\" **************************************************************************
|
.\" **************************************************************************
|
||||||
.\"
|
.\"
|
||||||
.TH CURLOPT_TRAILERDATA 3 "14 Aug 2018" "libcurl 7.64.0" "curl_easy_setopt options"
|
.TH CURLOPT_TRAILERDATA 3 "14 Aug 2018" "libcurl 7.64.0" "curl_easy_setopt options"
|
||||||
|
|
||||||
.SH NAME:
|
.SH NAME:
|
||||||
CURLOPT_TRAILERDATA \- Custom pointer passed to the trailing headers callback
|
CURLOPT_TRAILERDATA \- Custom pointer passed to the trailing headers callback
|
||||||
|
|
||||||
.SH SYNOPSIS:
|
.SH SYNOPSIS:
|
||||||
#include <curl.h>
|
#include <curl.h>
|
||||||
|
|
||||||
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRAILERDATA, void *userdata);
|
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRAILERDATA, void *userdata);
|
||||||
|
|
||||||
.SH DESCRIPTION:
|
.SH DESCRIPTION:
|
||||||
Data pointer to be passed to the HTTP trailer callback function.
|
Data pointer to be passed to the HTTP trailer callback function.
|
||||||
|
|
||||||
.SH DEFAULT:
|
.SH DEFAULT:
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
.SH PROTOCOLS:
|
.SH PROTOCOLS:
|
||||||
HTTP
|
HTTP
|
||||||
|
|
||||||
.SH EXAMPLE:
|
.SH EXAMPLE:
|
||||||
.nf
|
.nf
|
||||||
/* Assuming we have a CURL handle in the hndl variable. */
|
/* Assuming we have a CURL handle in the hndl variable. */
|
||||||
@ -46,12 +40,10 @@ HTTP
|
|||||||
struct MyData data;
|
struct MyData data;
|
||||||
|
|
||||||
curl_easy_setopt(hndl, CURLOPT_TRAILERDATA, &data);
|
curl_easy_setopt(hndl, CURLOPT_TRAILERDATA, &data);
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
A more complete example can be found in examples/http_trailers.html
|
A more complete example can be found in examples/http_trailers.html
|
||||||
.SH AVAILABILITY:
|
.SH AVAILABILITY:
|
||||||
This option was added in curl 7.64.0 and is present if HTTP support is enabled
|
This option was added in curl 7.64.0 and is present if HTTP support is enabled
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR CURLOPT_TRAILERFUNCTION "(3), "
|
.BR CURLOPT_TRAILERFUNCTION "(3), "
|
||||||
|
@ -21,17 +21,14 @@
|
|||||||
.\" **************************************************************************
|
.\" **************************************************************************
|
||||||
.\"
|
.\"
|
||||||
.TH CURLOPT_TRAILERFUNCTION 3 "14 Aug 2018" "libcurl 7.64.0" "curl_easy_setopt options"
|
.TH CURLOPT_TRAILERFUNCTION 3 "14 Aug 2018" "libcurl 7.64.0" "curl_easy_setopt options"
|
||||||
|
|
||||||
.SH NAME:
|
.SH NAME:
|
||||||
CURLOPT_TRAILERFUNCTION \- Set callback for sending trailing headers
|
CURLOPT_TRAILERFUNCTION \- Set callback for sending trailing headers
|
||||||
|
|
||||||
.SH SYNOPSIS:
|
.SH SYNOPSIS:
|
||||||
#include <curl.h>
|
#include <curl.h>
|
||||||
|
|
||||||
int curl_trailer_callback(struct curl_slist ** list, void *userdata);
|
int curl_trailer_callback(struct curl_slist ** list, void *userdata);
|
||||||
|
|
||||||
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRAILERFUNCTION, curl_trailer_callback *func);
|
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRAILERFUNCTION, curl_trailer_callback *func);
|
||||||
|
|
||||||
.SH DESCRIPTION:
|
.SH DESCRIPTION:
|
||||||
Pass a pointer to a callback function.
|
Pass a pointer to a callback function.
|
||||||
|
|
||||||
@ -59,27 +56,22 @@ trailers or to abort the request.
|
|||||||
|
|
||||||
If you set this option to NULL, then the transfer proceeds as usual
|
If you set this option to NULL, then the transfer proceeds as usual
|
||||||
without any interruptions.
|
without any interruptions.
|
||||||
|
|
||||||
.SH DEFAULT:
|
.SH DEFAULT:
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
.SH PROTOCOLS:
|
.SH PROTOCOLS:
|
||||||
HTTP
|
HTTP
|
||||||
|
|
||||||
.SH EXAMPLE:
|
.SH EXAMPLE:
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
static int trailer_cb(struct curl_slist **tr, void *data)
|
static int trailer_cb(struct curl_slist **tr, void *data)
|
||||||
{
|
{
|
||||||
/* libcurl will free the list */
|
/* libcurl will free the list */
|
||||||
*tr = curl_slist_append(*tr, "My-super-awesome-trailer: trailer-stuff");
|
tr = curl_slist_append(*tr, "My-super-awesome-trailer: trailer-stuff");
|
||||||
(void)data;
|
|
||||||
return CURL_TRAILERFUNC_OK;
|
return CURL_TRAILERFUNC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CURL *curl = curl_easy_init();
|
CURL *curl = curl_easy_init();
|
||||||
if(curl) {
|
if(curl) {
|
||||||
|
|
||||||
/* Set the URL of the request */
|
/* Set the URL of the request */
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");
|
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");
|
||||||
/* Now set it as a put */
|
/* Now set it as a put */
|
||||||
@ -94,7 +86,7 @@ if(curl) {
|
|||||||
res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||||
|
|
||||||
/* Set the trailers filling callback */
|
/* Set the trailers filling callback */
|
||||||
curl_easy_setopt(curl, CURLOPT_TRAILERFUNCTION, (curl_trailer_callback)trailer_cb);
|
curl_easy_setopt(curl, CURLOPT_TRAILERFUNCTION, trailer_cb);
|
||||||
|
|
||||||
/* Perform the request, res will get the return code */
|
/* Perform the request, res will get the return code */
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
@ -103,10 +95,7 @@ if(curl) {
|
|||||||
|
|
||||||
curl_slist_free_all(headers);
|
curl_slist_free_all(headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.SH AVAILABILITY:
|
.SH AVAILABILITY:
|
||||||
This option was added in curl 7.64.0 and is present if HTTP support is enabled
|
This option was added in curl 7.64.0 and is present if HTTP support is enabled
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR CURLOPT_TRAILERDATA "(3), "
|
.BR CURLOPT_TRAILERDATA "(3), "
|
||||||
|
@ -103,4 +103,3 @@ test_cleanup:
|
|||||||
|
|
||||||
return (int)res;
|
return (int)res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user