MCPcopy Create free account
hub / github.com/containers/image / logResponseWarnings

Method logResponseWarnings

docker/docker_client.go:628–648  ·  view source on GitHub ↗

logResponseWarnings logs warningHeaders from res, if any.

(res *http.Response, warningHeaders []string)

Source from the content-addressed store, hash-verified

626
627// logResponseWarnings logs warningHeaders from res, if any.
628func (c *dockerClient) logResponseWarnings(res *http.Response, warningHeaders []string) {
629 c.reportedWarningsLock.Lock()
630 defer c.reportedWarningsLock.Unlock()
631
632 for _, header := range warningHeaders {
633 warningString := parseRegistryWarningHeader(header)
634 if warningString == "" {
635 logrus.Debugf("Ignored Warning: header from registry: %q", header)
636 } else {
637 if !c.reportedWarnings.Contains(warningString) {
638 c.reportedWarnings.Add(warningString)
639 // Note that reportedWarnings is based only on warningString, so that we don’t
640 // repeat the same warning for every request - but the warning includes the URL;
641 // so it may not be specific to that URL.
642 logrus.Warnf("Warning from registry (first encountered at %q): %q", res.Request.URL.Redacted(), warningString)
643 } else {
644 logrus.Debugf("Repeated warning from registry at %q: %q", res.Request.URL.Redacted(), warningString)
645 }
646 }
647 }
648}
649
650// parseRegistryWarningHeader parses a Warning: header per RFC 7234, limited to the warning
651// values allowed by opencontainers/distribution-spec.

Callers 1

Calls 3

ContainsMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected