From f8dc86f1b362c2906ea302eb56928b59156cd484 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Wed, 27 Jul 2011 09:40:57 -0400 Subject: [PATCH] Renamed README for GutHub. --- src/com/gitblit/GitBlitServer.java | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/com/gitblit/GitBlitServer.java b/src/com/gitblit/GitBlitServer.java index 61f681f..d2164f1 100644 --- a/src/com/gitblit/GitBlitServer.java +++ b/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 { @@ -151,6 +151,9 @@ params.port, bindInterface)); httpConnector.setHost(bindInterface); } + if (params.port < 1024 && !isWindows()) { + logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!"); + } connectors.add(httpConnector); } @@ -170,6 +173,9 @@ logger.warn(MessageFormat.format("Binding ssl connector on port {0} to {1}", params.securePort, bindInterface)); secureConnector.setHost(bindInterface); + } + if (params.securePort < 1024 && !isWindows()) { + logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!"); } connectors.add(secureConnector); } else { @@ -255,7 +261,7 @@ * * @param useNIO * @param port - * @return an http cnonector + * @return an http connector */ private static Connector createConnector(boolean useNIO, int port) { Connector connector; @@ -273,6 +279,9 @@ connector.setPort(port); connector.setMaxIdleTime(30000); + if (port < 1024 && !isWindows()) { + logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!"); + } return connector; } @@ -305,6 +314,15 @@ connector.setPort(port); connector.setMaxIdleTime(30000); return connector; + } + + /** + * Tests to see if the operating system is Windows. + * + * @return true if this is a windows machine + */ + private static boolean isWindows() { + return System.getProperty("os.name").toLowerCase().indexOf("windows") > -1; } /** @@ -358,6 +376,9 @@ } } + /** + * JCommander Parameters class for GitBlitServer. + */ @Parameters(separators = " ") private static class Params { -- Gitblit v1.9.1