Skip to content

Feature/enable cookie store at request level #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update request cookie store when it's present, otherwise update globa…
…l cookie store
  • Loading branch information
tranchitam committed Apr 30, 2020
commit dc2e23c27a2012d04465526f140c2984cf9a4a86
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,13 @@ public boolean exitAfterIntercept(Channel channel,
Realm realm = request.getRealm() != null ? request.getRealm() : config.getRealm();

// This MUST BE called before Redirect30xInterceptor because latter assumes cookie store is already updated
CookieStore cookieStore = config.getCookieStore();
CookieStore requestCookieStore = request.getCookieStore();
if (cookieStore != null || requestCookieStore != null) {
CookieStore cookieStore = request.getCookieStore() != null ? request.getCookieStore() : config.getCookieStore();
if (cookieStore != null) {
for (String cookieStr : responseHeaders.getAll(SET_COOKIE)) {
Cookie c = cookieDecoder.decode(cookieStr);
if (c != null) {
// Set-Cookie header could be invalid/malformed
if (cookieStore != null) {
cookieStore.add(future.getCurrentRequest().getUri(), c);
}

if (requestCookieStore != null) {
requestCookieStore.add(request.getUri(), c);
}
cookieStore.add(future.getCurrentRequest().getUri(), c);
}
}
}
Expand Down