fix for bug in cytrails

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7192 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent b019426811
commit a83186ac7d

@ -30,6 +30,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Date;
import net.yacy.cora.document.MultiProtocolURI;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.document.ImageParser;
@ -46,12 +47,13 @@ public class cytag {
public static Image respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard)env;
MultiProtocolURI referer = header.referer();
// harvest request information
StringBuilder connect = new StringBuilder();
connect.append('{');
addJSON(connect, "time", DateFormatter.formatShortMilliSecond(new Date()));
addJSON(connect, "trail", header.referer().toNormalform(false, false));
addJSON(connect, "trail", (referer == null) ? "" : referer.toNormalform(false, false));
addJSON(connect, "nick", (post == null) ? "" : post.get("nick", ""));
addJSON(connect, "tag", (post == null) ? "" : post.get("tag", ""));
addJSON(connect, "icon", (post == null) ? "" : post.get("icon", ""));
@ -59,6 +61,7 @@ public class cytag {
addJSON(connect, "agent", header.get("User-Agent", ""));
connect.append('}');
if (sb.trail.size() >= 100) sb.trail.remove();
sb.trail.add(connect.toString());
//Log.logInfo("CYTAG", "catched trail - " + connect.toString());

@ -63,6 +63,7 @@ import java.util.Properties;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Semaphore;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
@ -225,7 +226,7 @@ public final class Switchboard extends serverSwitch {
public URLLicense licensedURLs;
public List<Pattern> networkWhitelist, networkBlacklist;
public Dispatcher dhtDispatcher;
public List<String> trail;
public LinkedBlockingQueue<String> trail;
public yacySeedDB peers;
public WorkTables tables;
@ -669,7 +670,7 @@ public final class Switchboard extends serverSwitch {
//plasmaSnippetCache.result scr = snippetCache.retrieve(new URL("http://www.heise.de/security/news/foren/go.shtml?read=1&msg_id=7301419&forum_id=72721"), query, true);
//plasmaSnippetCache.result scr = snippetCache.retrieve(new URL("http://www.heise.de/kiosk/archiv/ct/2003/4/20"), query, true, 260);
this.trail = new ArrayList<String>();
this.trail = new LinkedBlockingQueue<String>();
log.logConfig("Finished Switchboard Initialization");
sb = this;

Loading…
Cancel
Save