HttpBrowser() has a problem with the cookie update mechanism. If the cookie is set by the header(), the information of the set cookie cannot be correctly passed down after a redirect occurs.
/**
* Add cookies to the request.
*/
protected void addCookies(final HttpRequest httpRequest) {
// prepare all cookies
List<Cookie> cookiesList = new ArrayList<>();
if (StringUtil.isNotBlank(httpRequest.header("cookie"))) {
for (String cv: httpRequest.header("cookie").split(";")) {
Cookie cookie = new Cookie(cv);
cookies.set(cookie.getName(),cookie);
}
}
if (!cookies.isEmpty()) {
for (Map.Entry<String, Cookie> cookieEntry : cookies) {
cookiesList.add(cookieEntry.getValue());
}
httpRequest.cookies(cookiesList.toArray(new Cookie[0]));
}
}
HttpBrowser() has a problem with the cookie update mechanism. If the cookie is set by the header(), the information of the set cookie cannot be correctly passed down after a redirect occurs.
/jodd/jodd-http/src/main/java/jodd/http/HttpBrowser.java#addCookies
fix: