Permalink
Browse files

Fixed settingsAck_p.html back link for case where referrer is stripped.

  • Loading branch information...
luccioman committed Mar 7, 2017
1 parent 18c7563 commit 79df5bb20a890451187aec8ada48c09949f78c04
Showing with 43 additions and 5 deletions.
  1. +43 −5 htroot/SettingsAck_p.java
@@ -33,7 +33,6 @@
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import net.yacy.cora.document.id.MultiProtocolURL;
import net.yacy.cora.order.Digest;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.util.Formatter;
@@ -56,9 +55,8 @@ public static serverObjects respond(final RequestHeader header, final serverObje
final serverObjects prop = new serverObjects();
final Switchboard sb = (Switchboard) env;
// get referer for backlink
final MultiProtocolURL referer = header.referer();
prop.put("needsRestart_referer", (referer == null) ? "Settings_p.html" : referer.toNormalform(true));
// set default backlink
prop.put("needsRestart_referer", "Settings_p.html");
prop.put("needsRestart", false);
//if (post == null) System.out.println("POST: NULL"); else System.out.println("POST: " + post.toString());
@@ -97,6 +95,9 @@ public static serverObjects respond(final RequestHeader header, final serverObje
// proxy password
if (post.containsKey("proxyaccount")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=ProxyAccess");
/*
* display port info
*/
@@ -150,6 +151,9 @@ else if (!filter.equals("*")){
// http networking
if (post.containsKey("httpNetworking")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=ProxyAccess");
// set transparent proxy flag
boolean isTransparentProxy = post.containsKey("isTransparentProxy");
@@ -169,13 +173,15 @@ else if (!filter.equals("*")){
// setting X-Forwarded-for header property
env.setConfig("proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader"));
prop.put("info_proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader")? "on" : "off");
prop.put("info", "20");
return prop;
}
// server access
if (post.containsKey("serveraccount")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=ServerAccess");
// fileHost
String fileHost = (post.get("fileHost")).trim();
@@ -252,6 +258,8 @@ else if (!filter.equals("*")){
}
if (post.containsKey("proxysettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=proxy");
/* ====================================================================
* Reading out the remote proxy settings
@@ -289,6 +297,9 @@ else if (!filter.equals("*")){
}
if (post.containsKey("urlproxySettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=UrlProxyAccess");
env.setConfig("proxyURL.access", post.get("urlproxyfilter"));
env.setConfig("proxyURL.rewriteURLs", post.get("urlproxydomains"));
env.setConfig("proxyURL", "on".equals(post.get("urlproxyenabled")) ? true : false);
@@ -299,6 +310,9 @@ else if (!filter.equals("*")){
}
if (post.containsKey("seedUploadRetry")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=seed");
String error;
if ((error = Network.saveSeedList(sb)) == null) {
// trying to upload the seed-list file
@@ -313,6 +327,9 @@ else if (!filter.equals("*")){
}
if (post.containsKey("seedSettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=seed");
// get the currently used uploading method
final String oldSeedUploadMethod = env.getConfig("seedUploadMethod","none");
final String newSeedUploadMethod = post.get("seedUploadMethod");
@@ -346,6 +363,11 @@ else if (!filter.equals("*")){
return prop;
}
}
if (post.containsKey("seedFileSettings") || post.containsKey("seedFtpSettings") || post.containsKey("seedScpSettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=seed");
}
/*
* Loop through the available seed uploaders to see if the
@@ -406,6 +428,9 @@ else if (!filter.equals("*")){
* Message forwarding configuration
*/
if (post.containsKey("msgForwarding")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=messageForwarding");
env.setConfig("msgForwardingEnabled", post.containsKey("msgForwardingEnabled"));
env.setConfig("msgForwardingCmd", post.get("msgForwardingCmd"));
env.setConfig("msgForwardingTo", post.get("msgForwardingTo"));
@@ -420,6 +445,9 @@ else if (!filter.equals("*")){
// Crawler settings
if (post.containsKey("crawlerSettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=crawler");
// get Crawler Timeout
String timeoutStr = post.get("crawler.clientTimeout");
@@ -505,6 +533,10 @@ else if (!filter.equals("*")){
// change https port
if (post.containsKey("port.ssl")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=ProxyAccess");
int port = post.getInt("port.ssl", 8443);
if (port > 0 && port != env.getConfigInt("port.ssl", 8443)) {
env.setConfig("port.ssl", port);
@@ -516,6 +548,9 @@ else if (!filter.equals("*")){
// Debug/Analysis settings
if (post.containsKey("debugAnalysisSettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=debug");
boolean tickedCheckbox = post.containsKey("solrBinaryResponse");
env.setConfig(SwitchboardConstants.REMOTE_SOLR_BINARY_RESPONSE_ENABLED, tickedCheckbox);
@@ -549,6 +584,9 @@ else if (!filter.equals("*")){
// Referrer Policy settings
if (post.containsKey("referrerPolicySettings")) {
// set backlink
prop.put("needsRestart_referer", "Settings_p.html?page=referrer");
String metaPolicy = post.get("metaPolicy", SwitchboardConstants.REFERRER_META_POLICY_DEFAULT);
env.setConfig(SwitchboardConstants.REFERRER_META_POLICY, metaPolicy);

0 comments on commit 79df5bb

Please sign in to comment.