diff --git a/scm-core/src/main/java/sonia/scm/web/cgi/CGIRunner.java b/scm-core/src/main/java/sonia/scm/web/cgi/CGIRunner.java index a48740e519..31ad7fe7e7 100644 --- a/scm-core/src/main/java/sonia/scm/web/cgi/CGIRunner.java +++ b/scm-core/src/main/java/sonia/scm/web/cgi/CGIRunner.java @@ -99,14 +99,17 @@ public class CGIRunner * @param pathInfo * @param req * @param res + * @param serverPort * * @throws IOException */ public void exec(EnvList environment, File command, String pathInfo, - HttpServletRequest req, HttpServletResponse res, int serverPort) + HttpServletRequest req, HttpServletResponse res, + int serverPort) throws IOException { - exec(environment, defaultCmdPrefix, command, pathInfo, req, res, serverPort); + exec(environment, defaultCmdPrefix, command, pathInfo, req, res, + serverPort); } /** @@ -120,6 +123,7 @@ public class CGIRunner * @param pathInfo * @param req * @param res + * @param serverPort * * @throws IOException */ @@ -209,6 +213,11 @@ public class CGIRunner if (logger.isDebugEnabled()) { logger.debug("execute cgi: ".concat(execCmd)); + + if (logger.isTraceEnabled()) + { + logger.trace(environment.toString()); + } } Process p = (dir == null) @@ -235,7 +244,7 @@ public class CGIRunner if (inLength > 0) { copy(inFromReq, outToCgi, inLength); - } + } outToCgi.close(); } @@ -263,10 +272,20 @@ public class CGIRunner String line = null; InputStream inFromCgi = p.getInputStream(); + if (logger.isTraceEnabled()) + { + logger.trace("CGI-Response Header:"); + } + // br=new BufferedReader(new InputStreamReader(inFromCgi)); // while ((line=br.readLine())!=null) while ((line = getTextLineFromStream(inFromCgi)).length() > 0) { + if (logger.isTraceEnabled()) + { + logger.trace(" ".concat(line)); + } + if (!line.startsWith("HTTP")) { int k = line.indexOf(':'); diff --git a/scm-core/src/main/java/sonia/scm/web/cgi/EnvList.java b/scm-core/src/main/java/sonia/scm/web/cgi/EnvList.java index 309c7c0374..6615403c68 100644 --- a/scm-core/src/main/java/sonia/scm/web/cgi/EnvList.java +++ b/scm-core/src/main/java/sonia/scm/web/cgi/EnvList.java @@ -29,6 +29,8 @@ * */ + + package sonia.scm.web.cgi; //~--- non-JDK imports -------------------------------------------------------- @@ -38,6 +40,7 @@ import sonia.scm.util.Util; //~--- JDK imports ------------------------------------------------------------ import java.util.HashMap; +import java.util.Iterator; import java.util.Map; /** @@ -91,7 +94,24 @@ public class EnvList @Override public String toString() { - return envMap.toString(); + String s = System.getProperty("line.separator"); + StringBuilder out = new StringBuilder("Enironment:"); + + out.append(s); + + Iterator it = envMap.values().iterator(); + + while (it.hasNext()) + { + out.append(" ").append(it.next()); + + if (it.hasNext()) + { + out.append(s); + } + } + + return out.toString(); } //~--- get methods ----------------------------------------------------------