Bump lico to latest release

This commit is contained in:
Ralf Haferkamp
2024-05-08 17:57:35 +02:00
parent 3be286a2a3
commit 62dbf737c7
18 changed files with 92 additions and 101 deletions

View File

@@ -132,7 +132,6 @@ func parse(value string, cd cacheDirective) error {
// time in seconds: http://tools.ietf.org/html/rfc7234#section-1.2.1
//
// When set to -1, this means unset.
//
type DeltaSeconds int32
// Parser for delta-seconds, a uint31, more or less:
@@ -167,7 +166,6 @@ type cacheDirective interface {
// LOW LEVEL API: Representation of possible request directives in a `Cache-Control` header: http://tools.ietf.org/html/rfc7234#section-5.2.1
//
// Note: Many fields will be `nil` in practice.
//
type RequestCacheDirectives struct {
// max-age(delta seconds): http://tools.ietf.org/html/rfc7234#section-5.2.1.1
@@ -188,7 +186,7 @@ type RequestCacheDirectives struct {
// by no more than the specified number of seconds. If no value is
// assigned to max-stale, then the client is willing to accept a stale
// response of any age.
MaxStale DeltaSeconds
MaxStale DeltaSeconds
MaxStaleSet bool
// min-fresh(delta seconds): http://tools.ietf.org/html/rfc7234#section-5.2.1.3
@@ -227,6 +225,9 @@ type RequestCacheDirectives struct {
// wishes to obtain a stored response.
OnlyIfCached bool
// stale-if-error(delta seconds): https://datatracker.ietf.org/doc/html/rfc5861#section-4
StaleIfError DeltaSeconds
// Extensions: http://tools.ietf.org/html/rfc7234#section-5.2.3
//
// The Cache-Control header field can be extended through the use of one
@@ -253,6 +254,8 @@ func (cd *RequestCacheDirectives) addToken(token string) error {
cd.NoTransform = true
case "only-if-cached":
cd.OnlyIfCached = true
case "stale-if-error":
err = ErrMaxAgeDeltaSeconds
default:
cd.Extensions = append(cd.Extensions, token)
}
@@ -286,6 +289,11 @@ func (cd *RequestCacheDirectives) addPair(token string, v string) error {
err = ErrNoTransformNoArgs
case "only-if-cached":
err = ErrOnlyIfCachedNoArgs
case "stale-if-error":
cd.StaleIfError, err = parseDeltaSeconds(v)
if err != nil {
err = ErrStaleIfErrorDeltaSeconds
}
default:
// TODO(pquerna): this sucks, making user re-parse
cd.Extensions = append(cd.Extensions, token+"="+v)
@@ -312,7 +320,6 @@ func ParseRequestCacheControl(value string) (*RequestCacheDirectives, error) {
// LOW LEVEL API: Repersentation of possible response directives in a `Cache-Control` header: http://tools.ietf.org/html/rfc7234#section-5.2.2
//
// Note: Many fields will be `nil` in practice.
//
type ResponseCacheDirectives struct {
// must-revalidate(bool): http://tools.ietf.org/html/rfc7234#section-5.2.2.1