bin/varnishd/cache/cache_http.c
int
http_GetHdrToken(const struct http *hp, hdr_t hdr,
    const char *token, const char **pb, const char **pe)
{
	const char *h, *b, *e;

	if (pb != NULL)
		*pb = NULL;
	if (pe != NULL)
		*pe = NULL;
	if (!http_GetHdr(hp, hdr, &h))
		return (0);
	AN(h);

	while (http_split(&h, NULL, ",", &b, &e))
		if (http_istoken(&b, e, token))
			break;
	if (b == NULL)
		return (0);
	if (pb != NULL) {
		for (; vct_islws(*b); b++)
			continue;
		if (b == e) {
			b = NULL;
			e = NULL;
		}
		*pb = b;
		if (pe != NULL)
			*pe = e;
	}
	return (1);
}
/*-----------------------------------------------------------------------------
 * Find a given data element (token) in a header according to RFC2616's #rule
 * (section 2.1, p15)
 *
 * On case sensitivity:
 *
 * Section 4.2 (Messages Headers) defines field (header) name as case
 * insensitive, but the field (header) value/content may be case-sensitive.
 *
 * http_GetHdrToken looks up a token in a header value and the rfc does not say
 * explicitly if tokens are to be compared with or without respect to case.
 *
 * But all examples and specific statements regarding tokens follow the rule
 * that unquoted tokens are to be matched case-insensitively and quoted tokens
 * case-sensitively.
 *
 * The optional pb and pe arguments will point to the token content start and
 * end+1, white space trimmed on both sides.
 */
Find a given data element (token) in a header according to RFC2616's #rule
(section 2.1, p15)

On case sensitivity.

Section 4.2 (Messages Headers) defines field (header) name as case
insensitive, but the field (header) value/content may be case-sensitive.

http_GetHdrToken looks up a token in a header value and the rfc does not say
explicitly if tokens are to be compared with or without respect to case.

But all examples and specific statements regarding tokens follow the rule
that unquoted tokens are to be matched case-insensitively and quoted tokens
case-sensitively.

The optional pb and pe arguments will point to the token content start and
end+1, white space trimmed on both sides.
Find a given data element ( token ) in a header according to RFC2616 ' s #rule ( section 2 . 1 p15 ) On case sensitivity . Section 4 . 2 ( Messages Headers ) defines field ( header ) name as case insensitive but the field ( header ) value / content may be case - sensitive . http_GetHdrToken looks up a token in a header value and the rfc does not say explicitly if tokens are to be compared with or without respect to case . But all examples and specific statements regarding tokens follow the rule that unquoted tokens are to be matched case - insensitively and quoted tokens case - sensitively . The optional pb and pe arguments will point to the token content start and end + 1 white space trimmed on both sides .
int
http_GetHdrToken(const struct http *hp, hdr_t hdr,
    const char *token, const char **pb, const char **pe)
{
	const char *h, *b, *e;
	if (pb != NULL)
		*pb = NULL;
	if (pe != NULL)
		*pe = NULL;
	if (!http_GetHdr(hp, hdr, &h))
		return (0);
	AN(h);
	while (http_split(&h, NULL, ",", &b, &e))
		if (http_istoken(&b, e, token))
			break;
	if (b == NULL)
		return (0);
	if (pb != NULL) {
		for (; vct_islws(*b); b++)
			continue;
		if (b == e) {
			b = NULL;
			e = NULL;
		}
		*pb = b;
		if (pe != NULL)
			*pe = e;
	}
	return (1);
}
int http_GetHdrToken ( const struct http * hp , hdr_t hdr , const char * token , const char * * pb , const char * * pe ) { const char * h , * b , * e ; if ( pb != NULL ) * pb = NULL ; if ( pe != NULL ) * pe = NULL ; if ( ! http_GetHdr ( hp , hdr , & h ) ) return ( 0 ) ; AN ( h ) ; while ( http_split ( & h , NULL , " " , & b , & e ) ) if ( http_istoken ( & b , e , token ) ) break ; if ( b == NULL ) return ( 0 ) ; if ( pb != NULL ) { for ( ; vct_islws ( * b ) ; b ++ ) continue ; if ( b == e ) { b = NULL ; e = NULL ; } * pb = b ; if ( pe != NULL ) * pe = e ; } return ( 1 ) ; }
Find a given data element (token) in a header according to RFC2616's #rule
 (section 2.1, p15)
Find a given data element ( token ) in a header according to RFC2616 ' s #rule ( section 2 . 1 p15 )