B6644726.java revision 2362
2362N/A * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 257N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 257N/A * This code is free software; you can redistribute it and/or modify it 257N/A * under the terms of the GNU General Public License version 2 only, as 257N/A * published by the Free Software Foundation. 257N/A * This code is distributed in the hope that it will be useful, but WITHOUT 257N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 257N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 257N/A * version 2 for more details (a copy is included in the LICENSE file that 257N/A * accompanied this code). 257N/A * You should have received a copy of the GNU General Public License version 257N/A * 2 along with this work; if not, write to the Free Software Foundation, 257N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 257N/A * @summary Cookie management issues 257N/A // Let's test the default path 257N/A // Then some alternate expires format 257N/A lst.
add(
"myCookie2=bar; path=/dir; expires=Tue, 19 Aug 2025 16:00:00 GMT");
257N/A lst.
add(
"myCookie3=test; path=/dir; expires=Tue Aug 19 2025 16:00:00 GMT-0100");
257N/A // Then Netscape draft cookies and domains 257N/A // Test for passing cookies between http and https 257N/A // There should be 5 cookies if all dates parsed correctly 257N/A fail(
"Should have 5 cookies. Got only "+
cookies.
size() +
", expires probably didn't parse correctly");
257N/A // Check Path for first Cookie 257N/A // We should get 1 Cookie: MyCookie4, because of the domain 257N/A // We should get 4 cookies for non secure URI, and 5 for the secure one 257N/A fail(
"We should have gotten only 4 cookies over http (non secure), got " +
257N/A // myCookie5 (the secure one) shouldn't be here 257N/A fail(
"Got the secure cookie over a non secure link");
257N/A // Let's check that empty path is treated correctly 257N/A fail(
"Missing a cookie when using an empty path");
257N/A // And now, the other way around: 257N/A fail(
"Missing a cookie when using an empty path");
257N/A // Let's make sure the 'Port' optional attributes is enforced 257N/A // myCookie10 should have been rejected 257N/A fail(
"A cookie with an invalid port list was accepted");
257N/A // We should find both myCookie8 and myCookie9 but not myCookie10 257N/A // We should find only myCookie9 257N/A fail(
"A cookie with an invalid port list was returned");
1788N/A // Test httpOnly flag (CR# 6873543) 1788N/A // URI scheme was http: so we should get the cookie 1788N/A // URI scheme was neither http or https so we shouldn't get the cookie 1788N/A fail(
"Should get the cookie with httpOnly when scheme is javascript:");