[Repo Assist] Use HttpClient with SocketsHttpHandler on .NET 8+ to avoid socket exhaustion#1667
Closed
github-actions[bot] wants to merge 2 commits intomainfrom
Closed
Conversation
…austion On .NET 8+, Http.Request and friends now use a shared System.Net.Http.HttpClient backed by a SocketsHttpHandler with: - PooledConnectionLifetime = 2 minutes (to handle DNS changes) - AutomaticDecompression = GZip | Deflate | Brotli - UseCookies = false (cookies handled manually, matching existing behaviour) - AllowAutoRedirect = true The HttpWebRequest path is preserved for netstandard2.0 and for any .NET 8+ call that provides customizeHttpRequest (for backward compatibility). Timeout exceptions are wrapped as WebException(Status=Timeout) for compat. Duplicate-header checking is preserved on the new code path. Closes #1392 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4 tasks
Contributor
|
Closing as seems too invasive for now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.
Implements @dsyme's request from #1392 — use
System.Net.Http.HttpClienton .NET 8+ to address socket exhaustion and modernise the HTTP implementation.Closes #1392
What changed
FSharp.Data.Httpnow multi-targetsnetstandard2.0;net8.0. On thenet8.0target, allHttp.Request*/Http.AsyncRequest*calls go through a sharedHttpClientbacked by aSocketsHttpHandler:PooledConnectionLifetimeAutomaticDecompressionUseCookiesfalseCookieContainerlogic reused)AllowAutoRedirecttrueThe
HttpWebRequestpath is fully preserved for:netstandard2.0(unchanged).NET 8+call that suppliescustomizeHttpRequest(backwards-compatible fallback)Backward-compatibility notes
customizeHttpRequest: HttpWebRequest -> HttpWebRequeststill works on all TFMs (falls back toHttpWebRequeston .NET 8+)WebException(Status=Timeout)on theHttpClientpathHttpClientpathCookieContainerand explicitcookiesparameter are combined into aCookieheaderTest status
All existing tests pass — 2846/2847 (1 pre-existing network-blocked test unrelated to this change).
Build:
netstandard2.0✅ ·net8.0✅Warning
The following domain was blocked by the firewall during workflow execution:
www.google.com