1
1
// Copyright (c) .NET Foundation. All rights reserved.
2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
+ using System . IO ;
4
5
using Microsoft . AspNetCore . WebUtilities ;
5
6
6
7
namespace Microsoft . AspNetCore . Http . Features
@@ -12,15 +13,65 @@ public class FormOptions
12
13
public const int DefaultMultipartBoundaryLengthLimit = 128 ;
13
14
public const long DefaultMultipartBodyLengthLimit = 1024 * 1024 * 128 ;
14
15
16
+ /// <summary>
17
+ /// Enables full request body buffering. Use this if multiple components need to read the raw stream.
18
+ /// The default value is false.
19
+ /// </summary>
15
20
public bool BufferBody { get ; set ; } = false ;
21
+
22
+ /// <summary>
23
+ /// If <see cref="BufferBody"/> is enabled, this many bytes of the body will be buffered in memory.
24
+ /// If this limit is exceeded then the buffer will be moved to a temp file on disk instead.
25
+ /// This also applies when buffering individual multipart section bodies.
26
+ /// </summary>
16
27
public int MemoryBufferThreshold { get ; set ; } = DefaultMemoryBufferThreshold ;
28
+
29
+ /// <summary>
30
+ /// If <see cref="BufferBody"/> is enabled, this is the limit for the total number of bytes that will
31
+ /// be buffered. Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
32
+ /// </summary>
17
33
public long BufferBodyLengthLimit { get ; set ; } = DefaultBufferBodyLengthLimit ;
34
+
35
+ /// <summary>
36
+ /// A limit for the number of form entries to allow. Entries with the same key will be combine.
37
+ /// Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
38
+ /// </summary>
18
39
public int KeyCountLimit { get ; set ; } = FormReader . DefaultKeyCountLimit ;
40
+
41
+ /// <summary>
42
+ /// A limit on the length of individual keys. Forms that exceed this limit will throw an
43
+ /// <see cref="InvalidDataException"/> when parsed.
44
+ /// </summary>
19
45
public int KeyLengthLimit { get ; set ; } = FormReader . DefaultKeyLengthLimit ;
46
+
47
+ /// <summary>
48
+ /// A limit on the length of individual form values. Forms that exceed this limit will throw
49
+ /// an <see cref="InvalidDataException"/> when parsed.
50
+ /// </summary>
20
51
public int ValueLengthLimit { get ; set ; } = FormReader . DefaultValueLengthLimit ;
52
+
53
+ /// <summary>
54
+ /// A limit for the length of the boundary identifier. Forms that exceed this limit will throw
55
+ /// an <see cref="InvalidDataException"/> when parsed.
56
+ /// </summary>
21
57
public int MultipartBoundaryLengthLimit { get ; set ; } = DefaultMultipartBoundaryLengthLimit ;
58
+
59
+ /// <summary>
60
+ /// A limit for the number of headers to allow in each multipart section. Headers with the same name will
61
+ /// be combine. Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
62
+ /// </summary>
22
63
public int MultipartHeadersCountLimit { get ; set ; } = MultipartReader . DefaultHeadersCountLimit ;
64
+
65
+ /// <summary>
66
+ /// A limit for the total length of the header keys and values in each multipart section.
67
+ /// Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
68
+ /// </summary>
23
69
public int MultipartHeadersLengthLimit { get ; set ; } = MultipartReader . DefaultHeadersLengthLimit ;
70
+
71
+ /// <summary>
72
+ /// A limit for the length of each multipart body. Forms that exceed this limit will throw an
73
+ /// <see cref="InvalidDataException"/> when parsed.
74
+ /// </summary>
24
75
public long MultipartBodyLengthLimit { get ; set ; } = DefaultMultipartBodyLengthLimit ;
25
76
}
26
77
}
0 commit comments