Fix empty domain handling in ResponseCookie

This commit also updates its test to use its intended inputs.
This commit is contained in:
Johnny Lim
2020-03-22 13:28:49 +09:00
committed by Rossen Stoyanchev
parent c24fa22a1b
commit 0f50a9a60a
2 changed files with 2 additions and 2 deletions

View File

@@ -248,7 +248,7 @@ public final class ResponseCookie extends HttpCookie {
if (lenient && !StringUtils.isEmpty(domain)) {
String s = domain.trim();
if (s.startsWith("\"") && s.endsWith("\"")) {
if (s.substring(1, domain.length() - 1).trim().isEmpty()) {
if (s.substring(1, s.length() - 1).trim().isEmpty()) {
return null;
}
}