req->head_op = TRUE;
ASSERT(req->head_op == TRUE);  req->head_op = TRUE;
static int http_parse_req(struct Con *con){  Vstr_base *data = con->evnt->io_r;  struct Httpd_req_data *req = NULL;  int ern_req_all = FALSE;  ASSERT(con->fs && !con->fs_num);  if (!data->len)    return (http_parse_wait_io_r(con));    if (!(req = http_req_make(con)))    return (FALSE);  if (con->parsed_method_ver_1_0) /* wait for all the headers */  {    if (!http__parse_req_all(con, req, HTTP_END_OF_REQUEST, &ern_req_all))      return (ern_req_all);  }  else  {    if (!http__parse_req_all(con, req, HTTP_EOL,            &ern_req_all))      return (ern_req_all);  }  con->keep_alive = HTTP_NON_KEEP_ALIVE;  http_req_split_method(con, req);  if (req->sects->malloc_bad)    VLG_WARNNOMEM_RET(http_fin_errmem_req(con, req), (vlg, "split: %m\n"));  else if (req->sects->num < 2)    HTTPD_ERR_MSG_RET(req, 400, "No arguments", http_fin_err_req(con, req));  else  {    size_t op_pos = 0;    size_t op_len = 0;    if (req->ver_0_9)      vlg_dbg1(vlg, "Method(0.9):"               " $<http-esc.vstr.sect:%p%p%u> $<http-esc.vstr.sect:%p%p%u>\n",               con->evnt->io_r, req->sects, 1U,               con->evnt->io_r, req->sects, 2U);    else    { /* need to get all headers */      if (!con->parsed_method_ver_1_0)      {        con->parsed_method_ver_1_0 = TRUE;        if (!http__parse_req_all(con, req, HTTP_END_OF_REQUEST, &ern_req_all))          return (ern_req_all);      }            vlg_dbg1(vlg, "Method(1.x):"               " $<http-esc.vstr.sect:%p%p%u> $<http-esc.vstr.sect:%p%p%u>"               " $<http-esc.vstr.sect:%p%p%u>\n", data, req->sects, 1U,               data, req->sects, 2U, data, req->sects, 3U);      http_req_split_hdrs(con, req);    }    evnt_got_pkt(con->evnt);    if (HTTP_CONF_SAFE_PRINT_REQ)      vlg_dbg3(vlg, "REQ:\n$<vstr.hexdump:%p%zu%zu>",               data, (size_t)1, req->len);    else      vlg_dbg3(vlg, "REQ:\n$<vstr:%p%zu%zu>", data, (size_t)1, req->len);        assert(((req->sects->num >= 3) && !req->ver_0_9) || (req->sects->num == 2));        op_pos        = VSTR_SECTS_NUM(req->sects, 1)->pos;    op_len        = VSTR_SECTS_NUM(req->sects, 1)->len;    req->path_pos = VSTR_SECTS_NUM(req->sects, 2)->pos;    req->path_len = VSTR_SECTS_NUM(req->sects, 2)->len;    if (!req->ver_0_9 && !http__parse_1_x(con, req))    {      if (req->error_code == 500)        return (http_fin_errmem_req(con, req));      return (http_fin_err_req(con, req));    }        if (!http_parse_host(con, req))      return (http_fin_err_req(con, req));    if (0) { }    else if (VEQ(data, op_pos, op_len, "GET"))    {      if (!VPREFIX(data, req->path_pos, req->path_len, "/"))        HTTPD_ERR_MSG_RET(req, 400, "Bad path", http_fin_err_req(con, req));            if (!http_req_make_path(con, req))        return (http_fin_err_req(con, req));      return (http_req_op_get(con, req));    }    else if (req->ver_0_9) /* 400 or 501? - apache does 400 */      HTTPD_ERR_RET(req, 501, http_fin_err_req(con, req));          else if (VEQ(data, op_pos, op_len, "HEAD"))    {      req->head_op = TRUE; /* not sure where this should go here */            if (!VPREFIX(data, req->path_pos, req->path_len, "/"))        HTTPD_ERR_MSG_RET(req, 400, "Bad path", http_fin_err_req(con, req));            if (!http_req_make_path(con, req))        return (http_fin_err_req(con, req));      return (http_req_op_get(con, req));    }    else if (VEQ(data, op_pos, op_len, "OPTIONS"))    {      if (!VPREFIX(data, req->path_pos, req->path_len, "/") &&          !VEQ(data, req->path_pos, req->path_len, "*"))        HTTPD_ERR_MSG_RET(req, 400, "Bad path", http_fin_err_req(con, req));      /* Speed hack: Don't even call make_path if it's "OPTIONS * ..."       * and we don't need to check the Host header */      if (req->policy->use_vhosts_name &&          req->policy->use_host_chk && req->policy->use_host_err_400 &&          !VEQ(data, req->path_pos, req->path_len, "*") &&          !http_req_make_path(con, req))        return (http_fin_err_req(con, req));      return (http_req_op_opts(con, req));    }    else if (req->policy->use_trace_op && VEQ(data, op_pos, op_len, "TRACE"))      return (http_req_op_trace(con, req));    else if (VEQ(data, op_pos, op_len, "TRACE") ||             VEQ(data, op_pos, op_len, "POST") ||             VEQ(data, op_pos, op_len, "PUT") ||             VEQ(data, op_pos, op_len, "DELETE") ||             VEQ(data, op_pos, op_len, "CONNECT") ||             FALSE) /* we know about these ... but don't allow them */      HTTPD_ERR_RET(req, 405, http_fin_err_req(con, req));    else      HTTPD_ERR_RET(req, 501, http_fin_err_req(con, req));  }  ASSERT_NOT_REACHED();}