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 final class hello {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { 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 // return variable that accumulates replacements
final serverObjects prop = new serverObjects(); 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 iam = (String) post.get("iam", ""); // complete seed of the requesting peer
// final String pattern = (String) post.get("pattern", ""); // // final String pattern = (String) post.get("pattern", ""); //
// final String mytime = (String) post.get(STR_MYTIME, ""); // // final String mytime = (String) post.get(STR_MYTIME, ""); //
final String key = (String) post.get("key", ""); // transmission key for response final String key = (String) post.get("key", ""); // transmission key for response
final String seed = (String) post.get(yacySeed.STR_SEED, ""); // final String seed = (String) post.get(yacySeed.STR_SEED, "");
final String countStr = (String) post.get("count", "0"); // final String countStr = (String) post.get("count", "0");
int i; int i;
int count = 0; int count = 0;
try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (NumberFormatException e) {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); final yacySeed remoteSeed = yacySeed.genRemoteSeed(seed, key);
// System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString())); // 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: // we easily know the caller's IP:
final String clientip = (String) header.get("CLIENTIP", "<unknown>"); // read an artificial header addendum 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 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 // return variable that accumulates replacements
final serverObjects prop = new serverObjects(); final serverObjects prop = new serverObjects();
if (prop == null) { return null; }
final String col = (String) post.get("col", ""); final String col = (String) post.get("col", "");
final File listsPath = new File(ss.getRootPath(),ss.getConfig("listsPath", "DATA/LISTS"));
final File listsPath = new File(env.getRootPath(),env.getConfig("listsPath", "DATA/LISTS"));
if (col.equals("black")) { if (col.equals("black")) {
String filename = ""; String filename = "";
final StringBuffer out = new StringBuffer(); final StringBuffer out = new StringBuffer();
final String filenames=env.getConfig("proxyBlackListsShared", ""); final String filenames=ss.getConfig("proxyBlackListsShared", "");
final String[] filenamesarray = filenames.split(","); final String[] filenamesarray = filenames.split(",");
if(filenamesarray.length >0){ if(filenamesarray.length >0){
@ -76,7 +79,7 @@ public final class list {
filename = filenamesarray[i]; filename = filenamesarray[i];
out.append(listManager.getListString(new File(listsPath,filename).toString(), false)).append(serverCore.crlfString); 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); prop.put("list",out);
} else { } else {

@ -69,12 +69,12 @@ public final class message {
} }
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { 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 // return variable that accumulates replacements
plasmaSwitchboard sb = (plasmaSwitchboard) ss; plasmaSwitchboard sb = (plasmaSwitchboard) ss;
serverObjects prop = new serverObjects(); 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()); // 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) { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) {
// return variable that accumulates replacements // return variable that accumulates replacements
serverObjects prop = new serverObjects(); serverObjects prop = new serverObjects();
if (prop == null) { return new serverObjects(); } if (prop == null) { return null; }
Properties profile = new Properties(); Properties profile = new Properties();
int count=0; int count=0;

@ -57,12 +57,12 @@ import de.anomic.yacy.yacyCore;
public final class query { public final class query {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { 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 // return variable that accumulates replacements
final serverObjects prop = new serverObjects();
final plasmaSwitchboard sb = (plasmaSwitchboard) ss; 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())); // 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 final class search {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { 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 // return variable that accumulates replacements
final plasmaSwitchboard sb = (plasmaSwitchboard) ss; final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
serverObjects prop = new serverObjects(); 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()); //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 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 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 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 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) { if (yacyCore.seedDB == null) {
yacyCore.log.logSevere("yacy.search: seed cache not initialized"); yacyCore.log.logSevere("yacy.search: seed cache not initialized");
} else { } else {
@ -95,7 +95,7 @@ public final class search {
final int links = Integer.parseInt(prop.get("linkcount","0")); final int links = Integer.parseInt(prop.get("linkcount","0"));
yacyCore.seedDB.mySeed.incSI(links); yacyCore.seedDB.mySeed.incSI(links);
yacyCore.seedDB.mySeed.incSU(links); yacyCore.seedDB.mySeed.incSU(links);
return prop; return prop;
} }
} }

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

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

Loading…
Cancel
Save