-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Preserve port when computing the login URL #6711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
import XCTest | ||
@testable import PackageRegistryTool | ||
|
||
final class PackageRegistryToolTests: XCTestCase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new tests can go into CommandsTests/PackageRegistryToolTests.swift
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger that, done!
@swift-ci please smoke test |
I agree that it's unlikely to have multiple registries on the same host. If we were to support/fix this however, I don't know if using I think changing from |
Done! |
@swift-ci please smoke test |
@swift-ci please test Windows |
@swift-ci please test Windows platform |
|
||
} | ||
|
||
func testCreateLoginURLMaintainsPort() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
@swift-ci please test Windows platform |
Co-authored-by: Yim Lee <yim_lee@apple.com>
@swift-ci please smoke test |
@swift-ci please test Windows platform |
1 similar comment
@swift-ci please test Windows platform |
@swift-ci please test Windows platform |
@Palleas This looks good to merge! Can you please create a PR for the |
@Palleas Thank you! |
When using a registry URL that contains a port, ensure the port is preserved when computing the login URL.
Motivation:
Currently if you run the following
You might get something like
That's because the login url is built like this and ignores the port:
URL(string: "https://\(host)\(loginAPIPath ?? "/login")")
Modifications:
URLComponents
to build the login URL (which maintains the port)SwiftPackageRegistryTool
Result:
SPM can use registry URLs with ports.
I do have a question though, the registry authentication configuration dingus currently uses the host as the key:
https://github.com/apple/swift-package-manager/blob/main/Sources/PackageRegistryTool/PackageRegistryTool%2BAuth.swift#L234-L237
I suspect it's pretty unlikely that someone would use multiple registries available at the same host on different ports, but should I update that, as well?