@@ -86,9 +86,9 @@ func PullImageWithTransfer(ctx context.Context, client *containerd.Client, parse
8686
8787 transferErr := doTransfer (ctx , client , fetcher , store , options .Quiet , progressWriter )
8888
89- if transferErr != nil && (errors .Is (transferErr , http .ErrSchemeMismatch ) || errutil .IsErrConnectionRefused (transferErr )) {
89+ if transferErr != nil && (errors .Is (transferErr , http .ErrSchemeMismatch ) || errutil .IsErrConnectionRefused (transferErr ) || errutil . IsErrHTTPResponseToHTTPSClient ( transferErr ) ) {
9090 if options .GOptions .InsecureRegistry {
91- log .G (ctx ).WithError (err ).Warnf ("server %q does not seem to support HTTPS, falling back to plain HTTP" , parsedReference .Domain )
91+ log .G (ctx ).WithError (transferErr ).Warnf ("server %q does not seem to support HTTPS, falling back to plain HTTP" , parsedReference .Domain )
9292 fetcher , err = createOCIRegistry (ctx , parsedReference , options .GOptions , true )
9393 if err != nil {
9494 return nil , err
@@ -158,9 +158,9 @@ func PushImageWithTransfer(ctx context.Context, client *containerd.Client, parse
158158
159159 transferErr := doTransfer (ctx , client , source , pusher , options .Quiet , progressWriter )
160160
161- if transferErr != nil && (errors .Is (transferErr , http .ErrSchemeMismatch ) || errutil .IsErrConnectionRefused (transferErr )) {
161+ if transferErr != nil && (errors .Is (transferErr , http .ErrSchemeMismatch ) || errutil .IsErrConnectionRefused (transferErr ) || errutil . IsErrHTTPResponseToHTTPSClient ( transferErr ) ) {
162162 if options .GOptions .InsecureRegistry {
163- log .G (ctx ).WithError (err ).Warnf ("server %q does not seem to support HTTPS, falling back to plain HTTP" , parsedReference .Domain )
163+ log .G (ctx ).WithError (transferErr ).Warnf ("server %q does not seem to support HTTPS, falling back to plain HTTP" , parsedReference .Domain )
164164 pusher , err = createOCIRegistry (ctx , parsedReference , options .GOptions , true )
165165 if err != nil {
166166 return err
0 commit comments