4 writes to ContentLength
Microsoft.Extensions.Http.Diagnostics.Tests (2)
Logging\HttpHeadersReaderTest.cs (2)
133requestContent.Headers.ContentLength = 42; 142responseContent.Headers.ContentLength = 24;
System.Net.Http (2)
System\Net\Http\SocketsHttpHandler\DecompressionHandler.cs (1)
122Headers.ContentLength = null;
System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs (1)
649request.Content.Headers.ContentLength = null;
117 references to ContentLength
dotnet-svcutil-lib (11)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpRequestMessageProperty.cs (3)
324long? contentLength = content.Headers.ContentLength; 340(!content.Headers.ContentLength.HasValue || 341content.Headers.ContentLength.Value > 0))
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageHelper.cs (5)
134_contentLength = content.Headers.ContentLength.HasValue ? content.Headers.ContentLength.Value : -1; 175if (!content.Headers.ContentLength.HasValue) 297_contentLength = content.Headers.ContentLength.HasValue ? content.Headers.ContentLength.Value : -1;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageProperty.cs (3)
348long? contentLength = content.Headers.ContentLength; 364(!content.Headers.ContentLength.HasValue || 365content.Headers.ContentLength.Value > 0))
HttpStress (2)
Program.cs (2)
329if (m.Content.Headers.ContentLength != maxContentLength) 331throw new Exception($"Expected {maxContentLength}, got {m.Content.Headers.ContentLength}");
InMemory.FunctionalTests (1)
TestTransport\InMemoryHttpClientSlim.cs (1)
81await writer.WriteAsync($"Content-Length: {content.Headers.ContentLength}\r\n").ConfigureAwait(false);
Microsoft.AspNetCore.Http.Connections.Client (1)
Internal\LongPollingTransport.Log.cs (1)
49response.Content.Headers.ContentLength ?? -1);
Microsoft.AspNetCore.Identity.FunctionalTests (3)
MapIdentityApiTests.cs (3)
1431Assert.Equal(0, response.Content.Headers.ContentLength); 1437Assert.Equal(0, response.Content.Headers.ContentLength); 1443Assert.Equal(0, response.Content.Headers.ContentLength);
Microsoft.AspNetCore.InternalTesting (1)
HttpClientSlim.cs (1)
83await writer.WriteAsync($"Content-Length: {content.Headers.ContentLength}\r\n").ConfigureAwait(false);
Microsoft.AspNetCore.Mvc.FunctionalTests (21)
BasicTests.cs (3)
153Assert.Equal(0, response.Content.Headers.ContentLength); 196Assert.Equal(0, response.Content.Headers.ContentLength); 212Assert.Equal(0, response.Content.Headers.ContentLength);
FileResultTests.cs (9)
111Assert.Equal(0, response.Content.Headers.ContentLength); 175Assert.Equal(0, response.Content.Headers.ContentLength); 296var contentLength = response.Content.Headers.ContentLength; 399Assert.Equal(0, response.Content.Headers.ContentLength); 515var contentLength = response.Content.Headers.ContentLength; 603Assert.Equal(0, response.Content.Headers.ContentLength); 721var contentLength = response.Content.Headers.ContentLength; 883Assert.Equal(0, response.Content.Headers.ContentLength); 925var contentLength = response.Content.Headers.ContentLength;
InputFormatterTests.cs (4)
228Assert.Equal(0, content.Headers.ContentLength); 273Assert.Equal(0, content.Headers.ContentLength); 288Assert.Equal(0, content.Headers.ContentLength); 303Assert.Equal(0, content.Headers.ContentLength);
NewtonsoftJsonOutputFormatterTest.cs (1)
47Assert.Equal(50, response.Content.Headers.ContentLength);
OutputFormatterTest.cs (2)
80Assert.Equal(0, response.Content.Headers.ContentLength); 98Assert.Equal(0, response.Content.Headers.ContentLength);
XmlOutputFormatterTests.cs (2)
55Assert.Equal(167, response.Content.Headers.ContentLength); 76Assert.Equal(149, response.Content.Headers.ContentLength);
Microsoft.AspNetCore.OutputCaching.Tests (1)
OutputCacheTests.cs (1)
1004var len = resp.Content.Headers.ContentLength;
Microsoft.AspNetCore.ResponseCompression.Tests (3)
ResponseCompressionMiddlewareTest.cs (3)
426Assert.Equal(50, response.Content.Headers.ContentLength); 1303Assert.Equal(expectedBodyLength, response.Content.Headers.ContentLength); 1327Assert.Equal(expectedBodyLength, response.Content.Headers.ContentLength);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (9)
Listener\ResponseHeaderTests.cs (3)
45Assert.Equal(0, response.Content.Headers.ContentLength); 68Assert.Equal(0, response.Content.Headers.ContentLength); 148Assert.Equal(20, response.Content.Headers.ContentLength);
OpaqueUpgradeTests.cs (2)
42Assert.Equal(0, response.Content.Headers.ContentLength); 70Assert.Equal(0, response.Content.Headers.ContentLength);
ResponseBodyTests.cs (1)
64Assert.Equal(0, response.Content.Headers.ContentLength);
ResponseCachingTests.cs (2)
477Assert.Equal(10, response.Content.Headers.ContentLength); 490Assert.Equal(_fileLength, response.Content.Headers.ContentLength);
ResponseHeaderTests.cs (1)
36Assert.Equal(0, response.Content.Headers.ContentLength);
Microsoft.AspNetCore.StaticAssets.Tests (6)
StaticAssetsIntegrationTests.cs (6)
65Assert.Equal(13, response.Content.Headers.ContentLength); 115Assert.Equal(13, response.Content.Headers.ContentLength); 167Assert.Equal(13, response.Content.Headers.ContentLength); 336Assert.Equal(13, response.Content.Headers.ContentLength); 389Assert.Equal(22, response.Content.Headers.ContentLength); 445Assert.Equal(55, response.Content.Headers.ContentLength);
Microsoft.AspNetCore.StaticFiles.FunctionalTests (3)
StaticFileMiddlewareTests.cs (3)
164Assert.True(response.Content.Headers.ContentLength == fileInfo.Length); 165Assert.Equal(response.Content.Headers.ContentLength, responseContent.Length); 206Assert.True(response.Content.Headers.ContentLength == fileInfo.Length);
Microsoft.AspNetCore.StaticFiles.Tests (35)
DirectoryBrowserMiddlewareTests.cs (5)
172Assert.True(response.Content.Headers.ContentLength > 0); 173Assert.Equal(response.Content.Headers.ContentLength, (await response.Content.ReadAsByteArrayAsync()).Length); 229Assert.True(response.Content.Headers.ContentLength > 0); 230Assert.Equal(response.Content.Headers.ContentLength, (await response.Content.ReadAsByteArrayAsync()).Length); 372Assert.Null(response.Content.Headers.ContentLength);
RangeHeaderTests.cs (19)
29Assert.Equal(11, resp.Content.Headers.ContentLength); 52Assert.Equal(62, resp.Content.Headers.ContentLength); 71Assert.Equal(11, resp.Content.Headers.ContentLength); 88Assert.Equal(11, resp.Content.Headers.ContentLength); 124Assert.Equal(62, resp.Content.Headers.ContentLength); 141Assert.Equal(62, resp.Content.Headers.ContentLength); 158Assert.Equal(62, resp.Content.Headers.ContentLength); 177Assert.Equal(62, resp.Content.Headers.ContentLength); 196Assert.Equal(62, resp.Content.Headers.ContentLength); 215Assert.Equal(62, resp.Content.Headers.ContentLength); 223Assert.Equal(62, resp.Content.Headers.ContentLength); 242Assert.Equal(62, resp.Content.Headers.ContentLength); 250Assert.Equal(62, resp.Content.Headers.ContentLength); 276Assert.Equal(length, resp.Content.Headers.ContentLength); 297Assert.Equal(length, resp.Content.Headers.ContentLength); 331Assert.Equal(62, resp.Content.Headers.ContentLength); 384Assert.Equal(62, resp.Content.Headers.ContentLength); 406Assert.Equal(62, resp.Content.Headers.ContentLength); 428Assert.Equal(62, resp.Content.Headers.ContentLength);
StaticFileMiddlewareTests.cs (11)
191Assert.True(response.Content.Headers.ContentLength == fileInfo.Length); 192Assert.Equal(response.Content.Headers.ContentLength, responseContent.Length); 230Assert.True(response.Content.Headers.ContentLength == fileInfo.Length); 231Assert.Equal(response.Content.Headers.ContentLength, responseContent.Length); 272Assert.True(response.Content.Headers.ContentLength == fileInfo.Length); 273Assert.Equal(response.Content.Headers.ContentLength, responseContent.Length); 322Assert.True(response.Content.Headers.ContentLength == fileInfo.Length); 323Assert.Equal(response.Content.Headers.ContentLength, responseContent.Length); 365Assert.True(response.Content.Headers.ContentLength == fileInfo.Length); 366Assert.Equal(response.Content.Headers.ContentLength, responseContent.Length); 483Assert.True(response.Content.Headers.ContentLength == fileInfo.Length);
Microsoft.AspNetCore.TestHost (1)
ClientHandler.cs (1)
127var contentLength = requestContent.Headers.ContentLength;
Microsoft.Build.Tasks.Core (3)
DownloadFile.cs (3)
193Log.LogErrorFromResources("DownloadFile.Downloading", SourceUrl, destinationFile.FullName, response.Content.Headers.ContentLength); 203Log.LogMessageFromResources(MessageImportance.High, "DownloadFile.Downloading", SourceUrl, destinationFile.FullName, response.Content.Headers.ContentLength); 353&& destinationFile.Length == response.Content.Headers.ContentLength
Microsoft.ML.PerformanceTests (1)
ImageClassificationBench.cs (1)
164var totalSizeInBytes = headerResponse.Content.Headers.ContentLength;
System.Net.Http (13)
System\Net\Http\HttpClient.cs (2)
203using var buffer = new HttpContent.LimitArrayPoolWriteStream(_maxResponseContentBufferSize, (int)c.Headers.ContentLength.GetValueOrDefault()); 282long? contentLength = c.Headers.ContentLength;
System\Net\Http\HttpContent.cs (1)
657long? contentLength = Headers.ContentLength;
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (1)
210using var writeStream = new Http2WriteStream(this, _request.Content.Headers.ContentLength.GetValueOrDefault(-1));
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (3)
240bool useEmptyResponseContent = responseContent.Headers.ContentLength == 0 && sendContentObserved; 444_requestContentLengthRemaining = content.Headers.ContentLength ?? -1; 456long contentLength = content.Headers.ContentLength.GetValueOrDefault();
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (5)
727(request.Content.Headers.ContentLength == null || request.Content.Headers.ContentLength.GetValueOrDefault() > Expect100ErrorSendThreshold) && 813else if (response.Content.Headers.ContentLength != null) 815long contentLength = response.Content.Headers.ContentLength.GetValueOrDefault(); 948new ContentLengthWriteStream(this, request.Content.Headers.ContentLength.GetValueOrDefault());
System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs (1)
651else if (request.Content != null && request.Content.Headers.ContentLength == null)
System.Net.Http.Json (1)
System\Net\Http\Json\HttpClientJsonExtensions.cs (1)
124if (response.Content.Headers.ContentLength is long contentLength && contentLength > contentLengthLimit)
System.Net.Requests (1)
System\Net\HttpWebResponse.cs (1)
86return _httpResponseMessage.Content?.Headers.ContentLength ?? -1;