if (req->policy->use_host_err_400) HTTPD_ERR_MSG_RET(req, 400, "Host not local", FALSE);
if (req->policy->use_host_err_400)  HTTPD_ERR_MSG_RET(req, 400, "Hostname not local", FALSE);
static int httpd_serv_add_vhost(struct Con *con, struct Httpd_req_data *req){  Vstr_base *data = con->evnt->io_r;  Vstr_base *fname = req->fname;  Vstr_sect_node *h_h = req->http_hdrs->hdr_host;  size_t h_h_pos = h_h->pos;  size_t h_h_len = h_h->len;  size_t orig_len = 0;    if (!req->policy->use_vhosts_name)    return (TRUE);  if (h_h_len && req->policy->use_canonize_host)  {    size_t dots = 0;        if (VIPREFIX(data, h_h_pos, h_h_len, "www."))    { h_h_len -= CLEN("www."); h_h_pos += CLEN("www."); }        dots = vstr_spn_cstr_chrs_rev(data, h_h_pos, h_h_len, ".");    h_h_len -= dots;  }  h_h->pos = h_h_pos;  h_h->len = h_h_len;      orig_len = fname->len;  if (!h_h_len)    httpd_sc_add_default_hostname(con, req, fname, 0);  else if (vstr_add_vstr(fname, 0, data, /* add as buf's, for lowercase op */                         h_h_pos, h_h_len, VSTR_TYPE_ADD_DEF))  {    vstr_conv_lowercase(fname, 1, h_h_len);        if (!httpd__chk_vhost(req->policy, fname, 1, h_h_len))    {      if (req->policy->use_host_err_400)        HTTPD_ERR_MSG_RET(req, 400, "Host not local", FALSE); /* rfc2616 5.2 */      else      { /* what everything else does ... *sigh* */        if (fname->conf->malloc_bad)          return (TRUE);        h_h->len = 0;        vstr_del(fname, 1, h_h_len);        httpd_sc_add_default_hostname(con, req, fname, 0);      }      }  }  vstr_add_cstr_ptr(fname, 0, "/");  req->vhost_prefix_len = (fname->len - orig_len);  return (TRUE);}