(headers http.Header)
| 380 | } |
| 381 | |
| 382 | func analyzeCacheIndicator(headers http.Header) (indicators []string) { |
| 383 | customCacheHeader := strings.ToLower(Config.CacheHeader) |
| 384 | for key, val := range headers { |
| 385 | switch strings.ToLower(key) { |
| 386 | case "cache-control", "pragma", "vary", "expires": |
| 387 | msg := fmt.Sprintf("%s header was found: %s \n", key, val) |
| 388 | PrintVerbose(msg, Cyan, 1) |
| 389 | case "x-cache", "cf-cache-status", "x-drupal-cache", "x-varnish-cache", "akamai-cache-status", "server-timing", "x-iinfo", "x-nc", "x-hs-cf-cache-status", "x-proxy-cache", "x-cache-hits", "x-cache-status", "x-cache-info", "x-rack-cache", "cdn_cache_status", "cache_status", "x-akamai-cache", "x-akamai-cache-remote", "x-cache-remote", "x-litespeed-cache", "x-kinsta-cache", "x-ac", "cache-status", "ki-cf-cache-status", "eo-cache-status", "x-77-cache", "x-cache-lookup", "x-cc-via", customCacheHeader: |
| 390 | // CacheHeader flag might not be set (=> ""). Continue in this case |
| 391 | if key == "" { |
| 392 | continue |
| 393 | } |
| 394 | indicators = append(indicators, key) |
| 395 | msg := fmt.Sprintf("%s header was found: %s \n", key, val) |
| 396 | PrintVerbose(msg, Cyan, 1) |
| 397 | case "age": |
| 398 | // only set it it wasn't set to x-cache or sth. similar beforehand |
| 399 | indicators = append(indicators, key) |
| 400 | msg := fmt.Sprintf("%s header was found: %s\n", key, val) |
| 401 | PrintVerbose(msg, Cyan, 1) |
| 402 | } |
| 403 | } |
| 404 | return indicators |
| 405 | } |
no test coverage detected