MCPcopy Create free account
hub / github.com/WICG/webpackage / parseCacheControlDirectives

Function parseCacheControlDirectives

go/signedexchange/verifier.go:264–277  ·  view source on GitHub ↗

parseCacheControlDirectives parses a Cache-Control header value (Section 5.2 of [RFC7234]).

(cacheControl string)

Source from the content-addressed store, hash-verified

262// parseCacheControlDirectives parses a Cache-Control header value
263// (Section 5.2 of [RFC7234]).
264func parseCacheControlDirectives(cacheControl string) map[string]string {
265 directives := map[string]string{}
266 // TODO: correctly handle quoted-string arguments.
267 for _, s := range strings.Split(cacheControl, ",") {
268 s = strings.TrimSpace(s)
269 eq := strings.IndexByte(s, '=')
270 if eq >= 0 {
271 directives[strings.ToLower(s[:eq])] = s[eq+1:]
272 } else {
273 directives[strings.ToLower(s)] = ""
274 }
275 }
276 return directives
277}
278
279// verifySignature verifies single signature, as described in
280// https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#signature-validity.

Callers 1

IsCacheableMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected