Skip to content
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

[6.1] Handle paginated registry metadata responses (#8219) #8262

Merged

Conversation

plemarquand
Copy link
Contributor

@plemarquand plemarquand commented Jan 30, 2025

In 4.1 List Package
Releases
it is stated that a server may respond with a Link header that contains a pointer to a subsequent page of results. SwiftPM is not checking for the next link in the Link header and so if a registry returns paginated results, only the first page of versions is searched when resolving. This would result in a "version not found" error when in reality the version is present in a subsequent page of results.

Respect the next link in the Link header by loading the next page of results and building up a list of versions, continuing until there is no next link present in the Link header of the last result.

Registry servers that serve paginated results now have all their results read.

Issue: #8215

In [4.1 List Package
Releases](https://github.com/swiftlang/swift-package-manager/blob/main/Documentation/PackageRegistry/Registry.md#41-list-package-releases)
it is stated that a server may respond with a `Link` header that
contains a pointer to a subsequent page of results. SwiftPM is not
checking for the `next` link in the `Link` header and so if a registry
returns paginated results, only the first page of versions is searched
when resolving. This would result in a "version not found" error when in
reality the version is present in a subsequent page of results.

Respect the `next` link in the `Link` header by loading the next page of
results and building up a list of versions, continuing until there is no
`next` link present in the `Link` header of the last result.

Registry servers that serve paginated results now have all their results
read.

Issue: swiftlang#8215
@plemarquand
Copy link
Contributor Author

@swift-ci test

@plemarquand plemarquand merged commit b8c1edc into swiftlang:release/6.1 Jan 31, 2025
5 checks passed
@plemarquand plemarquand deleted the paginated-registry-6.1 branch January 31, 2025 16:17
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.

2 participants