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:
@@ -68,7 +68,8 @@ public abstract class CacheBasedWebSession implements WebSession {
|
|||||||
this.anonymousProvider = anonymousProvider;
|
this.anonymousProvider = anonymousProvider;
|
||||||
this.identified = identified;
|
this.identified = identified;
|
||||||
|
|
||||||
if (!GitSmartHttpTools.isGitClient(request)) {
|
if (request.getRequestURI() == null
|
||||||
|
|| !GitSmartHttpTools.isGitClient(request)) {
|
||||||
String cookie = readCookie();
|
String cookie = readCookie();
|
||||||
if (cookie != null) {
|
if (cookie != null) {
|
||||||
key = new Key(cookie);
|
key = new Key(cookie);
|
||||||
@@ -184,6 +185,10 @@ public abstract class CacheBasedWebSession implements WebSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveCookie() {
|
private void saveCookie() {
|
||||||
|
if (response == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final String token;
|
final String token;
|
||||||
final int ageSeconds;
|
final int ageSeconds;
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@ package com.google.gerrit.httpd;
|
|||||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||||
|
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
|
import com.google.gerrit.common.Nullable;
|
||||||
import com.google.gerrit.extensions.registration.DynamicItem;
|
import com.google.gerrit.extensions.registration.DynamicItem;
|
||||||
import com.google.gerrit.httpd.WebSessionManager.Val;
|
import com.google.gerrit.httpd.WebSessionManager.Val;
|
||||||
import com.google.gerrit.server.AnonymousUser;
|
import com.google.gerrit.server.AnonymousUser;
|
||||||
@@ -56,7 +57,7 @@ public class H2CacheBasedWebSession extends CacheBasedWebSession {
|
|||||||
@Inject
|
@Inject
|
||||||
H2CacheBasedWebSession(
|
H2CacheBasedWebSession(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
@Nullable HttpServletResponse response,
|
||||||
WebSessionManagerFactory managerFactory,
|
WebSessionManagerFactory managerFactory,
|
||||||
@Named(WebSessionManager.CACHE_NAME) Cache<String, Val> cache,
|
@Named(WebSessionManager.CACHE_NAME) Cache<String, Val> cache,
|
||||||
AuthConfig authConfig,
|
AuthConfig authConfig,
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
include_defs('//lib/maven.defs')
|
include_defs('//lib/maven.defs')
|
||||||
|
|
||||||
VERSION = '4.0-beta'
|
VERSION = '4.0-beta'
|
||||||
|
COOKIE_PATCH = '4.0-beta-98-g8d88344'
|
||||||
EXCLUDE = [
|
EXCLUDE = [
|
||||||
'META-INF/DEPENDENCIES',
|
'META-INF/DEPENDENCIES',
|
||||||
'META-INF/LICENSE',
|
'META-INF/LICENSE',
|
||||||
@@ -41,8 +42,9 @@ maven_jar(
|
|||||||
|
|
||||||
maven_jar(
|
maven_jar(
|
||||||
name = 'guice-servlet',
|
name = 'guice-servlet',
|
||||||
id = 'com.google.inject.extensions:guice-servlet:' + VERSION,
|
id = 'com.google.inject.extensions:guice-servlet:' + COOKIE_PATCH,
|
||||||
sha1 = '46b44984f254c0bf92d0c972fad1a70292ada28e',
|
repository = GERRIT,
|
||||||
|
sha1 = 'fa17d57a083fe9fc86b93f2dc37069573a2e65cd',
|
||||||
license = 'Apache2.0',
|
license = 'Apache2.0',
|
||||||
deps = [':guice'],
|
deps = [':guice'],
|
||||||
exclude = EXCLUDE,
|
exclude = EXCLUDE,
|
||||||
|
Reference in New Issue
Block a user