Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Replaced absolute redirection locations by relative ones when possible.

luccioman54405577aa07
diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java
index 17068b124..76db8ef9b 100644
--- a/htroot/Blacklist_p.java
+++ b/htroot/Blacklist_p.java
@@ -80,7 +80,7 @@ public class Blacklist_p {
blacklistToUse = post.get("newListName", "").trim();
if (blacklistToUse.isEmpty()) {
- prop.put(serverObjects.ACTION_LOCATION,"");
+ prop.put(serverObjects.ACTION_LOCATION, "Blacklist_p.html");
return prop;
}
@@ -127,7 +127,7 @@ public class Blacklist_p {
blacklistToUse = post.get("selectedListName");
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
- prop.put(serverObjects.ACTION_LOCATION,"");
+ prop.put(serverObjects.ACTION_LOCATION, "Blacklist_p.html");
return prop;
}
@@ -155,7 +155,7 @@ public class Blacklist_p {
blacklistToUse = post.get("selectedListName", "").trim();
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
- prop.put(serverObjects.ACTION_LOCATION, "");
+ prop.put(serverObjects.ACTION_LOCATION, "Blacklist_p.html");
return prop;
}
@@ -178,7 +178,7 @@ public class Blacklist_p {
blacklistToUse = post.get("selectedListName", "").trim();
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
- prop.put(serverObjects.ACTION_LOCATION, "");
+ prop.put(serverObjects.ACTION_LOCATION, "Blacklist_p.html");
return prop;
}
diff --git a/htroot/Status.java b/htroot/Status.java
index d31f2867c..47097c2df 100644
--- a/htroot/Status.java
+++ b/htroot/Status.java
@@ -80,7 +80,7 @@ public class Status
}
boolean redirect = false;
if ( post.containsKey("login") ) {
- prop.put(serverObjects.ACTION_LOCATION, "");
+ prop.put(serverObjects.ACTION_LOCATION, "Status.html");
return prop;
} else if ( post.containsKey("pauseCrawlJob") ) {
final String jobType = post.get("jobType");
@@ -112,7 +112,7 @@ public class Status
}
if ( redirect ) {
- prop.put(serverObjects.ACTION_LOCATION, "");
+ prop.put(serverObjects.ACTION_LOCATION, "Status.html");
return prop;
}
}
diff --git a/htroot/Wiki.java b/htroot/Wiki.java
index c456a8585..55255caee 100644
--- a/htroot/Wiki.java
+++ b/htroot/Wiki.java
@@ -122,7 +122,7 @@ public class Wiki {
sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_WIKI_UPDATE, map);
}
page = newEntry;
- prop.putHTML(serverObjects.ACTION_LOCATION, "/Wiki.html?page=" + pagename);
+ prop.putHTML(serverObjects.ACTION_LOCATION, "Wiki.html?page=" + pagename);
prop.put(serverObjects.ACTION_LOCATION, prop.get(serverObjects.ACTION_LOCATION));
}
diff --git a/source/net/yacy/repository/BlacklistHelper.java b/source/net/yacy/repository/BlacklistHelper.java
index 3924344c8..976088e02 100644
--- a/source/net/yacy/repository/BlacklistHelper.java
+++ b/source/net/yacy/repository/BlacklistHelper.java
@@ -32,19 +32,20 @@ public final class BlacklistHelper {
final RequestHeader header) {
String newEntry = entry;
+ String location = null;
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
- return "";
- }
-
- if (newEntry == null || newEntry.isEmpty()) {
- return header.getPathInfo() + "?selectList=&selectedListName=" + blacklistToUse;
- }
-
- // ignore empty entries
- if(newEntry == null || newEntry.isEmpty()) {
- ConcurrentLog.warn(APP_NAME, "skipped adding an empty entry");
- return "";
+ location = header.getPathInfo();
+ } else if (newEntry == null || newEntry.isEmpty()) {
+ location = header.getPathInfo() + "?selectList=&selectedListName=" + blacklistToUse;
}
+
+ if(location != null) {
+ if(location.startsWith("/")) {
+ /* Remove the starting "/" to redirect to a relative location for easier reverse proxy integration */
+ location = location.substring(1, location.length() -1 );
+ }
+ return location;
+ }
if (newEntry.startsWith("http://") ){
newEntry = newEntry.substring(7);
@@ -99,13 +100,20 @@ public final class BlacklistHelper {
final RequestHeader header) {
String oldEntry = entry;
+ String location = null;
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
- return "";
- }
-
- if (oldEntry == null || oldEntry.isEmpty()) {
- return header.getPathInfo() + "?selectList=&selectedListName=" + blacklistToUse;
+ location = header.getPathInfo();
+ } else if (oldEntry == null || oldEntry.isEmpty()) {
+ location = header.getPathInfo() + "?selectList=&selectedListName=" + blacklistToUse;
}
+
+ if(location != null) {
+ if(location.startsWith("/")) {
+ /* Remove the starting "/" to redirect to a relative location for easier reverse proxy integration */
+ location = location.substring(1, location.length() -1 );
+ }
+ return location;
+ }
// remove the entry from the running blacklist engine