From a2fba6584f64948a78683d8c173e87f9a2921799 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 30 Apr 2014 05:05:02 +0200 Subject: [PATCH] use submitted default userAgent if cloning a crawl --- htroot/CrawlStartExpert.html | 2 +- htroot/CrawlStartExpert.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htroot/CrawlStartExpert.html b/htroot/CrawlStartExpert.html index 848eaf0cf..ec4a692a0 100644 --- a/htroot/CrawlStartExpert.html +++ b/htroot/CrawlStartExpert.html @@ -450,7 +450,7 @@ diff --git a/htroot/CrawlStartExpert.java b/htroot/CrawlStartExpert.java index 1d36a3970..3f0635052 100644 --- a/htroot/CrawlStartExpert.java +++ b/htroot/CrawlStartExpert.java @@ -479,8 +479,7 @@ public class CrawlStartExpert { prop.put("cachePolicy_iffresh", 1); } - - // ---------- Agent name (untested & untouched) + // ---------- Agent name if (sb.isP2PMode()) { prop.put("agentSelect", 0); } else { @@ -496,10 +495,17 @@ public class CrawlStartExpert { if (sb.isAllIPMode()) { agentNames.add(ClientIdentification.browserAgentName); } + String defaultAgentName = agentNames.get(0); + if (post != null && post.containsKey("agentName")) { + String agentName = post.get("agentName", sb.isIntranetMode() ? ClientIdentification.yacyIntranetCrawlerAgentName : ClientIdentification.yacyInternetCrawlerAgentName); + if (agentNames.contains(agentName)) defaultAgentName = agentName; + } for (int i = 0; i < agentNames.size(); i++) { prop.put("agentSelect_list_" + i + "_name", agentNames.get(i)); + prop.put("agentSelect_list_" + i + "_default", agentNames.get(i).equals(defaultAgentName) ? 1 : 0); } prop.put("agentSelect_list", agentNames.size()); + } prop.put("agentSelect_defaultAgentName", ClientIdentification.yacyInternetCrawlerAgentName);