HTTPD_ERR_301(req);
HTTPD_REDIR_MSG(req, 301, "dir -> filename");
static int http_req_chk_dir(struct Con *con, Httpd_req_data *req){  Vstr_base *fname = req->fname;    /* fname == what was just passed to open() */  ASSERT(fname->len);  if (req->policy->use_secure_dirs && !req->conf_secure_dirs)  { /* check if file exists before redirecting without leaking info. */    const char *fname_cstr = NULL;    struct stat64 d_stat[1];      vstr_add_cstr_buf(fname, fname->len, "/");    HTTPD_APP_REF_ALLVSTR(fname, req->policy->dir_filename);        fname_cstr = vstr_export_cstr_ptr(fname, 1, fname->len);    if (fname->conf->malloc_bad)      return (http_fin_errmem_req(con, req));    if ((stat64(fname_cstr, d_stat) == -1) || !S_ISREG(d_stat->st_mode))      HTTPD_ERR_RET(req, 404, http_fin_err_req(con, req));  }    vstr_del(fname, 1, fname->len);  httpd_req_absolute_uri(con, req, fname, 1, fname->len);    /* we got:       http://foo/bar/   * and so tried: http://foo/bar/index.html   *   * but foo/bar/index.html is a directory (fun), so redirect to:   *               http://foo/bar/index.html/   */  if (fname->len && (vstr_export_chr(fname, fname->len) == '/'))    HTTPD_APP_REF_ALLVSTR(fname, req->policy->dir_filename);    vstr_add_cstr_buf(fname, fname->len, "/");    HTTPD_ERR_301(req);    if (fname->conf->malloc_bad)    return (http_fin_errmem_req(con, req));    return (http_fin_err_req(con, req));}