Merge topic 'web-session-regression'

* changes:
  Patch guice servlet extension to fix cookies bug
  WebSession: Prevent NPE in GitSmartHttpTools.isGitClient()
  WebSessionCache: Make response parameter optional
This commit is contained in:
Dave Borowitz
2014-06-16 18:59:35 +00:00
committed by Gerrit Code Review
3 changed files with 12 additions and 4 deletions

View File

@@ -68,7 +68,8 @@ public abstract class CacheBasedWebSession implements WebSession {
this.anonymousProvider = anonymousProvider;
this.identified = identified;
if (!GitSmartHttpTools.isGitClient(request)) {
if (request.getRequestURI() == null
|| !GitSmartHttpTools.isGitClient(request)) {
String cookie = readCookie();
if (cookie != null) {
key = new Key(cookie);
@@ -184,6 +185,10 @@ public abstract class CacheBasedWebSession implements WebSession {
}
private void saveCookie() {
if (response == null) {
return;
}
final String token;
final int ageSeconds;

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.httpd;
import static java.util.concurrent.TimeUnit.MINUTES;
import com.google.common.cache.Cache;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.registration.DynamicItem;
import com.google.gerrit.httpd.WebSessionManager.Val;
import com.google.gerrit.server.AnonymousUser;
@@ -56,7 +57,7 @@ public class H2CacheBasedWebSession extends CacheBasedWebSession {
@Inject
H2CacheBasedWebSession(
HttpServletRequest request,
HttpServletResponse response,
@Nullable HttpServletResponse response,
WebSessionManagerFactory managerFactory,
@Named(WebSessionManager.CACHE_NAME) Cache<String, Val> cache,
AuthConfig authConfig,

View File

@@ -1,6 +1,7 @@
include_defs('//lib/maven.defs')
VERSION = '4.0-beta'
COOKIE_PATCH = '4.0-beta-98-g8d88344'
EXCLUDE = [
'META-INF/DEPENDENCIES',
'META-INF/LICENSE',
@@ -41,8 +42,9 @@ maven_jar(
maven_jar(
name = 'guice-servlet',
id = 'com.google.inject.extensions:guice-servlet:' + VERSION,
sha1 = '46b44984f254c0bf92d0c972fad1a70292ada28e',
id = 'com.google.inject.extensions:guice-servlet:' + COOKIE_PATCH,
repository = GERRIT,
sha1 = 'fa17d57a083fe9fc86b93f2dc37069573a2e65cd',
license = 'Apache2.0',
deps = [':guice'],
exclude = EXCLUDE,