From: Eirik Tsarpalis Date: Fri, 26 Jul 2019 20:40:48 +0000 (+0100) Subject: take HttpClient.BaseAddress into account when bounding request uri sizes X-Git-Tag: submit/tizen/20210909.063632~11031^2~830^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=563726e051764d454ef3f507c36a407b676f1cef;p=platform%2Fupstream%2Fdotnet%2Fruntime.git take HttpClient.BaseAddress into account when bounding request uri sizes Commit migrated from https://github.com/dotnet/corefx/commit/d5a0fb96a026447dcf201dc7c19b0b8d41be60f5 --- 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);