252 references to ContentLength
CodeGenerator (19)
src\Servers\Kestrel\shared\KnownHeaders.cs (19)
27HeaderNames.ContentLength, 105HeaderNames.ContentLength, 191Name = HeaderNames.ContentLength, 193PrimaryHeader = requestPrimaryHeaders.Contains(HeaderNames.ContentLength) 262Name = HeaderNames.ContentLength, 264EnhancedSetter = enhancedHeaders.Contains(HeaderNames.ContentLength), 265PrimaryHeader = responsePrimaryHeaders.Contains(HeaderNames.ContentLength) 378if (header.Name == HeaderNames.ContentLength) 420if (header.Name == HeaderNames.ContentLength) 870{{{(header.Name == HeaderNames.ContentLength ? $@" 906{Each(loop.Headers.Where(header => header.Name != HeaderNames.ContentLength && !NonApiHeaders.Contains(header.Identifier)), header => $@" 976{{{(header.Name == HeaderNames.ContentLength ? @" 992{{{(header.Name == HeaderNames.ContentLength ? @" 1021{{{(header.Name == HeaderNames.ContentLength ? $@" 1030{{{(header.Name == HeaderNames.ContentLength ? $@" 1052{{{(header.Name == HeaderNames.ContentLength ? $@" 1070{{{(header.Name == HeaderNames.ContentLength ? $@" 1100{{{(header.Name == HeaderNames.ContentLength ? @" 1118{{{(header.Name == HeaderNames.ContentLength ? @"
IIS.FunctionalTests (5)
Http2TrailersResetTests.cs (4)
118Assert.True(response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out var contentLength), HeaderNames.ContentLength); 136Assert.True(response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out var contentLength), HeaderNames.ContentLength);
src\Servers\IIS\IIS\test\Common.FunctionalTests\Http2Tests.cs (1)
157new KeyValuePair<string, string>(HeaderNames.ContentLength, "11"),
IISExpress.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Http2Tests.cs (1)
157new KeyValuePair<string, string>(HeaderNames.ContentLength, "11"),
InMemory.FunctionalTests (89)
Http2\Http2ConnectionTests.cs (2)
2392Assert.Equal("0", handler.Headers[HeaderNames.ContentLength]); 2409Assert.Equal("0", handler.Headers[HeaderNames.ContentLength]);
Http2\Http2StreamTests.cs (59)
113Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 132Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 181new KeyValuePair<string, string>(HeaderNames.ContentLength, "11"), 504Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 613Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 644Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 675Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 706Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 828Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 862Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 873new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 899Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 923new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 940Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 951new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 983Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 994new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1026Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 1038new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1079Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 1090new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1123new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1144new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1179new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1214new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1250new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1304new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1321Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 1359Assert.Equal("11", _decodedHeaders[HeaderNames.ContentLength]); 1398Assert.Equal("11", _decodedHeaders[HeaderNames.ContentLength]); 1432Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 1502Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 1701Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 1779Assert.Equal("11", _decodedHeaders[HeaderNames.ContentLength]); 1850Assert.Equal("11", _decodedHeaders[HeaderNames.ContentLength]); 1862new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1888Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 1903new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1935Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 1974Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 2022Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 2046new KeyValuePair<string, string>(HeaderNames.ContentLength, "18"), 2085Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 2106new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 2136Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 2267Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 2300Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 3120Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 3814Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 4281Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 4474Assert.Equal("12", _decodedHeaders[HeaderNames.ContentLength]); 4520Assert.Equal("12", _decodedHeaders[HeaderNames.ContentLength]); 4560Assert.Equal("12", _decodedHeaders[HeaderNames.ContentLength]); 4624Assert.Equal("54", _decodedHeaders[HeaderNames.ContentLength]); 4898Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 5020Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 5132Assert.Equal("0", _decodedHeaders[HeaderNames.ContentLength]); 5355Assert.Equal("25", _decodedHeaders[HeaderNames.ContentLength]); 5426Assert.Equal("25", _decodedHeaders[HeaderNames.ContentLength]);
Http2\Http2WebSocketTests.cs (1)
565Assert.Equal("2", _decodedHeaders[HeaderNames.ContentLength]);
Http3\Http3StreamTests.cs (27)
392Assert.Equal("0", responseHeaders[HeaderNames.ContentLength]); 415Assert.Equal("0", responseHeaders[HeaderNames.ContentLength]); 438Assert.Equal("0", responseHeaders[HeaderNames.ContentLength]); 461Assert.Equal("0", responseHeaders[HeaderNames.ContentLength]); 553new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 571Assert.Equal("0", responseHeaders[HeaderNames.ContentLength]); 582new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 607Assert.Equal("0", responseHeaders[HeaderNames.ContentLength]); 618new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 642Assert.Equal("0", responseHeaders[HeaderNames.ContentLength]); 686new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 1266Assert.Equal("0", decodedHeaders[HeaderNames.ContentLength]); 1363Assert.Equal("0", decodedHeaders[HeaderNames.ContentLength]); 1623Assert.Equal("25", decodedHeaders[HeaderNames.ContentLength]); 1681Assert.Equal("25", decodedHeaders[HeaderNames.ContentLength]); 2340Assert.Equal("0", receivedHeaders[HeaderNames.ContentLength]); 2398Assert.Equal("0", receivedHeaders[HeaderNames.ContentLength]); 2503new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 2522Assert.Equal("0", receivedHeaders[HeaderNames.ContentLength]); 2537new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 2563Assert.Equal("0", receivedHeaders[HeaderNames.ContentLength]); 2595Assert.Equal("0", receivedHeaders[HeaderNames.ContentLength]); 2635Assert.Equal("0", receivedHeaders[HeaderNames.ContentLength]); 2659new KeyValuePair<string, string>(HeaderNames.ContentLength, "18"), 2690Assert.Equal("0", receivedHeaders[HeaderNames.ContentLength]); 2711new KeyValuePair<string, string>(HeaderNames.ContentLength, "12"), 2734Assert.Equal("0", receivedHeaders[HeaderNames.ContentLength]);
Microsoft.AspNetCore.Http (3)
HeaderDictionary.cs (3)
124var rawValue = this[HeaderNames.ContentLength]; 139this[HeaderNames.ContentLength] = HeaderUtilities.FormatNonNegativeInt64(value.GetValueOrDefault()); 143this.Remove(HeaderNames.ContentLength);
Microsoft.AspNetCore.HttpLogging (2)
HttpLoggingOptions.cs (2)
42HeaderNames.ContentLength, 80HeaderNames.ContentLength,
Microsoft.AspNetCore.OutputCaching (2)
OutputCacheEntryFormatter.cs (2)
420HeaderNames.ContentLength, 502HeaderNames.RequestId, HeaderNames.ContentLength, HeaderNames.Age
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (1)
EndToEndBenchmarks.cs (1)
223if (header.Key == HeaderNames.ContentLength || header.Key == HeaderNames.RequestId)
Microsoft.AspNetCore.Owin (3)
DictionaryStringValuesWrapper.cs (3)
50if (!Inner.TryGetValue(HeaderNames.ContentLength, out rawValue)) 68Inner[HeaderNames.ContentLength] = (StringValues)HeaderUtilities.FormatNonNegativeInt64(value.GetValueOrDefault()); 72Inner.Remove(HeaderNames.ContentLength);
Microsoft.AspNetCore.Rewrite (1)
IISUrlRewrite\ServerVariables.cs (1)
34managedVariableThunk = () => new HeaderSegment(HeaderNames.ContentLength);
Microsoft.AspNetCore.Server.HttpSys (19)
RequestProcessing\Request.cs (2)
221string? length = Headers[HeaderNames.ContentLength]; 520headerDictionary.Add("X-Content-Length", headerDictionary[HeaderNames.ContentLength]);
RequestProcessing\Response.cs (1)
443Headers[HeaderNames.ContentLength] = Constants.Zero;
src\Shared\HttpSys\NativeInterop\HttpApiTypes.cs (1)
35HeaderNames.ContentLength,
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (5)
22HeaderNames.TransferEncoding, HeaderNames.ContentLength, 123var rawValue = this[HeaderNames.ContentLength]; 143ValidateRestrictedTrailers(HeaderNames.ContentLength); 153this[HeaderNames.ContentLength] = _contentLengthText; 158Remove(HeaderNames.ContentLength);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (3)
179var rawValue = this[HeaderNames.ContentLength]; 208this[HeaderNames.ContentLength] = _contentLengthText; 213Remove(HeaderNames.ContentLength);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.Generated.cs (7)
1199if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 1436if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 1684if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 2086if (string.Equals(key, HeaderNames.ContentLength, StringComparison.Ordinal)) 2243yield return HeaderNames.ContentLength; 2579yield return new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, ContentLength); 2760HttpSysRequestHeader.ContentLength => HeaderNames.ContentLength,
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (16)
Http2Tests.cs (1)
188new KeyValuePair<string, string>(HeaderNames.ContentLength, "11"),
RequestBodyTests.cs (8)
261httpContext.Request.Headers[HeaderNames.ContentLength] = "123"; 262CheckHeadersCount(HeaderNames.ContentLength, 1, httpContext.Request); 264httpContext.Request.Headers[HeaderNames.ContentLength] = "456"; 265CheckHeadersCount(HeaderNames.ContentLength, 1, httpContext.Request); 267httpContext.Request.Headers[HeaderNames.ContentLength] = StringValues.Empty; 268CheckHeadersCount(HeaderNames.ContentLength, 0, httpContext.Request); 270Assert.Equal("", httpContext.Request.Headers[HeaderNames.ContentLength].ToString()); 272CheckHeadersCount(HeaderNames.ContentLength, 1, httpContext.Request);
ResponseTrailersTests.cs (7)
140Assert.Equal(body.Length.ToString(CultureInfo.InvariantCulture), response.Content.Headers.GetValues(HeaderNames.ContentLength).Single()); 164Assert.True(response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out var contentLength), HeaderNames.ContentLength); 189Assert.True(response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out var contentLength), HeaderNames.ContentLength); 215Assert.True(response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out var contentLength), HeaderNames.ContentLength);
Microsoft.AspNetCore.Server.IIS (17)
Core\IISHttpContext.cs (1)
385RequestHeaders.Add("X-Content-Length", RequestHeaders[HeaderNames.ContentLength]);
src\Shared\HttpSys\NativeInterop\HttpApiTypes.cs (1)
35HeaderNames.ContentLength,
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (5)
22HeaderNames.TransferEncoding, HeaderNames.ContentLength, 123var rawValue = this[HeaderNames.ContentLength]; 143ValidateRestrictedTrailers(HeaderNames.ContentLength); 153this[HeaderNames.ContentLength] = _contentLengthText; 158Remove(HeaderNames.ContentLength);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (3)
179var rawValue = this[HeaderNames.ContentLength]; 208this[HeaderNames.ContentLength] = _contentLengthText; 213Remove(HeaderNames.ContentLength);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.Generated.cs (7)
1199if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 1436if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 1684if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 2086if (string.Equals(key, HeaderNames.ContentLength, StringComparison.Ordinal)) 2243yield return HeaderNames.ContentLength; 2579yield return new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, ContentLength); 2760HttpSysRequestHeader.ContentLength => HeaderNames.ContentLength,
Microsoft.AspNetCore.Server.Kestrel.Core (29)
Internal\Http\Http1MessageBody.cs (1)
185headerDictionary.Add("X-Content-Length", headerDictionary[HeaderNames.ContentLength]);
Internal\Http\HttpHeaders.Generated.cs (25)
307HeaderNames.ContentLength, 3331if (ReferenceEquals(HeaderNames.ContentLength, key)) 3350if (HeaderNames.ContentLength.Equals(key, StringComparison.OrdinalIgnoreCase)) 4115if (ReferenceEquals(HeaderNames.ContentLength, key)) 4127if (HeaderNames.ContentLength.Equals(key, StringComparison.OrdinalIgnoreCase)) 5122if (ReferenceEquals(HeaderNames.ContentLength, key)) 5142if (HeaderNames.ContentLength.Equals(key, StringComparison.OrdinalIgnoreCase)) 6229if (ReferenceEquals(HeaderNames.ContentLength, key)) 6249if (HeaderNames.ContentLength.Equals(key, StringComparison.OrdinalIgnoreCase)) 7469array[arrayIndex] = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); 7782? null : EncodingSelector(HeaderNames.ContentLength); 7991? null : EncodingSelector(HeaderNames.ContentLength); 8160? null : EncodingSelector(HeaderNames.ContentLength); 8649_current = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.GetValueOrDefault())); 11382if (ReferenceEquals(HeaderNames.ContentLength, key)) 11392if (HeaderNames.ContentLength.Equals(key, StringComparison.OrdinalIgnoreCase)) 12047if (ReferenceEquals(HeaderNames.ContentLength, key)) 12053if (HeaderNames.ContentLength.Equals(key, StringComparison.OrdinalIgnoreCase)) 12828if (ReferenceEquals(HeaderNames.ContentLength, key)) 12838if (HeaderNames.ContentLength.Equals(key, StringComparison.OrdinalIgnoreCase)) 13720if (ReferenceEquals(HeaderNames.ContentLength, key)) 13730if (HeaderNames.ContentLength.Equals(key, StringComparison.OrdinalIgnoreCase)) 14796array[arrayIndex] = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value)); 15482_current = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_collection._contentLength.GetValueOrDefault())); 17564array[arrayIndex] = new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, HeaderUtilities.FormatNonNegativeInt64(_contentLength.Value));
Internal\Http\HttpProtocol.cs (1)
1183RejectInvalidHeaderForNonBodyResponse(appCompleted, HeaderNames.ContentLength);
Internal\Http\HttpRequestHeaders.cs (2)
105KestrelBadHttpRequestException.Throw(RequestRejectionReason.InvalidContentLength, value.GetRequestHeaderString(HeaderNames.ContentLength, EncodingSelector, checkForNewlineChars: false)); 129KestrelBadHttpRequestException.Throw(RequestRejectionReason.InvalidContentLength, value.GetRequestHeaderString(HeaderNames.ContentLength, EncodingSelector, checkForNewlineChars: false));
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (22)
Http1\Http1ConnectionTests.cs (2)
1026_http1Connection.RequestHeaders.Add(HeaderNames.ContentLength, contentLength); 1037Assert.False(_http1Connection.RequestHeaders.ContainsKey(HeaderNames.ContentLength));
HttpRequestHeadersTests.cs (1)
699var contentLengthNameBytes = Encoding.ASCII.GetBytes(HeaderNames.ContentLength);
src\Servers\Kestrel\shared\KnownHeaders.cs (19)
27HeaderNames.ContentLength, 105HeaderNames.ContentLength, 191Name = HeaderNames.ContentLength, 193PrimaryHeader = requestPrimaryHeaders.Contains(HeaderNames.ContentLength) 262Name = HeaderNames.ContentLength, 264EnhancedSetter = enhancedHeaders.Contains(HeaderNames.ContentLength), 265PrimaryHeader = responsePrimaryHeaders.Contains(HeaderNames.ContentLength) 378if (header.Name == HeaderNames.ContentLength) 420if (header.Name == HeaderNames.ContentLength) 870{{{(header.Name == HeaderNames.ContentLength ? $@" 906{Each(loop.Headers.Where(header => header.Name != HeaderNames.ContentLength && !NonApiHeaders.Contains(header.Identifier)), header => $@" 976{{{(header.Name == HeaderNames.ContentLength ? @" 992{{{(header.Name == HeaderNames.ContentLength ? @" 1021{{{(header.Name == HeaderNames.ContentLength ? $@" 1030{{{(header.Name == HeaderNames.ContentLength ? $@" 1052{{{(header.Name == HeaderNames.ContentLength ? $@" 1070{{{(header.Name == HeaderNames.ContentLength ? $@" 1100{{{(header.Name == HeaderNames.ContentLength ? @" 1118{{{(header.Name == HeaderNames.ContentLength ? @"
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (3)
HeaderCollectionBenchmark.cs (2)
110_response.Headers[HeaderNames.ContentLength] = "0"; 227value = _response.Headers[HeaderNames.ContentLength];
ResponseHeaderCollectionBenchmark.cs (1)
88_response.Headers[HeaderNames.ContentLength] = "0";
Microsoft.AspNetCore.Shared.Tests (16)
src\Shared\HttpSys\NativeInterop\HttpApiTypes.cs (1)
35HeaderNames.ContentLength,
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (5)
22HeaderNames.TransferEncoding, HeaderNames.ContentLength, 123var rawValue = this[HeaderNames.ContentLength]; 143ValidateRestrictedTrailers(HeaderNames.ContentLength); 153this[HeaderNames.ContentLength] = _contentLengthText; 158Remove(HeaderNames.ContentLength);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (3)
179var rawValue = this[HeaderNames.ContentLength]; 208this[HeaderNames.ContentLength] = _contentLengthText; 213Remove(HeaderNames.ContentLength);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.Generated.cs (7)
1199if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 1436if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 1684if (string.Equals(key, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase)) 2086if (string.Equals(key, HeaderNames.ContentLength, StringComparison.Ordinal)) 2243yield return HeaderNames.ContentLength; 2579yield return new KeyValuePair<string, StringValues>(HeaderNames.ContentLength, ContentLength); 2760HttpSysRequestHeader.ContentLength => HeaderNames.ContentLength,
Microsoft.AspNetCore.StaticAssets (1)
Development\StaticAssetDescriptorExtensions.cs (1)
16if (string.Equals(header.Name, HeaderNames.ContentLength, StringComparison.OrdinalIgnoreCase))
Microsoft.AspNetCore.TestHost (1)
ClientHandler.cs (1)
142requestContent.Headers.Remove(HeaderNames.ContentLength);
ServerComparison.FunctionalTests (2)
ResponseCompressionTests.cs (1)
221return response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out var values) ? values.FirstOrDefault() : null;
ResponseTests.cs (1)
270return response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out values) ? values.FirstOrDefault() : null;