diff options
author | Ayoub Boudhar <a.boudhar@outlook.com> | 2018-12-06 10:18:03 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-12-14 10:10:48 +0100 |
commit | f464535bfdd9a83140d8a13c3fe3d937239d1c2a (patch) | |
tree | da330b66fe21c30ef5821436fa53a56e5946b504 /include | |
parent | 4531b299cc4771e6d2428fb22c1305f75db71666 (diff) |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/curl/curl.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h index 3c5ce709a..bd6183838 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -355,11 +355,21 @@ typedef int (*curl_seek_callback)(void *instream, signal libcurl to pause sending data on the current transfer. */ #define CURL_READFUNC_PAUSE 0x10000001 +/* Return code for when the trailing headers' callback has terminated + without any errors*/ +#define CURL_TRAILERFUNC_OK 0 +/* Return code for when was an error in the trailing header's list and we + want to abort the request */ +#define CURL_TRAILERFUNC_ABORT 1 + typedef size_t (*curl_read_callback)(char *buffer, size_t size, size_t nitems, void *instream); +typedef int (*curl_trailer_callback)(struct curl_slist **list, + void *userdata); + typedef enum { CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */ @@ -1875,6 +1885,12 @@ typedef enum { /* Specify URL using CURL URL API. */ CINIT(CURLU, OBJECTPOINT, 282), + /* add trailing data just after no more data is available */ + CINIT(TRAILERFUNCTION, FUNCTIONPOINT, 283), + + /* pointer to be passed to HTTP_TRAILER_FUNCTION */ + CINIT(TRAILERDATA, OBJECTPOINT, 284), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; |