James Moger
2011-10-06 cc5ad8d53bcf953eb60e11dcf72aa9f69ec043f3
src/com/gitblit/GitBlitServer.java
@@ -65,7 +65,7 @@
   private static Logger logger;
   public static void main(String[] args) {
   public static void main(String... args) {
      Params params = new Params();
      JCommander jc = new JCommander(params);
      try {
@@ -176,7 +176,7 @@
            }
            if (params.securePort < 1024 && !isWindows()) {
               logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
            }
            }
            connectors.add(secureConnector);
         } else {
            logger.warn("Failed to find or load Keystore?");
@@ -237,7 +237,7 @@
      // Setup the GitBlit context
      GitBlit gitblit = GitBlit.self();
      gitblit.configureContext(settings);
      gitblit.configureContext(settings, true);
      rootContext.addEventListener(gitblit);
      try {
@@ -288,6 +288,9 @@
   /**
    * Creates an https connector.
    * 
    * SSL renegotiation will be enabled if the JVM is 1.6.0_22 or later.
    * oracle.com/technetwork/java/javase/documentation/tlsreadme2-176330.html
    *
    * @param keystore
    * @param password
    * @param useNIO
@@ -308,14 +311,31 @@
         SslSocketConnector ssl = new SslSocketConnector();
         connector = ssl;
      }
      connector.setAllowRenegotiate(false);
      // disable renegotiation unless this is a patched JVM
      boolean allowRenegotiation = false;
      String v = System.getProperty("java.version");
      if (v.startsWith("1.7")) {
         allowRenegotiation = true;
      } else if (v.startsWith("1.6")) {
         // 1.6.0_22 was first release with RFC-5746 implemented fix.
         if (v.indexOf('_') > -1) {
            String b = v.substring(v.indexOf('_') + 1);
            if (Integer.parseInt(b) >= 22) {
               allowRenegotiation = true;
            }
         }
      }
      if (allowRenegotiation) {
         logger.info("   allowing SSL renegotiation on Java " + v);
      }
      connector.setAllowRenegotiate(true);
      connector.setKeystore(keystore.getAbsolutePath());
      connector.setPassword(password);
      connector.setPort(port);
      connector.setMaxIdleTime(30000);
      return connector;
   }
   /**
    * Tests to see if the operating system is Windows.
    * 
@@ -376,6 +396,9 @@
      }
   }
   /**
    * JCommander Parameters class for GitBlitServer.
    */
   @Parameters(separators = " ")
   private static class Params {