small change

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@879 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
borg-0300 19 years ago
parent d98ed41f31
commit a1777788a5

@ -62,18 +62,18 @@ import de.anomic.yacy.yacyVersion;
public final class hello {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
if (post == null || ss == null || yacyCore.seedDB == null || yacyCore.seedDB.mySeed == null) { return new serverObjects(); }
if (post == null || ss == null || yacyCore.seedDB == null || yacyCore.seedDB.mySeed == null) { return null; }
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
if (prop == null) { return new serverObjects(); }
if (prop == null) { return null; }
// final String iam = (String) post.get("iam", ""); // complete seed of the requesting peer
// final String pattern = (String) post.get("pattern", ""); //
// final String mytime = (String) post.get(STR_MYTIME, ""); //
final String key = (String) post.get("key", ""); // transmission key for response
final String seed = (String) post.get(yacySeed.STR_SEED, ""); //
final String countStr = (String) post.get("count", "0"); //
// final String mytime = (String) post.get(STR_MYTIME, ""); //
final String key = (String) post.get("key", ""); // transmission key for response
final String seed = (String) post.get(yacySeed.STR_SEED, "");
final String countStr = (String) post.get("count", "0");
int i;
int count = 0;
try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (NumberFormatException e) {count = 0;}
@ -81,7 +81,7 @@ public final class hello {
final yacySeed remoteSeed = yacySeed.genRemoteSeed(seed, key);
// System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString()));
if (remoteSeed == null) { return new serverObjects(); }
if (remoteSeed == null) { return null; }
// we easily know the caller's IP:
final String clientip = (String) header.get("CLIENTIP", "<unknown>"); // read an artificial header addendum

@ -57,18 +57,21 @@ import de.anomic.server.serverSwitch;
public final class list {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
if (post == null || ss == null ) { return null; }
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
if (prop == null) { return null; }
final String col = (String) post.get("col", "");
final File listsPath = new File(env.getRootPath(),env.getConfig("listsPath", "DATA/LISTS"));
final File listsPath = new File(ss.getRootPath(),ss.getConfig("listsPath", "DATA/LISTS"));
if (col.equals("black")) {
String filename = "";
final StringBuffer out = new StringBuffer();
final String filenames=env.getConfig("proxyBlackListsShared", "");
final String filenames=ss.getConfig("proxyBlackListsShared", "");
final String[] filenamesarray = filenames.split(",");
if(filenamesarray.length >0){
@ -76,7 +79,7 @@ public final class list {
filename = filenamesarray[i];
out.append(listManager.getListString(new File(listsPath,filename).toString(), false)).append(serverCore.crlfString);
}
} // if filenamesarray.length >0
} // if filenamesarray.length > 0
prop.put("list",out);
} else {

@ -69,12 +69,12 @@ public final class message {
}
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
if (post == null || ss == null) { return new serverObjects(); }
if (post == null || ss == null) { return null; }
// return variable that accumulates replacements
plasmaSwitchboard sb = (plasmaSwitchboard) ss;
serverObjects prop = new serverObjects();
if (prop == null || sb == null) { return new serverObjects(); }
if (prop == null || sb == null) { return null; }
// System.out.println("yacy/message:post=" + post.toString());

@ -64,7 +64,7 @@ public final class profile {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
// return variable that accumulates replacements
serverObjects prop = new serverObjects();
if (prop == null) { return new serverObjects(); }
if (prop == null) { return null; }
Properties profile = new Properties();
int count=0;

@ -57,12 +57,12 @@ import de.anomic.yacy.yacyCore;
public final class query {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
if (post == null || ss == null) { return new serverObjects(); }
if (post == null || ss == null) { return null; }
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
if (prop == null || sb == null) { return new serverObjects(); }
final serverObjects prop = new serverObjects();
if (prop == null || sb == null) { return null; }
// System.out.println("YACYQUERY: RECEIVED POST = " + ((post == null) ? "NULL" : post.toString()));

@ -59,12 +59,12 @@ import de.anomic.yacy.yacySeed;
public final class search {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
if (post == null || ss == null) { return new serverObjects(); }
if (post == null || ss == null) { return null; }
// return variable that accumulates replacements
final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
serverObjects prop = new serverObjects();
if (prop == null || sb == null) { return new serverObjects(); }
if (prop == null || sb == null) { return null; }
//System.out.println("yacy: search received request = " + post.toString());
@ -75,9 +75,9 @@ public final class search {
// final String fwdep = (String) post.get("fwdep", ""); // forward depth. if "0" then peer may NOT ask another peer for more results
// final String fwden = (String) post.get("fwden", ""); // forward deny, a list of seed hashes. They may NOT be target of forward hopping
final long duetime= Long.parseLong((String) post.get("duetime", "3000"));
final int count = Integer.parseInt((String) post.get("count", "10")); // maximum number of wanted results
final int count = Integer.parseInt((String) post.get("count", "10")); // maximum number of wanted results
final boolean global = ((String) post.get("resource", "global")).equals("global"); // if true, then result may consist of answers from other peers
// Date remoteTime = yacyCore.parseUniversalDate((String) post.get("mytime")); // read remote time
// Date remoteTime = yacyCore.parseUniversalDate((String) post.get("mytime")); // read remote time
if (yacyCore.seedDB == null) {
yacyCore.log.logSevere("yacy.search: seed cache not initialized");
} else {
@ -95,7 +95,7 @@ public final class search {
final int links = Integer.parseInt(prop.get("linkcount","0"));
yacyCore.seedDB.mySeed.incSI(links);
yacyCore.seedDB.mySeed.incSU(links);
return prop;
return prop;
}
}

@ -62,16 +62,16 @@ import de.anomic.yacy.yacyDHTAction;
public final class transferRWI {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
if (post == null || ss == null) { return new serverObjects(); }
if (post == null || ss == null) { return null; }
long start = System.currentTimeMillis();
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
// return variable that accumulates replacements
final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
if (prop == null || sb == null) { return new serverObjects(); }
// request values
final serverObjects prop = new serverObjects();
if (prop == null || sb == null) { return null; }
// request values
final String iam = (String) post.get("iam", ""); // seed hash of requester
// final String youare = (String) post.get("youare", ""); // seed hash of the target peer, needed for network stability
// final String key = (String) post.get("key", ""); // transmission key
@ -79,11 +79,11 @@ public final class transferRWI {
final int entryc = Integer.parseInt((String) post.get("entryc", "")); // number of entries in indexes
final byte[] indexes = ((String) post.get("indexes", "")).getBytes(); // the indexes, as list of word entries
final boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true");
// response values
String result = "";
StringBuffer unknownURLs = new StringBuffer();
final yacySeed otherPeer = yacyCore.seedDB.get(iam);
final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));
@ -91,7 +91,7 @@ public final class transferRWI {
// log value status (currently added to find outOfMemory error
sb.getLog().logFine("Processing " + indexes.length + " bytes / " + wordc + " words / " + entryc + " entries from " + otherPeerName);
final long startProcess = System.currentTimeMillis();
// decode request
ArrayList v = new ArrayList();
int s = 0;
@ -103,7 +103,7 @@ public final class transferRWI {
}
// the value-vector should now have the same length as entryc
if (v.size() != entryc) sb.getLog().logSevere("ERROR WITH ENTRY COUNTER: v=" + v.size() + ", entryc=" + entryc);
// now parse the Strings in the value-vector and write index entries
String estring;
int p;
@ -130,7 +130,7 @@ public final class transferRWI {
}
}
yacyCore.seedDB.mySeed.incRI(received);
// finally compose the unknownURL hash list
final Iterator it = unknownURL.iterator();
while (it.hasNext()) {
@ -148,12 +148,12 @@ public final class transferRWI {
sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted.");
result = "error_not_granted";
}
prop.put("unknownURL", unknownURLs.toString());
prop.put("result", result);
// return rewrite properties
return prop;
// return rewrite properties
return prop;
}
}
}

@ -56,13 +56,14 @@ import de.anomic.yacy.yacySeed;
public final class transferURL {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
if (post == null || ss == null) { return new serverObjects(); }
if (post == null || ss == null) { return null; }
long start = System.currentTimeMillis();
// return variable that accumulates replacements
final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
final serverObjects prop = new serverObjects();
if (prop == null || sb == null) { return new serverObjects(); }
if (prop == null || sb == null) { return null; }
// request values
final String iam = (String) post.get("iam", ""); // seed hash of requester

Loading…
Cancel
Save