diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java index 3bb13d927..e1ee1f0cd 100644 --- a/htroot/yacy/hello.java +++ b/htroot/yacy/hello.java @@ -65,6 +65,9 @@ import de.anomic.yacy.yacyVersion; public final class hello { + // example: + // http://localhost:8080/yacy/hello.html?count=1&seed=p|{Hash=sCJ6Tq8T0N9x,IPType=∅,Port=8080,IP=,Uptime=8,rI=190,Version=0.10004882,PeerType=junior,UTC=+0200,RCount=0,sI=0,LastSeen=20080605103333,Name=intratest,CCount=5.0,SCount=40,news=,USpeed=0,CRTCnt=0,CRWCnt=0,BDate=20080605081349,rU=190,LCount=187,dct=1212668923654,ICount=2,sU=0,ISpeed=0,RSpeed=0.0,NCount=0,Flags=oooo} + public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) throws InterruptedException { plasmaSwitchboard sb = (plasmaSwitchboard) env; serverObjects prop = new serverObjects(); @@ -98,8 +101,7 @@ public final class hello { return prop; } final yacySeed remoteSeed = yacySeed.genRemoteSeed(seed, key, true); - remoteSeed.setIP(ias.toString()); - + // System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString())); if ((remoteSeed == null) || (remoteSeed.hash == null)) { prop.put("message", "cannot parse your seed"); @@ -136,7 +138,8 @@ public final class hello { remoteSeed.setIP(reportedip); urls = yacyClient.queryUrlCount(remoteSeed); } else { - prop.put("yourip", "unknown"); + prop.put("yourip", (ias == null) ? "" : ias.getHostAddress()); + remoteSeed.setIP((ias == null) ? "" : ias.getHostAddress()); } // if the previous attempt (using the reported ip address) was not successful, try the ip where diff --git a/htroot/yacy/query.java b/htroot/yacy/query.java index ecb699705..c07e23b33 100644 --- a/htroot/yacy/query.java +++ b/htroot/yacy/query.java @@ -55,15 +55,19 @@ import de.anomic.yacy.yacyNetwork; public final class query { + // example: + // http://localhost:8080/yacy/query.html?youare=sCJ6Tq8T0N9x&object=lurlcount + public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { if (post == null || ss == null) { return null; } // return variable that accumulates replacements final plasmaSwitchboard sb = (plasmaSwitchboard) ss; final serverObjects prop = new serverObjects(); - if ((post == null) || (ss == null)) return prop; - if (!yacyNetwork.authentifyRequest(post, ss)) return prop; - + if ((post == null) || (ss == null) || !yacyNetwork.authentifyRequest(post, ss)) { + prop.put("response", "-1"); // request rejected + return prop; + } if ((sb.isRobinsonMode()) && (!sb.isPublicRobinson()) && diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 9120cbc96..d2d75a10b 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -2706,7 +2706,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch