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

Add only_authenticated option to the client #7545

Merged
merged 1 commit into from
Sep 21, 2024
Merged

Conversation

konstin
Copy link
Member

@konstin konstin commented Sep 19, 2024

When sending an upload request, we use an HTTP formdata request, which can't be cloned (seanmonstar/reqwest#2416, plus a limitation that formdata bodies are always internally streaming), but we also know that we need to always have credentials.

The authentication middleware by default tries to clone the request and send an authenticated request first. By introducing an only_authenticated setting, we can skip this behaviour for publishing.

The second change i rolled in here is not adding the retry middleware when retries are 0, since the retry middleware would always clone the request (it needs to store a copy in case the request fails).

I'm open to switching to any different workaround for the cloneable-request problem.

Split out from #7475

@konstin konstin added the internal A refactor or improvement that is not user-facing label Sep 19, 2024
@konstin konstin requested a review from zanieb September 19, 2024 11:52
When sending an upload request, we use HTTP formdata requests, which can't be cloned (seanmonstar/reqwest#2416, plus a limitation that formdata bodies are always internally streaming), but also know that we need to always have credentials.

The authentication middleware by default tries to clone the request and send an authenticated request first. By introducing an `only_authenticated` setting, we can skip this behaviour for publishing.

Split out from #7475
@konstin konstin force-pushed the konsti/only_authenticated branch from 0debcb3 to 1080964 Compare September 21, 2024 12:43
@zanieb
Copy link
Member

zanieb commented Sep 21, 2024

I might change this in the future to do something like pass a list of URLs which we should not perform unauthenticated requests to — we need that for #4583. This looks fine in the meantime though unless you want to chase that.

@konstin konstin merged commit d9a5f5c into main Sep 21, 2024
58 checks passed
@konstin konstin deleted the konsti/only_authenticated branch September 21, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal A refactor or improvement that is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants