mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
Replaced absolute redirection locations by relative ones when possible.
This makes integration of YaCy behind a reverse proxy subfolder easier.
This commit is contained in:
parent
1857651988
commit
54405577aa
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user