From f464535bfdd9a83140d8a13c3fe3d937239d1c2a Mon Sep 17 00:00:00 2001 From: Ayoub Boudhar Date: Thu, 6 Dec 2018 10:18:03 +0100 Subject: http: Implement trailing headers for chunked transfers This adds the CURLOPT_TRAILERDATA and CURLOPT_TRAILERFUNCTION options that allow a callback based approach to sending trailing headers with chunked transfers. The test server (sws) was updated to take into account the detection of the end of transfer in the case of trailing headers presence. Test 1591 checks that trailing headers can be sent using libcurl. Closes #3350 --- lib/setopt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/setopt.c') diff --git a/lib/setopt.c b/lib/setopt.c index 01a890b39..27046768c 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -2636,6 +2636,16 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, return CURLE_BAD_FUNCTION_ARGUMENT; data->set.upkeep_interval_ms = arg; break; + case CURLOPT_TRAILERFUNCTION: +#ifndef CURL_DISABLE_HTTP + data->set.trailer_callback = va_arg(param, curl_trailer_callback); +#endif + break; + case CURLOPT_TRAILERDATA: +#ifndef CURL_DISABLE_HTTP + data->set.trailer_data = va_arg(param, void *); +#endif + break; default: /* unknown tag and its companion, just ignore: */ result = CURLE_UNKNOWN_OPTION; -- cgit v1.2.3