summaryrefslogtreecommitdiff
path: root/distribution/errors.go
diff options
context:
space:
mode:
authorAaron Lehmann <aaron.lehmann@docker.com>2016-02-11 15:45:29 -0800
committerAaron Lehmann <aaron.lehmann@docker.com>2016-02-12 13:47:48 -0800
commit5e8af46fda3f4e17e06726237fc6b9ab6957e3ea (patch)
tree3bfe5e571eeb54b45867116091dc66792ddc5eec /distribution/errors.go
parentc312eab74e2200d443dd5422d1aa5e240b8db473 (diff)
downloaddocker-5e8af46fda3f4e17e06726237fc6b9ab6957e3ea.tar.gz
Smarter push/pull TLS fallback
With the --insecure-registry daemon option (or talking to a registry on a local IP), the daemon will first try TLS, and then try plaintext if something goes wrong with the push or pull. It doesn't make sense to try plaintext if a HTTP request went through while using TLS. This commit changes the logic to keep track of host/port combinations where a TLS attempt managed to do at least one HTTP request (whether the response code indicated success or not). If the host/port responded to a HTTP using TLS, we won't try to make plaintext HTTP requests to it. This will result in better error messages, which sometimes ended up showing the result of the plaintext attempt, like this: Error response from daemon: Get http://myregistrydomain.com:5000/v2/: malformed HTTP response "\x15\x03\x01\x00\x02\x02" Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Diffstat (limited to 'distribution/errors.go')
-rw-r--r--distribution/errors.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/distribution/errors.go b/distribution/errors.go
index 9f9dcf6978..1cb34fdd51 100644
--- a/distribution/errors.go
+++ b/distribution/errors.go
@@ -31,6 +31,10 @@ type fallbackError struct {
// supports the v2 protocol. This is used to limit fallbacks to the v1
// protocol.
confirmedV2 bool
+ // transportOK is set to true if we managed to speak HTTP with the
+ // registry. This confirms that we're using appropriate TLS settings
+ // (or lack of TLS).
+ transportOK bool
}
// Error renders the FallbackError as a string.