Skip to content

registry: refactor registry.IsSecure calls into registry.NewEndpoint#9104

Merged
vbatts merged 3 commits intomoby:masterfrom
tiborvass:issecure-check-in-new-endpoint
Nov 13, 2014
Merged

registry: refactor registry.IsSecure calls into registry.NewEndpoint#9104
vbatts merged 3 commits intomoby:masterfrom
tiborvass:issecure-check-in-new-endpoint

Conversation

@tiborvass
Copy link
Copy Markdown
Contributor

Signed-off-by: Tibor Vass teabee89@gmail.com

Ping @dmcgowan @proppy @vbatts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't see be an argument of newEndpoint?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would mean passing that insecureRegistries down once more. Plus I made secure = true by default.

@tiborvass tiborvass force-pushed the issecure-check-in-new-endpoint branch from 6b2e0e5 to bad12ef Compare November 11, 2014 22:49
@dmcgowan
Copy link
Copy Markdown
Member

registry_test.go still needs updates to the new NewEndpoint interface

./registry_test.go:24: cannot use false (type bool) as type []string in argument to NewEndpoint
./registry_test.go:36: cannot use false (type bool) as type []string in argument to NewEndpoint

@vbatts
Copy link
Copy Markdown
Contributor

vbatts commented Nov 12, 2014

Didn't I open a PR for tests on endpoint? Or do you mean additional tests?
On Nov 11, 2014 5:56 PM, "Derek McGowan" notifications@github.com wrote:

registry_test.go still needs updates to the new NewEndpoint interface


Reply to this email directly or view it on GitHub
#9104 (comment).

@tiborvass
Copy link
Copy Markdown
Contributor Author

@dmcgowan @vbatts @proppy Fixed it. PTAL

@dmcgowan
Copy link
Copy Markdown
Member

LGTM

@tiborvass tiborvass added this to the 1.3.2 milestone Nov 12, 2014
@crosbymichael
Copy link
Copy Markdown
Contributor

@tiborvass this is a pure refactor right? no functional changes?

@tiborvass
Copy link
Copy Markdown
Contributor Author

Mainly potential bugfix: https://github.com/docker/docker/blob/master/registry/service.go#L43
If addr has a form like the one that IndexServerAddress() returns (i.e. https://index.docker.io/v1/), then it is different from the domain:port form that IsSecure expects.

Additionally, I realized that the only places where we use IsSecure is before a call to NewEndpoint. Since we could make use of the URL parsing in newEndpoint, I thought it could be good to refactor it.

@vbatts
Copy link
Copy Markdown
Contributor

vbatts commented Nov 12, 2014

Something I feel is missing, is a test reflecting the potential issue this fixes.

@vbatts vbatts closed this Nov 12, 2014
@vbatts vbatts reopened this Nov 12, 2014
@vbatts
Copy link
Copy Markdown
Contributor

vbatts commented Nov 12, 2014

functionality and stylistically LGTM and I expect tests to be forthcoming in another PR?

@tiborvass tiborvass force-pushed the issecure-check-in-new-endpoint branch from 0d3d95f to 78e859f Compare November 13, 2014 02:32
@tiborvass
Copy link
Copy Markdown
Contributor Author

Rebased

Signed-off-by: Tibor Vass <teabee89@gmail.com>
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, this won't be good. hostname now is URL.Host, not the https://index.docker.io/v1/ returned by IndexServerAddress()

@tiborvass tiborvass force-pushed the issecure-check-in-new-endpoint branch from def5b85 to 511d981 Compare November 13, 2014 14:10
@tiborvass
Copy link
Copy Markdown
Contributor Author

Added a commit that fixes a bug with isSecure and IndexServerAddress().

@vbatts @dmcgowan let me know if this new commit is fine for you, or if you prefer that I parse IndexServerAddress() and make the check against someParseFunction(IndexServerAddress()).URL.Host

@tiborvass tiborvass force-pushed the issecure-check-in-new-endpoint branch 2 times, most recently from cee72d2 to fbe10c8 Compare November 13, 2014 15:00
…ecure

Signed-off-by: Tibor Vass <teabee89@gmail.com>
@tiborvass
Copy link
Copy Markdown
Contributor Author

@vbatts @dmcgowan I actually did the latter, making sure that it is isSecure's responsibility to always return true for the index.

I ended up doing what @proppy initially suggested (seems like a recurring theme now :P). I'm passing insecureRegistries to newEndpoint as well.

@tiborvass
Copy link
Copy Markdown
Contributor Author

Not sure if the drone error is related...

@dmcgowan
Copy link
Copy Markdown
Member

LGTM

1 similar comment
@vbatts
Copy link
Copy Markdown
Contributor

vbatts commented Nov 13, 2014

LGTM

vbatts added a commit that referenced this pull request Nov 13, 2014
registry: refactor registry.IsSecure calls into registry.NewEndpoint
@vbatts vbatts merged commit 447a1a9 into moby:master Nov 13, 2014
@tiborvass tiborvass deleted the issecure-check-in-new-endpoint branch July 17, 2019 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants