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>
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 221e555..d3a9059 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 @@
   @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 @@
     }
   }
 
+  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;