/* This function will be called to loop through the trailers buffer until no more data is available for sending.  */
static size_t Curl_trailers_read(char *buffer, size_t size, size_t nitems, void *raw)
/* This function will be called to loop through the trailers buffer until no more data is available for sending.  */
static size_t Curl_trailers_read(char *buffer, size_t size, size_t nitems, void *raw)
{
  struct Curl_easy *data = (struct Curl_easy *)raw;
  Curl_send_buffer *trailers_buf = data->state.trailers_buf;
  size_t bytes_left = trailers_buf->size_used-data->state.trailers_bytes_sent;
  size_t to_copy = (size*nitems < bytes_left) ? size*nitems : bytes_left;
  if(to_copy) {
    memcpy(buffer,
           &trailers_buf->buffer[data->state.trailers_bytes_sent],
           to_copy);
    data->state.trailers_bytes_sent += to_copy;
  }
  return to_copy;
}