Skip to content

Commit

Permalink
Merge pull request #166 from quarkusio/quarkus-#43628
Browse files Browse the repository at this point in the history
Properly remove cookie header
  • Loading branch information
geoand authored Oct 1, 2024
2 parents 13598b3 + f6e79a3 commit cdf13a0
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,14 @@ public PushBuilderImpl(HttpServletRequestImpl servletRequest) {
if(cookie.getValue().getMaxAge() != null && cookie.getValue().getMaxAge() <= 0) {
//remove cookie
List<String> existing = this.headers.getAll(HttpHeaderNames.COOKIE);
if(existing != null) {
Iterator<String> it = existing.iterator();
while (it.hasNext()) {
String val = it.next();
if(val.startsWith(cookie.getKey() + "=")) {
it.remove();
}
List<String> newValues = new ArrayList<>(existing.size());
for (String value : existing) {
if(value.startsWith(cookie.getKey() + "=")) {
continue;
}
newValues.add(value);
}
this.headers.set(HttpHeaderNames.COOKIE, newValues);
} else if(!cookie.getKey().equals(servletRequest.getServletContext().getSessionCookieConfig().getName())){
this.headers.add(HttpHeaderNames.COOKIE, cookie.getKey() + "=" + cookie.getValue().getValue());
}
Expand Down

0 comments on commit cdf13a0

Please sign in to comment.