VSTR_AUTOCONF_uintmax_t content_length)
uintmax_t content_length)
void http_app_def_hdrs(struct Con *con, struct Httpd_req_data *req,                       unsigned int http_ret_code,                       const char *http_ret_line, time_t mtime,                       const char *custom_content_type,                       int use_range,                       VSTR_AUTOCONF_uintmax_t content_length){  Vstr_base *out = con->evnt->io_w;  Date_store *ds = httpd_opts->date;    if (use_range)    use_range = req->policy->use_range;    vstr_add_fmt(out, out->len, "%s %03u %s" HTTP_EOL,               "HTTP/1.1", http_ret_code, http_ret_line);  http_app_hdr_cstr(out, "Date", date_rfc1123(ds, req->now));  http_app_hdr_conf_vstr(out, "Server", req->policy->server_name);  if (mtime)  { /* if mtime in future, chop it #14.29      * for cache validation we don't cmp last-modified == now either */    if (difftime(req->now, mtime) <= 0)      mtime = req->now;    http_app_hdr_cstr(out, "Last-Modified", date_rfc1123(ds, mtime));  }    switch (con->keep_alive)  {    case HTTP_NON_KEEP_ALIVE:      HTTP_APP_HDR_CONST_CSTR(out, "Connection", "close");      break;          case HTTP_1_0_KEEP_ALIVE:      HTTP_APP_HDR_CONST_CSTR(out, "Connection", "Keep-Alive");      /* FALLTHROUGH */    case HTTP_1_1_KEEP_ALIVE: /* max=xxx ? */      if (req->output_keep_alive_hdr)        http_app_hdr_fmt(out, "Keep-Alive",                         "%s=%u", "timeout", req->policy->s->idle_timeout);            ASSERT_NO_SWITCH_DEF();  }  switch (http_ret_code)  {    case 200: /* OK */      /* case 206: */ /* OK - partial -- needed? */    case 301: case 302: case 303: case 307: /* Redirects */    case 304: /* Not modified */    case 406: /* Not accept - a */      /* case 410: */ /* Gone - like 404 or 301 ? */    case 412: /* Not accept - precondition */    case 413: /* Too large */    case 416: /* Bad range */    case 417: /* Not accept - expect contained something */      if (use_range)        HTTP_APP_HDR_CONST_CSTR(out, "Accept-Ranges", "bytes");  }    if (req->vary_star)    HTTP_APP_HDR_CONST_CSTR(out, "Vary", "*");  else if (req->vary_a || req->vary_ac || req->vary_ae || req->vary_al ||           req->vary_rf || req->vary_ua)  {    const char *varies_ptr[6];    size_t      varies_len[6];    unsigned int num = 0;        if (req->vary_ua) HTTP__VARY_ADD(num, "User-Agent");    if (req->vary_rf) HTTP__VARY_ADD(num, "Referer");    if (req->vary_al) HTTP__VARY_ADD(num, "Accept-Language");    if (req->vary_ae) HTTP__VARY_ADD(num, "Accept-Encoding");    if (req->vary_ac) HTTP__VARY_ADD(num, "Accept-Charset");    if (req->vary_a)  HTTP__VARY_ADD(num, "Accept");    ASSERT(num && (num <= 5));        http__app_hdr_hdr(out, "Vary");    while (num-- > 1)    {      vstr_add_buf(out, out->len, varies_ptr[num], varies_len[num]);      vstr_add_cstr_buf(out, out->len, ",");    }    ASSERT(num == 0);        vstr_add_buf(out, out->len, varies_ptr[0], varies_len[0]);    http__app_hdr_eol(out);  }  if (con->use_mpbr)  {    ASSERT(con->mpbr_ct && !con->mpbr_ct->len);    if (req->content_type_vs1 && req->content_type_len)      http_app_hdr_vstr_def(con->mpbr_ct, "Content-Type",                            HTTP__XTRA_HDR_PARAMS(req, content_type));    http_app_hdr_cstr(out, "Content-Type",                      "multipart/byteranges; boundary=SEP");  }  else if (req->content_type_vs1 && req->content_type_len)    http_app_hdr_vstr_def(out, "Content-Type",                          HTTP__XTRA_HDR_PARAMS(req, content_type));  else if (custom_content_type) /* possible we don't send one */    http_app_hdr_cstr(out, "Content-Type", custom_content_type);    if (req->content_encoding_bzip2)      HTTP_APP_HDR_CONST_CSTR(out, "Content-Encoding", "bzip2");  else if (req->content_encoding_gzip)  {    if (req->content_encoding_xgzip)      HTTP_APP_HDR_CONST_CSTR(out, "Content-Encoding", "x-gzip");    else      HTTP_APP_HDR_CONST_CSTR(out, "Content-Encoding", "gzip");  }    if (!con->use_mpbr)    http_app_hdr_uintmax(out, "Content-Length", content_length);}