Skip to content

Commit

Permalink
Fix #9760 EE9 Cookies
Browse files Browse the repository at this point in the history
Fix #9760 Only set path and domain if they are not blank
  • Loading branch information
gregw committed Jun 7, 2023
1 parent 774711d commit ec0059a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2199,15 +2199,20 @@ private static Cookie convertCookie(HttpCookie cookie, CookieCompliance complian
//RFC2965 defines the cookie header as supporting path and domain but RFC6265 permits only name=value
if (CookieCompliance.RFC2965.equals(compliance))
{
result.setPath(cookie.getPath());
result.setDomain(cookie.getDomain());
String path = cookie.getPath();
if (StringUtil.isNotBlank(path))
result.setPath(path);

String domain = cookie.getDomain();
if (StringUtil.isNotBlank(domain))
result.setDomain(domain);
}
return result;
}
catch (Exception ignore)
catch (Exception x)
{
if (LOG.isDebugEnabled())
LOG.debug("Bad Cookie", ignore);
LOG.debug("Bad Cookie", x);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1479,8 +1479,8 @@ public void testConnectionClose() throws Exception
public void testSpecCookies() throws Exception
{
_server.stop();
_connector.getConnectionFactory(HttpConnectionFactory.class).
getHttpConfiguration().setRequestCookieCompliance(CookieCompliance.RFC2965);
_connector.getConnectionFactory(HttpConnectionFactory.class)
.getHttpConfiguration().setRequestCookieCompliance(CookieCompliance.RFC2965);
_server.start();

final ArrayList<Cookie> cookies = new ArrayList<>();
Expand Down

0 comments on commit ec0059a

Please sign in to comment.