Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Commit

Permalink
Add doc comments for FormOptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Apr 28, 2016
1 parent 3a7f6a7 commit 291b530
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/Microsoft.AspNetCore.Http/Features/FormOptions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.IO;
using Microsoft.AspNetCore.WebUtilities;

namespace Microsoft.AspNetCore.Http.Features
Expand All @@ -12,15 +13,65 @@ public class FormOptions
public const int DefaultMultipartBoundaryLengthLimit = 128;
public const long DefaultMultipartBodyLengthLimit = 1024 * 1024 * 128;

/// <summary>
/// Enables full request body buffering. Use this if multiple components need to read the raw stream.
/// The default value is false.
/// </summary>
public bool BufferBody { get; set; } = false;

/// <summary>
/// If <see cref="BufferBody"/> is enabled, this many bytes of the body will be buffered in memory.
/// If this limit is exceeded then the buffer will be moved to a temp file on disk instead.
/// This also applies when buffering individual multipart section bodies.
/// </summary>
public int MemoryBufferThreshold { get; set; } = DefaultMemoryBufferThreshold;

/// <summary>
/// If <see cref="BufferBody"/> is enabled, this is the limit for the total number of bytes that will
/// be buffered. Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public long BufferBodyLengthLimit { get; set; } = DefaultBufferBodyLengthLimit;

/// <summary>
/// A limit for the number of form entries to allow. Entries with the same key will be combine.
/// Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int KeyCountLimit { get; set; } = FormReader.DefaultKeyCountLimit;

/// <summary>
/// A limit on the length of individual keys. Forms that exceed this limit will throw an
/// <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int KeyLengthLimit { get; set; } = FormReader.DefaultKeyLengthLimit;

/// <summary>
/// A limit on the length of individual form values. Forms that exceed this limit will throw
/// an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int ValueLengthLimit { get; set; } = FormReader.DefaultValueLengthLimit;

/// <summary>
/// A limit for the length of the boundary identifier. Forms that exceed this limit will throw
/// an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int MultipartBoundaryLengthLimit { get; set; } = DefaultMultipartBoundaryLengthLimit;

/// <summary>
/// A limit for the number of headers to allow in each multipart section. Headers with the same name will
/// be combine. Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int MultipartHeadersCountLimit { get; set; } = MultipartReader.DefaultHeadersCountLimit;

/// <summary>
/// A limit for the total length of the header keys and values in each multipart section.
/// Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int MultipartHeadersLengthLimit { get; set; } = MultipartReader.DefaultHeadersLengthLimit;

/// <summary>
/// A limit for the length of each multipart body. Forms that exceed this limit will throw an
/// <see cref="InvalidDataException"/> when parsed.
/// </summary>
public long MultipartBodyLengthLimit { get; set; } = DefaultMultipartBodyLengthLimit;
}
}

0 comments on commit 291b530

Please sign in to comment.