aboutsummaryrefslogtreecommitdiff
path: root/lib/urldata.h
diff options
context:
space:
mode:
authorAyoub Boudhar <a.boudhar@outlook.com>2018-12-06 10:18:03 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-12-14 10:10:48 +0100
commitf464535bfdd9a83140d8a13c3fe3d937239d1c2a (patch)
treeda330b66fe21c30ef5821436fa53a56e5946b504 /lib/urldata.h
parent4531b299cc4771e6d2428fb22c1305f75db71666 (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 'lib/urldata.h')
-rw-r--r--lib/urldata.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/urldata.h b/lib/urldata.h
index 448437d2a..8fb2d2894 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1216,6 +1216,15 @@ typedef enum {
EXPIRE_LAST /* not an actual timer, used as a marker only */
} expire_id;
+
+typedef enum {
+ TRAILERS_NONE,
+ TRAILERS_INITIALIZED,
+ TRAILERS_SENDING,
+ TRAILERS_DONE
+} trailers_state;
+
+
/*
* One instance for each timeout an easy handle can set.
*/
@@ -1362,6 +1371,13 @@ struct UrlState {
#endif
CURLU *uh; /* URL handle for the current parsed URL */
struct urlpieces up;
+#ifndef CURL_DISABLE_HTTP
+ size_t trailers_bytes_sent;
+ Curl_send_buffer *trailers_buf; /* a buffer containing the compiled trailing
+ headers */
+#endif
+ trailers_state trailers_state; /* whether we are sending trailers
+ and what stage are we at */
};
@@ -1730,6 +1746,8 @@ struct UserDefined {
multidone_func fmultidone;
struct Curl_easy *dohfor; /* this is a DoH request for that transfer */
CURLU *uh; /* URL handle for the current parsed URL */
+ void *trailer_data; /* pointer to pass to trailer data callback */
+ curl_trailer_callback trailer_callback; /* trailing data callback */
};
struct Names {