Beispiel #1
0
        public void GetLargeChunkedCookie_Reassembled()
        {
            HttpContext context = new DefaultHttpContext();

            context.Request.Headers.AppendValues("Cookie",
                                                 "TestCookie=chunks:7",
                                                 "TestCookieC1=abcdefghi",
                                                 "TestCookieC2=jklmnopqr",
                                                 "TestCookieC3=stuvwxyz0",
                                                 "TestCookieC4=123456789",
                                                 "TestCookieC5=ABCDEFGHI",
                                                 "TestCookieC6=JKLMNOPQR",
                                                 "TestCookieC7=STUVWXYZ");

            string result     = new ChunkingCookieManager().GetRequestCookie(context, "TestCookie");
            string testString = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

            Assert.Equal(testString, result);
        }
Beispiel #2
0
        public void GetLargeChunkedCookieWithQuotes_Reassembled()
        {
            HttpContext context = new DefaultHttpContext();

            context.Request.Headers.AppendValues("Cookie",
                                                 "TestCookie=chunks:7",
                                                 "TestCookieC1=\"abcdefghi\"",
                                                 "TestCookieC2=\"jklmnopqr\"",
                                                 "TestCookieC3=\"stuvwxyz0\"",
                                                 "TestCookieC4=\"123456789\"",
                                                 "TestCookieC5=\"ABCDEFGHI\"",
                                                 "TestCookieC6=\"JKLMNOPQR\"",
                                                 "TestCookieC7=\"STUVWXYZ\"");

            string result     = new ChunkingCookieManager().GetRequestCookie(context, "TestCookie");
            string testString = "\"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\"";

            Assert.Equal(testString, result);
        }
Beispiel #3
0
        public void GetLargeChunkedCookieWithMissingChunk_ThrowingDisabled_NotReassembled()
        {
            HttpContext context = new DefaultHttpContext();

            context.Request.Headers.AppendValues("Cookie",
                                                 "TestCookie=chunks:7",
                                                 "TestCookieC1=abcdefghi",
                                                 // Missing chunk "TestCookieC2=jklmnopqr",
                                                 "TestCookieC3=stuvwxyz0",
                                                 "TestCookieC4=123456789",
                                                 "TestCookieC5=ABCDEFGHI",
                                                 "TestCookieC6=JKLMNOPQR",
                                                 "TestCookieC7=STUVWXYZ");

            string result = new ChunkingCookieManager()
            {
                ThrowForPartialCookies = false
            }.GetRequestCookie(context, "TestCookie");
            string testString = "chunks:7";

            Assert.Equal(testString, result);
        }