vs1, pos, len, !h_r->pos)))
vs1, pos, len, FALSE)))
static int http_response_ok(struct Con *con, struct Httpd_req_data *req,                            unsigned int *http_ret_code,                            const char ** http_ret_line){  const Vstr_base *hdrs = con->evnt->io_r;  time_t mtime = req->f_stat->st_mtime;  Vstr_sect_node *h_ims  = req->http_hdrs->hdr_if_modified_since;  Vstr_sect_node *h_ir   = req->http_hdrs->hdr_if_range;  Vstr_sect_node *h_iums = req->http_hdrs->hdr_if_unmodified_since;  Vstr_sect_node *h_r    = req->http_hdrs->multi->hdr_range;  Vstr_base *comb = req->http_hdrs->multi->comb;  Vstr_sect_node *h_im   = req->http_hdrs->multi->hdr_if_match;  Vstr_sect_node *h_inm  = req->http_hdrs->multi->hdr_if_none_match;  int h_ir_tst      = FALSE;  int h_iums_tst    = FALSE;  int req_if_range  = FALSE;  int cached_output = FALSE;  const char *date = NULL;    if (req->ver_1_1 && h_iums->pos)    h_iums_tst = TRUE;  if (req->ver_1_1 && h_ir->pos && h_r->pos)    h_ir_tst = TRUE;    /* assumes time doesn't go backwards ... From rfc2616:   *   Note: When handling an If-Modified-Since header field, some   servers will use an exact date comparison function, rather than a   less-than function, for deciding whether to send a 304 (Not   Modified) response. To get best results when sending an If-   Modified-Since header field for cache validation, clients are   advised to use the exact date string received in a previous Last-   Modified header field whenever possible.  */  if (difftime(req->now, mtime) > 0)  { /* if mtime in future, or now ... don't allow checking */    Date_store *ds = httpd_opts->date;    date = date_rfc1123(ds, mtime);    if (h_ims->pos && !cached_output && HTTPD__HD_EQ(ims))      cached_output = TRUE;    if (h_iums_tst &&                   HTTPD__HD_EQ(iums))      return (FALSE);    if (h_ir_tst   && !req_if_range  && HTTPD__HD_EQ(ir))      req_if_range = TRUE;      date = date_rfc850(ds, mtime);    if (h_ims->pos && !cached_output && HTTPD__HD_EQ(ims))      cached_output = TRUE;    if (h_iums_tst &&                   HTTPD__HD_EQ(iums))      return (FALSE);    if (h_ir_tst   && !req_if_range  && HTTPD__HD_EQ(ir))      req_if_range = TRUE;      date = date_asctime(ds, mtime);    if (h_ims->pos && !cached_output && HTTPD__HD_EQ(ims))      cached_output = TRUE;    if (h_iums_tst &&                   HTTPD__HD_EQ(iums))      return (FALSE);    if (h_ir_tst   && !req_if_range  && HTTPD__HD_EQ(ir))      req_if_range = TRUE;  }  if (req->ver_1_1)  {    const Vstr_base *vs1 = NULL;    size_t pos = 0;    size_t len = 0;    if (req->content_encoding_bzip2) /* point to any entity tags we have */    {      if (req->bzip2_etag_vs1 && (req->etag_time > mtime))      {        vs1 = req->bzip2_etag_vs1;        pos = req->bzip2_etag_pos;        len = req->bzip2_etag_len;      }    }    else if (req->content_encoding_gzip)    {      if (req->gzip_etag_vs1 && (req->etag_time > mtime))      {        vs1 = req->gzip_etag_vs1;        pos = req->gzip_etag_pos;        len = req->gzip_etag_len;      }    }    else if (req->etag_vs1 && (req->etag_time > mtime))    {      vs1 = req->etag_vs1;      pos = req->etag_pos;      len = req->etag_len;    }    if (h_ir_tst   && !req_if_range &&        httpd_match_etags(req,                          hdrs, h_ir->pos, h_ir->len, vs1, pos, len, FALSE))      req_if_range = TRUE;      if (h_ir_tst && !req_if_range)      h_r->pos = 0;    /* #13.3.3 says don't trust weak for "complex" queries, ie. byteranges */    if (h_inm->pos && (VEQ(hdrs, h_inm->pos, h_inm->len, "*") ||                       httpd_match_etags(req, comb, h_inm->pos, h_inm->len,                                         vs1, pos, len, !h_r->pos)))      cached_output = TRUE;        if (h_im->pos  && !(VEQ(hdrs, h_im->pos, h_im->len, "*") ||                        httpd_match_etags(req, comb, h_im->pos, h_im->len,                                          vs1, pos, len, !h_r->pos)))      return (FALSE);  }  else if (h_ir_tst && !req_if_range)    h_r->pos = 0;    if (cached_output)  {    req->head_op = TRUE;    *http_ret_code = 304;    *http_ret_line = "Not Modified";  }  else if (h_r->pos)  {    *http_ret_code = 206;    *http_ret_line = "Partial content";  }  return (TRUE);}