Skip to content

Commit 74e0e40

Browse files
authored
Disable ThrowForPartialCookies by default for ChunkingCookieManager and SystemWebChunkingCookieManager (#488)
1 parent 6707c18 commit 74e0e40

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/Microsoft.Owin.Host.SystemWeb/SystemWebChunkingCookieManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public class SystemWebChunkingCookieManager : ICookieManager
2121
public SystemWebChunkingCookieManager()
2222
{
2323
ChunkSize = 4090;
24-
ThrowForPartialCookies = true;
2524
Fallback = new ChunkingCookieManager();
2625
}
2726

@@ -42,6 +41,11 @@ public SystemWebChunkingCookieManager()
4241
/// <summary>
4342
/// Throw if not all chunks of a cookie are available on a request for re-assembly.
4443
/// </summary>
44+
/// <remarks>
45+
/// By default, this property is set to <see langword="false"/>. In this case,
46+
/// <see cref="GetRequestCookie(IOwinContext, string)"/> returns "chunks:[number of chunks]"
47+
/// instead of causing a <see cref="FormatException"/> if one of the chunks is missing.
48+
/// </remarks>
4549
public bool ThrowForPartialCookies { get; set; }
4650

4751
// Parse the "chunks:XX" to determine how many chunks there should be.

src/Microsoft.Owin/Infrastructure/ChunkingCookieManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public class ChunkingCookieManager : ICookieManager
2121
public ChunkingCookieManager()
2222
{
2323
ChunkSize = 4090;
24-
ThrowForPartialCookies = true;
2524
}
2625

2726
/// <summary>
@@ -36,6 +35,11 @@ public ChunkingCookieManager()
3635
/// <summary>
3736
/// Throw if not all chunks of a cookie are available on a request for re-assembly.
3837
/// </summary>
38+
/// <remarks>
39+
/// By default, this property is set to <see langword="false"/>. In this case,
40+
/// <see cref="GetRequestCookie(IOwinContext, string)"/> returns "chunks:[number of chunks]"
41+
/// instead of causing a <see cref="FormatException"/> if one of the chunks is missing.
42+
/// </remarks>
3943
public bool ThrowForPartialCookies { get; set; }
4044

4145
// Parse the "chunks:XX" to determine how many chunks there should be.

tests/Microsoft.Owin.Tests/CookieChunkingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void GetLargeChunkedCookieWithMissingChunk_ThrowingEnabled_Throws()
120120
"TestCookieC6=JKLMNOPQR",
121121
"TestCookieC7=STUVWXYZ");
122122

123-
Assert.Throws<FormatException>(() => new ChunkingCookieManager().GetRequestCookie(context, "TestCookie"));
123+
Assert.Throws<FormatException>(() => new ChunkingCookieManager { ThrowForPartialCookies = true }.GetRequestCookie(context, "TestCookie"));
124124
}
125125

126126
[Fact]

0 commit comments

Comments
 (0)