struct Con *con, Httpd_req_data *req)
struct Con *con, Httpd_req_data *req, size_t del_len)
int httpd_conf_req_parse_file(Conf_parse *conf,                              struct Con *con, Httpd_req_data *req){  Conf_token token[1] = {CONF_TOKEN_INIT};  Vstr_base *dir   = req->policy->req_conf_dir;  Vstr_base *fname = req->fname;  Vstr_base *s1 = NULL;  const char *fname_cstr = NULL;  int fd = -1;  struct stat64 cf_stat[1];  ASSERT(conf && con && req && dir && fname && fname->len);    if (!dir->len ||      !req->policy->use_req_conf || req->skip_document_root)    return (TRUE);    s1 = conf->tmp;  HTTPD_APP_REF_ALLVSTR(s1, dir);  ASSERT((dir->len   >= 1) && vstr_cmp_cstr_eq(dir,   dir->len, 1, "/"));  ASSERT((fname->len >= 1) && vstr_cmp_cstr_eq(fname,        1, 1, "/"));  HTTPD_APP_REF_VSTR(s1, fname, 2, fname->len - 1);  if (s1->conf->malloc_bad ||      !(fname_cstr = vstr_export_cstr_ptr(s1, 1, s1->len)))    goto read_fail;    fd = io_open_nonblock(fname_cstr);  if ((fd == -1) && (errno == EISDIR))    goto fin_dir;  if ((fd == -1) &&      ((errno == ENOTDIR) || /* part of path was not a dir */       (errno == ENAMETOOLONG)))    goto fin_file; /* ignore these errors, not local users fault */  if ((fd == -1) && (errno == ENOENT))    goto fin_ok; /* ignore these errors, not local users fault */  if (fd == -1)    goto read_fail; /* this is "bad" */    if (fstat64(fd, cf_stat) == -1)    goto close_read_fail; /* this is "bad" */    if (S_ISDIR(cf_stat->st_mode))    goto fin_close_dir; /* ignore */    if (!S_ISREG(cf_stat->st_mode))    goto close_read_fail; /* this is "bad" */  if ((cf_stat->st_size < strlen("org.and.and-httpd-conf-req-1.0")) ||      (cf_stat->st_size > req->policy->max_req_conf_sz))    goto close_read_fail; /* this is "bad" */  s1 = conf->data;  vstr_del(conf->tmp,  1, conf->tmp->len); /* filename */  while (cf_stat->st_size > s1->len)  {    size_t len = cf_stat->st_size - s1->len;        if (!vstr_sc_read_len_fd(s1, s1->len, fd, len, NULL) ||        (len == (cf_stat->st_size - s1->len)))      goto close_read_fail;  }    close(fd);      if (!conf_parse_lex(conf, 1, conf->data->len))    goto conf_fail;  while (conf_parse_token(conf, token))  {    if ((token->type != CONF_TOKEN_TYPE_CLIST) || (token->depth_num != 1))      goto conf_fail;    if (!conf_parse_token(conf, token))      goto conf_fail;        if (!conf_token_cmp_sym_cstr_eq(conf, token,                                    "org.and.and-httpd-conf-req-1.0") &&        !conf_token_cmp_sym_cstr_eq(conf, token,                                    "org.and.jhttpd-conf-req-1.0"))      goto conf_fail;      if (!httpd_conf_req_d0(con, req, cf_stat->st_mtime, conf, token))      goto conf_fail;  }  /* And they all live together ... dum dum */  if (conf->data->conf->malloc_bad)    goto read_fail;  return (TRUE); fin_close_dir:  close(fd); fin_dir:  if (req->policy->use_secure_dirs)  { /* check if conf file exists inside the directory given,     * so we can re-direct without leaking info. */    struct stat64 d_stat[1];        vstr_add_cstr_buf(s1, s1->len, "/");    HTTPD_APP_REF_ALLVSTR(s1, req->policy->dir_filename);        fname_cstr = vstr_export_cstr_ptr(s1, 1, s1->len);    if (s1->conf->malloc_bad)      goto read_fail;    if ((stat64(fname_cstr, d_stat) != -1) && S_ISREG(d_stat->st_mode))      req->conf_secure_dirs = TRUE;  }  ASSERT(s1 == conf->tmp);  vstr_del(s1, 1, s1->len);  return (TRUE);   fin_file:  if (req->policy->use_friendly_dirs)  { /* check if conf file exists as a file, so we can re-direct backwards */    struct stat64 d_stat[1];    size_t len = vstr_cspn_cstr_chrs_rev(s1, 1, s1->len, "/") + 1;    if ((len > 1) && (len < (s1->len - req->vhost_prefix_len)))    { /* must be a filename, can't be toplevel */      vstr_sc_reduce(s1, 1, s1->len, len);          fname_cstr = vstr_export_cstr_ptr(s1, 1, s1->len);      if (s1->conf->malloc_bad)        goto read_fail;      if ((stat64(fname_cstr, d_stat) != -1) && S_ISREG(d_stat->st_mode))        req->conf_friendly_dirs = TRUE;    }  }   fin_ok:  ASSERT(s1 == conf->tmp);  vstr_del(s1, 1, s1->len);  return (TRUE); close_read_fail:  vstr_del(conf->data, 1, conf->data->len);  vstr_del(conf->tmp,  1, conf->tmp->len);  close(fd);  goto read_fail;   conf_fail:  vstr_del(conf->tmp,  1, conf->tmp->len);  if (!req->user_return_error_code)    conf_parse_backtrace(conf->tmp, "<conf-request>", conf, token); read_fail:  if (!req->user_return_error_code)    HTTPD_ERR(req, 503);  conf->data->conf->malloc_bad = FALSE;  return (FALSE);}