Commit 94a391a
committed
fix(http): fix proxy memory leak and HTTPS proxy tunnel not triggered from env vars
Use ArenaAllocator for proxy-related allocations in std.http.Client.
Client.deinit() does not free proxy objects (they're externally-owned),
so without an arena those allocations leak — detected by DebugAllocator.
Also expand the CONNECT tunnel workaround to check environment variables
(http_proxy, https_proxy, etc.), not just the explicit proxy_url setting.
Previously, when a proxy was auto-detected from environment variables,
HTTPS requests fell through to the broken connectProxied() path that
returns HTTP 400.
Fixes two issues seen when running 'zvm remote' with http_proxy set:
- DebugAllocator reports leaked proxy memory
- 'Failed to fetch version map' due to connectProxied() returning 400
Affected functions:
- http_client: downloadToFileWithProxy, downloadToMemoryWithProxy
- mirror_probe: probeThreadMainWindows1 parent e3ef3a9 commit 94a391a
2 files changed
Lines changed: 30 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
66 | | - | |
| 74 | + | |
67 | 75 | | |
68 | 76 | | |
69 | 77 | | |
| |||
263 | 271 | | |
264 | 272 | | |
265 | 273 | | |
266 | | - | |
267 | | - | |
| 274 | + | |
| 275 | + | |
268 | 276 | | |
269 | 277 | | |
270 | 278 | | |
271 | 279 | | |
272 | | - | |
| 280 | + | |
273 | 281 | | |
274 | | - | |
275 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
276 | 285 | | |
277 | 286 | | |
278 | 287 | | |
279 | 288 | | |
280 | 289 | | |
281 | | - | |
282 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
283 | 296 | | |
284 | 297 | | |
285 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
181 | 184 | | |
| 185 | + | |
182 | 186 | | |
183 | 187 | | |
184 | | - | |
| 188 | + | |
185 | 189 | | |
186 | | - | |
| 190 | + | |
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
| |||
0 commit comments