use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method shouldNotServeSecureCookiesForDefaultRetrievedHttpUriScheme.
// rfc6265#section-1 Cookies for a given host are shared across all the ports on that host
private void shouldNotServeSecureCookiesForDefaultRetrievedHttpUriScheme() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("https://foo.org/moodle/"), ClientCookieDecoder.LAX.decode("cookie1=VALUE1; Path=/"));
store.add(Uri.create("https://foo.org:443/moodle/login"), ClientCookieDecoder.LAX.decode("cookie1=VALUE2; Path=/"));
store.add(Uri.create("https://foo.org:443/moodle/login"), ClientCookieDecoder.LAX.decode("cookie1=VALUE3; Path=/; Secure"));
Uri uri = Uri.create("http://foo.org/moodle/login");
assertTrue(store.get(uri).isEmpty());
}
use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method returnCookieWhenDomainMatchesAndPathIsChild.
private void returnCookieWhenDomainMatchesAndPathIsChild() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("http://www.foo.com/bar"), ClientCookieDecoder.LAX.decode("ALPHA=VALUE1; Domain=www.foo.com; path=/bar"));
assertTrue(store.get(Uri.create("http://www.foo.com/bar/baz")).size() == 1);
}
use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method returnCookieWhenItWasSetOnParentPath.
private void returnCookieWhenItWasSetOnParentPath() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("http://www.foo.com"), ClientCookieDecoder.LAX.decode("ALPHA=VALUE1; Domain=www.foo.com; path=/bar"));
assertTrue(store.get(Uri.create("http://www.foo.com/bar/baz")).size() == 1);
}
use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method dontReturnCookieForAnotherDomain.
private void dontReturnCookieForAnotherDomain() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("http://www.foo.com"), ClientCookieDecoder.LAX.decode("ALPHA=VALUE1; path="));
assertTrue(store.get(Uri.create("http://www.bar.com")).isEmpty());
}
use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method dontReturnCookieWhenDomainMatchesButPathIsParent.
private void dontReturnCookieWhenDomainMatchesButPathIsParent() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("http://www.foo.com/bar"), ClientCookieDecoder.LAX.decode("ALPHA=VALUE1; Domain=www.foo.com; path=/bar"));
assertTrue(store.get(Uri.create("http://www.foo.com")).isEmpty());
}
Aggregations