Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added property and failing test

  • Loading branch information...
commit 90af77b65ce46a840e551c1b6e35029ef2e032b6 1 parent 3f38b72
@grumpydev grumpydev authored
View
14 src/Nancy.Tests/Unit/HttpMultipartFixture.cs
@@ -163,6 +163,20 @@ public void If_the_stream_ends_with_carriage_return_characters_it_should_not_aff
actual.ShouldEqual(expected);
}
+ [Fact]
+ public void Should_limit_the_number_of_boundaries()
+ {
+ // Given
+ var stream = BuildInputStream(null, StaticConfiguration.MultipartLimit + 10);
+ var multipart = new HttpMultipart(stream, Boundary);
+
+ // When
+ var boundaries = multipart.GetBoundaries();
+
+ // Then
+ boundaries.Count().ShouldEqual(StaticConfiguration.MultipartLimit);
+ }
+
//
private static HttpMultipartSubStream BuildInputStream(string padding, int numberOfBoundaries)
{
View
6 src/Nancy/StaticConfiguration.cs
@@ -17,6 +17,7 @@ static StaticConfiguration()
{
disableErrorTraces = !(disableCaches = IsRunningDebug);
CaseSensitive = false;
+ MultipartLimit = 1000;
}
/// <summary>
@@ -70,6 +71,11 @@ public static bool IsRunningDebug
}
}
+ /// <summary>
+ /// Gets or sets the limit on the number of multipart sections in a request
+ /// </summary>
+ public static int MultipartLimit { get; set; }
+
private static bool GetDebugMode()
{
try
Please sign in to comment.
Something went wrong with that request. Please try again.