summaryrefslogtreecommitdiff
path: root/lib/http.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-12-13 19:32:58 +0900
committerDaniel Stenberg <daniel@haxx.se>2015-12-15 23:47:46 +0100
commit15cb03ad846a10c4aa4889d46804389ad11cdc1d (patch)
tree7b2e270cc7980ed5d1a54e08f10a958e14f95645 /lib/http.h
parent871ad2a0f242ee036f35ccc6c48e5baa6389885f (diff)
downloadgnurl-15cb03ad846a10c4aa4889d46804389ad11cdc1d.tar.gz
gnurl-15cb03ad846a10c4aa4889d46804389ad11cdc1d.tar.bz2
gnurl-15cb03ad846a10c4aa4889d46804389ad11cdc1d.zip
http2: Support trailer fields
This commit adds trailer support in HTTP/2. In HTTP/1.1, chunked encoding must be used to send trialer fields. HTTP/2 deprecated any trandfer-encoding, including chunked. But trailer fields are now always available. Since trailer fields are relatively rare these days (gRPC uses them extensively though), allocating buffer for trailer fields is done when we detect that HEADERS frame containing trailer fields is started. We use Curl_add_buffer_* functions to buffer all trailers, just like we do for regular header fields. And then deliver them when stream is closed. We have to be careful here so that all data are delivered to upper layer before sending trailers to the application. We can deliver trailer field one by one using NGHTTP2_ERR_PAUSE mechanism, but current method is far more simple. Another possibility is use chunked encoding internally for HTTP/2 traffic. I have not tested it, but it could add another overhead. Closes #564
Diffstat (limited to 'lib/http.h')
-rw-r--r--lib/http.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/http.h b/lib/http.h
index fe4f39bc6..a35a0af23 100644
--- a/lib/http.h
+++ b/lib/http.h
@@ -163,6 +163,7 @@ struct HTTP {
Curl_send_buffer *header_recvbuf;
size_t nread_header_recvbuf; /* number of bytes in header_recvbuf fed into
upper layer */
+ Curl_send_buffer *trailer_recvbuf;
int status_code; /* HTTP status code */
const uint8_t *pausedata; /* pointer to data received in on_data_chunk */
size_t pauselen; /* the number of bytes left in data */