Implemented interface member:
property
ContentLength
Microsoft.AspNetCore.Http.IHeaderDictionary.ContentLength
11 writes to ContentLength
Microsoft.AspNetCore.Server.Kestrel.Core (4)
Internal\Http\Http1MessageBody.cs (1)
186headers.ContentLength = null;
Internal\Http\HttpProtocol.cs (3)
1185responseHeaders.ContentLength = null; 1211responseHeaders.ContentLength = 0; 1368responseHeaders.ContentLength = 0;
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (7)
HttpHeadersTests.cs (5)
260httpHeaders.ContentLength = 1; 266httpHeaders.ContentLength = long.MaxValue; 272httpHeaders.ContentLength = null; 295Assert.Throws<ArgumentOutOfRangeException>(() => httpHeaders.ContentLength = -1); 296Assert.Throws<ArgumentOutOfRangeException>(() => httpHeaders.ContentLength = long.MinValue);
HttpResponseHeadersTests.cs (1)
276Assert.Throws<InvalidOperationException>(() => headers.ContentLength = null);
MessageBodyTests.cs (1)
685var body = Http1MessageBody.For(HttpVersion.Http11, new HttpRequestHeaders { HeaderConnection = headerConnection, ContentLength = 0 }, input.Http1Connection);
40 references to ContentLength
Microsoft.AspNetCore.Server.Kestrel.Core (22)
Internal\Http\Http1MessageBody.cs (4)
146&& headers.ContentLength.GetValueOrDefault() == 0 182if (headers.ContentLength.HasValue) 194if (headers.ContentLength.HasValue) 196var contentLength = headers.ContentLength.Value;
Internal\Http\HttpHeaders.Generated.cs (1)
14819output.WriteNumeric((ulong)ContentLength.GetValueOrDefault());
Internal\Http\HttpProtocol.cs (12)
873responseHeaders.ContentLength.HasValue && 874_responseBytesWritten + count > responseHeaders.ContentLength.Value) 894CoreStrings.FormatTooManyBytesWritten(_responseBytesWritten + count, responseHeaders.ContentLength!.Value)); 908responseHeaders.ContentLength.HasValue && 909_responseBytesWritten == responseHeaders.ContentLength.Value) 922responseHeaders.ContentLength.HasValue && 923_responseBytesWritten < responseHeaders.ContentLength.Value) 933CoreStrings.FormatTooFewBytesWritten(_responseBytesWritten, responseHeaders.ContentLength.Value)); 1176else if (responseHeaders.ContentLength.HasValue) 1180if (responseHeaders.ContentLength.Value == 0) 1192else if (StatusCode == StatusCodes.Status205ResetContent && responseHeaders.ContentLength.Value != 0) 1204else if (!hasTransferEncoding && !responseHeaders.ContentLength.HasValue)
Internal\Http\HttpRequestHeaders.cs (2)
246_next = GetNext(_currentBits, collection.ContentLength.HasValue); 265_next = GetNext(_currentBits, _collection.ContentLength.HasValue);
Internal\Http\HttpResponseHeaders.cs (2)
154_next = GetNext(_currentBits, collection.ContentLength.HasValue); 176_next = GetNext(_currentBits, _collection.ContentLength.HasValue);
Internal\Http3\Http3Stream.cs (1)
838InputRemaining = HttpRequestHeaders.ContentLength;
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (18)
HttpHeadersTests.cs (12)
257Assert.Null(httpHeaders.ContentLength); 258Assert.False(httpHeaders.ContentLength.HasValue); 263Assert.Equal(1, httpHeaders.ContentLength); 264Assert.True(httpHeaders.ContentLength.HasValue); 269Assert.Equal(long.MaxValue, httpHeaders.ContentLength); 270Assert.True(httpHeaders.ContentLength.HasValue); 274Assert.Null(httpHeaders.ContentLength); 275Assert.False(httpHeaders.ContentLength.HasValue); 292Assert.Null(httpHeaders.ContentLength); 293Assert.False(httpHeaders.ContentLength.HasValue); 299Assert.Null(httpHeaders.ContentLength); 300Assert.False(httpHeaders.ContentLength.HasValue);
HttpRequestHeadersTests.cs (1)
707Assert.Equal(1337, headers.ContentLength);
HttpResponseHeadersTests.cs (5)
352Assert.Equal(ParseLong(contentLength), headers.ContentLength); 363Assert.Equal(ParseLong(contentLength), headers.ContentLength); 373Assert.Equal(ParseLong(contentLength), headers.ContentLength); 385Assert.Null(headers.ContentLength); 397Assert.Null(headers.ContentLength);