Repository navigation
Conversation
f622575 to
ec24130
Compare
00d7594 to
7ee3d42
Compare
ec24130 to
aec3df9
Compare
7ee3d42 to
993537a
Compare
aec3df9 to
4cf5608
Compare
993537a to
ae18601
Compare
4cf5608 to
adf7d89
Compare
ae18601 to
a43f680
Compare
adf7d89 to
a37bcc3
Compare
a43f680 to
043e682
Compare
d5a99c8 to
5b481d0
Compare
043e682 to
197a5b6
Compare
c3c093b to
503148f
Compare
339c300 to
1ed22ad
Compare
503148f to
0185839
Compare
1ed22ad to
46b2442
Compare
0185839 to
f04fc45
Compare
f04fc45 to
5167ea5
Compare
67a24c7 to
9343898
Compare
9343898 to
72b22ae
Compare
| let mut client = reqwest_middleware::ClientBuilder::new(client); | ||
|
|
||
| // Run redirects before the other middleware so each hop can retry and authenticate. | ||
| if matches!(self.redirect_policy, RedirectPolicy::RetriggerMiddleware) { |
There was a problem hiding this comment.
It'd be good for this to be exhaustive
| /// Unlike the built-in reqwest redirect policies, this sends the redirect request through the | ||
| /// entire middleware pipeline again. | ||
| /// remaining middleware pipeline again. |
63c1ee4 to
3154a48
Compare
3154a48 to
304dae4
Compare
Merging this PR will improve performance by 15.95%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ |
Simulation | discover_workspace_from_all_members_with_excludes |
165.6 ms | 139.7 ms | +18.57% |
| ⚡ |
Simulation | resolve_warm_jupyter_universal |
308.6 ms | 268.2 ms | +15.1% |
| ⚡ |
Simulation | resolve_warm_jupyter |
71.7 ms | 62.8 ms | +14.22% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing zb/range-reader-redirects (28d1cb0) with main (64e2ac8)
Footnotes
-
35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
304dae4 to
6ed3297
Compare
6ed3297 to
28d1cb0
Compare
28d1cb0 to
343fee8
Compare
uv normally reads wheel metadata by requesting only part of the file. For Azure Artifacts, redirects were causing uv to fall back to streaming the wheel, even though the server supported requests for individual byte ranges (astral-sh#21347).
The current design came from astral-sh#14126, which fixed credentials being missed after a redirect.
reqwestfollowed redirects without giving uv a chance to look up credentials for the destination, including those in.netrc. uv added its own HTTP client and request builder to ensure those lookups ran.async_http_range_reader, which uv uses to read parts of the wheel, accepts a standard HTTP client. Previously, uv passed it the client stored inside its own, discarding uv's redirect handling while
reqwest's own redirects remained disabled. The initialHEADrequest followed redirects, but the subsequent requests for part of the wheel did not.Here, we attach redirect handling directly to the client shared with that library and remove the extra client and request builder. Each destination still gets its own credential lookup, without forwarding source credentials to other hosts. Each
GETuses the original wheel URL because signed redirect targets forHEADandGETcan differ.Previously, uv fell back to streaming because it did not follow the redirect. If the destination rejects a ranged
GETwith403while allowing a full download, uv will now report the rejection. Retrying the full download in that situation is proposed separately in #917.