parseCacheControlDirectives parses a Cache-Control header value (Section 5.2 of [RFC7234]).
(cacheControl string)
| 262 | // parseCacheControlDirectives parses a Cache-Control header value |
| 263 | // (Section 5.2 of [RFC7234]). |
| 264 | func 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. |