bin/varnishd/cache/cache_range.c
static int
vrg_ifrange(struct req *req)
{
	const char *p, *e;
	vtim_real ims, lm, d;

	if (!http_GetHdr(req->http, H_If_Range, &p))	// rfc7233,l,455,456
		return (1);

	/* strong validation needed */
	if (p[0] == 'W' && p[1] == '/')			// rfc7233,l,500,501
		return (0);

	/* ETag */
	if (p[0] == '"') {				// rfc7233,l,512,514
		if (!http_GetHdr(req->resp, H_ETag, &e))
			return (0);
		if ((e[0] == 'W' && e[1] == '/'))	// rfc7232,l,547,548
			return (0);
		/* XXX: should we also have http_etag_cmp() ? */
		return (strcmp(p, e) == 0);		// rfc7232,l,548,548
	}

	/* assume date, strong check [RFC7232 2.2.2 p7] */
	ims = VTIM_parse(p);
	if (!ims)					// rfc7233,l,502,512
		return (0);

	/* the response needs a Date */
	// rfc7232 fc7232,l,439,440
	if (!http_GetHdr(req->resp, H_Date, &p))
		return (0);
	d = VTIM_parse(p);
	if (!d)
		return (0);


	/* grab the Last Modified value */
	if (!http_GetHdr(req->resp, H_Last_Modified, &p))
		return (0);

	lm = VTIM_parse(p);
	if (!lm)
		return (0);

	/* Last Modified must be 60 seconds older than Date */
	if (lm > d + 60)				// rfc7232,l,442,443
		return (0);

	if (lm != ims)					// rfc7233,l,455,456
		return (0);
	return (1);
}
/*
 * return 1 if range should be observed, based on if-range value
 * if-range can either be a date or an ETag [RFC7233 3.2 p8]
 */
return 1 if range should be observed, based on if-range value
if-range can either be a date or an ETag [RFC7233 3.2 p8]
return 1 if range should be observed based on if - range value if - range can either be a date or an ETag [ RFC7233 3 . 2 p8 ]
static int
vrg_ifrange(struct req *req)
{
	const char *p, *e;
	vtim_real ims, lm, d;
	if (!http_GetHdr(req->http, H_If_Range, &p))	
		return (1);
	if (p[0] == 'W' && p[1] == '/')			
		return (0);
	if (p[0] == '"') {				
		if (!http_GetHdr(req->resp, H_ETag, &e))
			return (0);
		if ((e[0] == 'W' && e[1] == '/'))	
			return (0);
		return (strcmp(p, e) == 0);		
	}
	ims = VTIM_parse(p);
	if (!ims)					
		return (0);
	if (!http_GetHdr(req->resp, H_Date, &p))
		return (0);
	d = VTIM_parse(p);
	if (!d)
		return (0);
	if (!http_GetHdr(req->resp, H_Last_Modified, &p))
		return (0);
	lm = VTIM_parse(p);
	if (!lm)
		return (0);
	if (lm > d + 60)				
		return (0);
	if (lm != ims)					
		return (0);
	return (1);
}
static int vrg_ifrange ( struct req * req ) { const char * p , * e ; vtim_real ims , lm , d ; if ( ! http_GetHdr ( req -> http , H_If_Range , & p ) ) return ( 1 ) ; if ( p [ 0 ] == ' ' && p [ 1 ] == ' ' ) return ( 0 ) ; if ( p [ 0 ] == ' ' ) { if ( ! http_GetHdr ( req -> resp , H_ETag , & e ) ) return ( 0 ) ; if ( ( e [ 0 ] == ' ' && e [ 1 ] == ' ' ) ) return ( 0 ) ; return ( strcmp ( p , e ) == 0 ) ; } ims = VTIM_parse ( p ) ; if ( ! ims ) return ( 0 ) ; if ( ! http_GetHdr ( req -> resp , H_Date , & p ) ) return ( 0 ) ; d = VTIM_parse ( p ) ; if ( ! d ) return ( 0 ) ; if ( ! http_GetHdr ( req -> resp , H_Last_Modified , & p ) ) return ( 0 ) ; lm = VTIM_parse ( p ) ; if ( ! lm ) return ( 0 ) ; if ( lm > d + 60 ) return ( 0 ) ; if ( lm != ims ) return ( 0 ) ; return ( 1 ) ; }
return 1 if range should be observed, based on if-range value
 if-range can either be a date or an ETag [RFC7233 3.2 p8]
return 1 if range should be observed based on if - range value if - range can either be a date or an ETag [ RFC7233 3 . 2 p8 ]
// rfc7233,l,455,456 /* strong validation needed */ // rfc7233,l,500,501 /* ETag */ // rfc7233,l,512,514 // rfc7232,l,547,548 /* XXX: should we also have http_etag_cmp() ? */ // rfc7232,l,548,548 /* assume date, strong check [RFC7232 2.2.2 p7] */ // rfc7233,l,502,512 /* the response needs a Date */ // rfc7232 fc7232,l,439,440 /* grab the Last Modified value */ /* Last Modified must be 60 seconds older than Date */ // rfc7232,l,442,443 // rfc7233,l,455,456