function isRangeFresh() {
      const ifRange =
        /** @type {string | undefined} */
        (getRequestHeader(req, "if-range"));

      if (!ifRange) {
        return true;
      }

      // if-range as etag
      if (ifRange.includes('"')) {
        const etag =
          /** @type {string | undefined} */
          (getResponseHeader(res, "ETag"));

        if (!etag) {
          return true;
        }

        return Boolean(etag && ifRange.includes(etag));
      }

      // if-range as modified date
      const lastModified =
        /** @type {string | undefined} */
        (getResponseHeader(res, "Last-Modified"));

      if (!lastModified) {
        return true;
      }

      return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
    }
@returns {boolean} true when range is fresh, otherwise false