From 563726e051764d454ef3f507c36a407b676f1cef Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Fri, 26 Jul 2019 21:40:48 +0100 Subject: [PATCH] take HttpClient.BaseAddress into account when bounding request uri sizes Commit migrated from https://github.com/dotnet/corefx/commit/d5a0fb96a026447dcf201dc7c19b0b8d41be60f5 --- .../System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs index a4368bc..382e8f5 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs @@ -48,6 +48,7 @@ namespace HttpStress public int MaxRequestParameters { get; } public int MaxRequestUriSize { get; } public int MaxContentLength => ContentSource.Length; + public Uri BaseAddress => _client.BaseAddress; // HttpClient.SendAsync() wrapper that wires randomized cancellation public async Task SendAsync(HttpRequestMessage request, HttpCompletionOption httpCompletion = HttpCompletionOption.ResponseContentRead, CancellationToken? token = null) @@ -417,7 +418,7 @@ namespace HttpStress var expectedString = new StringBuilder(); var uriSb = new StringBuilder(uri); - maxRequestUriSize -= uri.Length; + maxRequestUriSize -= clientContext.BaseAddress.OriginalString.Length + uri.Length + 1; int appxMaxValueLength = Math.Max(maxRequestUriSize / numParameters, 1); -- 2.7.4