This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Commit 712d306
authored
Optimize proxy PAC file discovery process for SocketsHttpHandler (#29050)
This PR will reduce the calls to WinHTTP GetProxyForUrl() if a previous call recently discovered
no PAC file within a certain timeframe. We call this API when "Automatically detect settings"
is turned on. The default configuration on Windows has this proxy setting always turned on. This
is ironic given that most network environments don't have a PAC file on the network. So, it's
important to try to optimize this common case on customers' networks.
Initial testing shows at least a 2x speed improvement with these changes.
I did not use any locking mechanisms since those would drag down performance. In the worst case,
any race condition would mean we might call GetProxyForUrl() an extra time. But since we're only
filtering on ERROR_WINHTTP_AUTODETECTION_FAILED, it is unlikely to actually change over time.
That particular error means that the WPAD protocol was able to complete on the network, but the
answer discovered is that there is no PAC file registered on the network.
Fixes #285431 parent 9964306 commit 712d306
File tree
2 files changed
+30
-11
lines changed- src
- System.Net.Http.WinHttpHandler/src/System/Net/Http
- System.Net.Http/src/System/Net/Http/SocketsHttpHandler
2 files changed
+30
-11
lines changedLines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
79 | 82 | | |
80 | 83 | | |
81 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
| |||
123 | 130 | | |
124 | 131 | | |
125 | 132 | | |
| 133 | + | |
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
| |||
131 | 139 | | |
132 | 140 | | |
133 | 141 | | |
134 | | - | |
| 142 | + | |
135 | 143 | | |
136 | 144 | | |
137 | 145 | | |
| |||
154 | 162 | | |
155 | 163 | | |
156 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
157 | 171 | | |
158 | 172 | | |
159 | 173 | | |
| |||
Lines changed: 15 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | | - | |
331 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
| 334 | + | |
334 | 335 | | |
335 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
336 | 345 | | |
337 | 346 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 347 | + | |
343 | 348 | | |
344 | 349 | | |
345 | 350 | | |
| |||
0 commit comments