Skip to content

[5.9] Preserve port when computing the login URL #6715

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

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

Palleas
Copy link
Contributor

@Palleas Palleas commented Jul 18, 2023

(Same as #6711 but for 5.9.)

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

swift package-registry set https://packages.example.com:8081
swift package-registry login --token XYZ

You might get something like

Error: Unable to connect to server: https://packages.example.com

That's because the login url is built like this and ignores the port: URL(string: "https://\(host)\(loginAPIPath ?? "/login")")

Modifications:

  • Use URLComponents to build the login URL (which maintains the port)
  • Update RegistryConfiguration to compute the storage key

Result:

SPM can use registry URLs with ports.

@Palleas
Copy link
Contributor Author

Palleas commented Jul 18, 2023

@swift-ci please test

@yim-lee
Copy link
Contributor

yim-lee commented Jul 18, 2023

@swift-ci please smoke test

@tomerd tomerd added the swift 5.9 This PR targets the 5.9 branch label Jul 18, 2023
@tomerd tomerd merged commit fc14c26 into swiftlang:release/5.9 Jul 18, 2023
@Palleas Palleas deleted the romain/keep-port-5.9 branch July 19, 2023 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
swift 5.9 This PR targets the 5.9 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants