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

Return response of initial HEAD request #1

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

konstin
Copy link
Contributor

@konstin konstin commented Nov 3, 2023

We need this response to determine our caching strategy, specifically we want to know if the response is immutable.

I'm not completely happy with that caching strategy yet but it works for pypi and wheels at a url should be immutable (otherwise you get a hash mismatch when deploying).

We need this response to determine our caching strategy.
@baszalmstra
Copy link
Collaborator

This looks good to me but wouldn't you then also want to add additional headers to the initial request?

src/lib.rs Show resolved Hide resolved
src/lib.rs Outdated
client: reqwest::Client,
url: reqwest::Url,
) -> Result<Self, AsyncHttpRangeReaderError> {
) -> Result<(Self, reqwest::Response), AsyncHttpRangeReaderError> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it makes sense to only return the headers of the request?

@konstin
Copy link
Contributor Author

konstin commented Nov 3, 2023

This looks good to me but wouldn't you then also want to add additional headers to the initial request?

yes, i'll likely add that in the future, though i still have to figure out how to integrate this; i'm still looking for something that implements http caching semantics on top of reqwest without being a middleware, 06chaynes/http-cache#57). For pypi i get away with just checking if the cache control header says "immutable".

@baszalmstra
Copy link
Collaborator

Yeah I would like to have something like that too! Im following your issue. :)

Would you be able to look at the other comments I left?

@baszalmstra baszalmstra merged commit 4cafe5a into prefix-dev:main Nov 3, 2023
@konstin konstin deleted the return-head-response branch November 5, 2023 20:59
konstin added a commit to astral-sh/uv that referenced this pull request Nov 6, 2023
Use range requests and async zip to extract the METADATA file from a
remote wheel.

We currently only cache when the remote says the remote declares the
resource as immutable, see
06chaynes/http-cache#57 and
prefix-dev/async_http_range_reader#1 . The
cache is stored as json with the description omitted, this improve cache
deserialization performance.
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