Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x

This commit is contained in:
Jan Bartel 2020-05-20 23:06:27 +02:00
commit 42e46aee49
3 changed files with 16 additions and 8 deletions

View File

@ -395,12 +395,15 @@ public class HpackContext
{
if (LOG.isDebugEnabled())
LOG.debug(String.format("HdrTbl[%x] evictAll", HpackContext.this.hashCode()));
_fieldMap.clear();
_nameMap.clear();
_offset = 0;
_size = 0;
_dynamicTableSizeInBytes = 0;
Arrays.fill(_entries, null);
if (size() > 0)
{
_fieldMap.clear();
_nameMap.clear();
_offset = 0;
_size = 0;
_dynamicTableSizeInBytes = 0;
Arrays.fill(_entries, null);
}
}
}

View File

@ -467,7 +467,7 @@ public abstract class AbstractSessionCache extends ContainerLifeCycle implements
{
//only write the session out at this point if the attributes changed. If only
//the lastAccess/expiry time changed defer the write until the last request exits
if (session.getSessionData().isDirty() && _flushOnResponseCommit)
if (session.isValid() && session.getSessionData().isDirty() && _flushOnResponseCommit)
{
if (LOG.isDebugEnabled())
LOG.debug("Flush session {} on response commit", session);

View File

@ -54,6 +54,7 @@ public class RemoveSessionTest
String servletMapping = "/server";
DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory();
cacheFactory.setFlushOnResponseCommit(true);
cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT);
SessionDataStoreFactory storeFactory = new TestSessionDataStoreFactory();
@ -93,6 +94,9 @@ public class RemoveSessionTest
assertEquals(0, ((DefaultSessionCache)m.getSessionCache()).getSessionsCurrent());
assertEquals(1, ((DefaultSessionCache)m.getSessionCache()).getSessionsMax());
assertEquals(1, ((DefaultSessionCache)m.getSessionCache()).getSessionsTotal());
//check the session is no longer in the cache
assertFalse(((AbstractSessionCache)m.getSessionCache()).contains(TestServer.extractSessionId(sessionCookie)));
//check the session is not persisted any more
assertFalse(m.getSessionCache().getSessionDataStore().exists(TestServer.extractSessionId(sessionCookie)));
@ -125,7 +129,8 @@ public class RemoveSessionTest
String action = request.getParameter("action");
if ("create".equals(action))
{
request.getSession(true);
HttpSession s = request.getSession(true);
s.setAttribute("foo", "bar");
}
else if ("delete".equals(action))
{