summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2010-01-04 06:19:55 -0800
committerShawn O. Pearce <sop@google.com>2010-01-04 06:19:55 -0800
commiteb4af5a8f335bd74456d8469542ce0be436b034b (patch)
tree28aa2f18ed7d3e9b581cea9464878614ccccf774
parent69b5ea84147209c9fbcd1ed2e8b1070b1d872d6c (diff)
Allow ?s=0 to disable server side permutation selection
The permutation selection algorithm should always work, but it might fail on a weird browser combination we haven't seen before that was working through the standard GWT selection process. If the user manually adds ?s=0 to the URL we skip the server side selection and use the stock nocache.js to allow the client to perform the permutation selection. It shouldn't ever be necessary, but its good to have an escape hatch. Change-Id: I192df745199aba3cfc8eca5b5adf509bdb280d9e Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/HostPageServlet.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/HostPageServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/HostPageServlet.java
index 221e555b4f..d3a9059c2e 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/HostPageServlet.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/HostPageServlet.java
@@ -149,7 +149,7 @@ public class HostPageServlet extends HttpServlet {
@Override
protected void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException {
- final Page.Content page = get().get(selector.select(req));
+ final Page.Content page = get().get(select(req));
final byte[] raw;
final CurrentUser user = currentUser.get();
@@ -187,6 +187,17 @@ public class HostPageServlet extends HttpServlet {
}
}
+ private Permutation select(final HttpServletRequest req) {
+ if ("0".equals(req.getParameter("s"))) {
+ // If s=0 is used in the URL, the user has explicitly asked us
+ // to not perform selection on the server side, perhaps due to
+ // it incorrectly guessing their user agent.
+ //
+ return null;
+ }
+ return selector.select(req);
+ }
+
private static byte[] concat(byte[] p1, byte[] p2, byte[] p3) {
final byte[] r = new byte[p1.length + p2.length + p3.length];
int p = 0;