use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testCookieNameStartingWithDollarSign.
/**
* Tests if cookie constructor rejects cookie name starting with $.
*/
public void testCookieNameStartingWithDollarSign() throws Exception {
Header setcookie = new Header("Set-Cookie", "$invalid_name=");
CookieSpec cookiespec = new CookieSpecBase();
Cookie[] parsed = cookieParse(cookiespec, "127.0.0.1", 80, "/", false, setcookie);
assertNotNull(parsed);
assertEquals(1, parsed.length);
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testMatchBlankPath.
public void testMatchBlankPath() throws Exception {
CookieSpec cookiespec = new CookieSpecBase();
Cookie cookie = new Cookie("host", "name", "value", "/", null, false);
assertTrue(cookiespec.match("host", 80, " ", false, cookie));
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testParseNoName.
public void testParseNoName() throws Exception {
Header header = new Header("Set-Cookie", "=stuff; path=/");
CookieSpec cookiespec = new CookieSpecBase();
try {
Cookie[] parsed = cookieParse(cookiespec, "127.0.0.1", 80, "/", false, header);
fail("MalformedCookieException should have been thrown");
} catch (MalformedCookieException ex) {
// expected
}
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testParseWithBlankPath.
public void testParseWithBlankPath() throws Exception {
Header header = new Header("Set-Cookie", "cookie-name=cookie-value; domain=127.0.0.1; path=/; secure");
CookieSpec cookiespec = new CookieSpecBase();
Cookie[] parsed = cookieParse(cookiespec, "127.0.0.1", 80, " ", false, header);
assertNotNull(parsed);
assertEquals(1, parsed.length);
assertEquals("/", parsed[0].getPath());
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testInvalidSecondDomainLevelCookieMatch1.
public void testInvalidSecondDomainLevelCookieMatch1() throws Exception {
Cookie cookie = new Cookie(".sourceforge.net", "name", null, "/", null, false);
cookie.setDomainAttributeSpecified(true);
cookie.setPathAttributeSpecified(true);
CookieSpec cookiespec = new CookieSpecBase();
assertFalse(cookiespec.match("antisourceforge.net", 80, "/", false, cookie));
}
Aggregations