Skip to content

Commit

Permalink
PowFilter: cookie set path root
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMirzayanov committed Dec 24, 2023
1 parent 16b8314 commit ee9106f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions code/src/main/java/org/nocturne/ddos/PowFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,15 @@ private void doInternalFilter(HttpServletRequest request, HttpServletResponse re
} else if (cookie != null && isResult(cookie, half)) {
info("cookie != null && isResult(cookie, half): cookie=" + cookie + ", half=" + half + ".");
Cookie powCookie = new Cookie("pow", sha);
powCookie.setPath("/");
powCookie.setMaxAge((int) TimeUnit.DAYS.toSeconds(1));
response.addCookie(powCookie);
info("Set-Cookie: pow=" + sha + ".");
chain.doFilter(request, response);
} else {
info("else case: cookie=" + cookie + ", half=" + half + ".");
Cookie powCookie = new Cookie("pow", half);
powCookie.setPath("/");
powCookie.setMaxAge((int) TimeUnit.DAYS.toSeconds(1));
response.addCookie(powCookie);
response.setContentType("text/html");
Expand Down

0 comments on commit ee9106f

Please sign in to comment.