From 2120db289a72da27625a6be26873fa114c227390 Mon Sep 17 00:00:00 2001 From: low012 Date: Tue, 14 Feb 2012 20:54:19 +0100 Subject: [PATCH] *) Small change which should solve problem with cgitb module in Python CGI scripts. --- .../de/anomic/http/server/HTTPDFileHandler.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java index 5ec61e83b..dd8f665fc 100644 --- a/source/de/anomic/http/server/HTTPDFileHandler.java +++ b/source/de/anomic/http/server/HTTPDFileHandler.java @@ -416,16 +416,20 @@ public final class HTTPDFileHandler { // we are finished with parsing // the result of value hand-over is in args and argc - if (path.length() == 0) { + if (path.isEmpty()) { HTTPDemon.sendRespondError(conProp,out,4,400,null,"Bad Request",null); out.flush(); return; } - File targetClass=null; + File targetClass = null; // locate the file - if (path.length() > 0 && path.charAt(0) != '/' && path.charAt(0) != '\\') path = "/" + path; // attach leading slash - if (path.endsWith("index.html")) path = path.substring(0, path.length() - 10); + if (!path.isEmpty() && path.charAt(0) != '/' && path.charAt(0) != '\\') { + path = "/" + path; // attach leading slash + } + if (path.endsWith("index.html")) { + path = path.substring(0, path.length() - 10); + } // a different language can be desired (by i.e. ConfigBasic.html) than the one stored in the locale.language String localeSelection = switchboard.getConfig("locale.language","default"); @@ -832,9 +836,7 @@ public final class HTTPDFileHandler { targetDate = new Date(System.currentTimeMillis()); - if (exitValue == 0 - && cgiBody != null - && !cgiBody.isEmpty()) { + if (cgiBody != null && !cgiBody.isEmpty()) { HTTPDemon.sendRespondHeader( conProp, out,