Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Correct usage of vhost in wget/wput requests: - yacyClient: don't use own .yacyh domain in requests, instead use .yacyh domain of target peer for everything but ranking distribution - natLib: use full hostname instead of just SLD.TLD

hermensd4645062bcad
diff --git a/source/de/anomic/net/natLib.java b/source/de/anomic/net/natLib.java
index 470ff3eb7..023d18039 100644
--- a/source/de/anomic/net/natLib.java
+++ b/source/de/anomic/net/natLib.java
@@ -72,7 +72,7 @@ public class natLib {
private static String getWhatIsMyIP() {
try {
- ArrayList x = httpc.wget(new URL("http://www.whatismyip.com/"), "whatsmyip.com", 5000, null, null, null);
+ ArrayList x = httpc.wget(new URL("http://www.whatismyip.com/"), "www.whatsmyip.com", 5000, null, null, null);
x = nxTools.grep(x, 0, "Your IP is");
String line = nxTools.tail1(x);
return nxTools.awk(line, " ", 4);
@@ -83,7 +83,7 @@ public class natLib {
private static String getStanford() {
try {
- ArrayList x = httpc.wget(new URL("http://www.slac.stanford.edu/cgi-bin/nph-traceroute.pl"), "stanford.edu", 5000, null, null, null);
+ ArrayList x = httpc.wget(new URL("http://www.slac.stanford.edu/cgi-bin/nph-traceroute.pl"), "www.slac.stanford.edu", 5000, null, null, null);
x = nxTools.grep(x, 0, "firewall protecting your browser");
String line = nxTools.tail1(x);
return nxTools.awk(line, " ", 7);
@@ -94,7 +94,7 @@ public class natLib {
private static String getIPID() {
try {
- ArrayList x = httpc.wget(new URL("http://ipid.shat.net/"), "shat.net", 5000, null, null, null);
+ ArrayList x = httpc.wget(new URL("http://ipid.shat.net/"), "ipid.shat.net", 5000, null, null, null);
x = nxTools.grep(x, 2, "Your IP address");
String line = nxTools.tail1(x);
return nxTools.awk(nxTools.awk(nxTools.awk(line, " ", 5), ">", 2), "<", 1);
diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java
index 182f73188..979e5283c 100644
--- a/source/de/anomic/yacy/yacyClient.java
+++ b/source/de/anomic/yacy/yacyClient.java
@@ -127,7 +127,7 @@ public final class yacyClient {
// sending request
result = nxTools.table(
httpc.wput(url,
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ yacySeed.b64Hash2hexHash(otherHash) + ".yacyh",
105000,
null,
null,
@@ -260,7 +260,7 @@ public final class yacyClient {
"&object=seed" +
"&env=" + seedHash
),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ target.getHexHash() + ".yacyh",
10000,
null,
null,
@@ -297,7 +297,7 @@ public final class yacyClient {
"&env=" + wordHash +
"&ttl=0"
),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ target.getHexHash() + ".yacyh",
10000,
null,
null,
@@ -338,7 +338,7 @@ public final class yacyClient {
final HashMap result = nxTools.table(
httpc.wget(
new URL(querystr),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ target.getHexHash() + ".yacyh",
6000,
null,
null,
@@ -429,7 +429,7 @@ public final class yacyClient {
final HashMap result = nxTools.table(
httpc.wput(
new URL(url),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ targetPeer.getHexHash() + ".yacyh",
300000,
null,
null,
@@ -564,7 +564,7 @@ public final class yacyClient {
return nxTools.table(
httpc.wput(
new URL("http://" + address + "/yacy/message.html"),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ yacySeed.b64Hash2hexHash(targetHash) + ".yacyh",
8000,
null,
null,
@@ -609,7 +609,7 @@ public final class yacyClient {
try {
final ArrayList v = httpc.wput(
new URL("http://" + address + "/yacy/message.html"),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ yacySeed.b64Hash2hexHash(targetHash) + ".yacyh",
20000,
null,
null,
@@ -660,10 +660,11 @@ public final class yacyClient {
// send request
try {
+ final URL url = new URL("http://" + targetAddress + "/yacy/transfer.html");
return nxTools.table(
httpc.wput(
- new URL("http://" + targetAddress + "/yacy/transfer.html"),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ url,
+ url.getHost(), // yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
8000,
null,
null,
@@ -702,9 +703,10 @@ public final class yacyClient {
// sending request
try {
+ final URL url = new URL("http://" + targetAddress + "/yacy/transfer.html");
final ArrayList v = httpc.wput(
- new URL("http://" + targetAddress + "/yacy/transfer.html"),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ url,
+ url.getHost(), // yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
20000,
null,
null,
@@ -789,7 +791,7 @@ public final class yacyClient {
return nxTools.table(
httpc.wput(
new URL("http://" + address + "/yacy/crawlOrder.html"),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ targetSeed.getHexHash() + ".yacyh",
timeout,
null,
null,
@@ -864,7 +866,7 @@ public final class yacyClient {
"&wordh=" + wordhashes +
"&lurlEntry=" + ((entry == null) ? "" : crypt.simpleEncode(entry.toString(), key))
),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ targetSeed.getHexHash() + ".yacyh",
60000,
null,
null,
@@ -1019,7 +1021,7 @@ public final class yacyClient {
try {
final ArrayList v = httpc.wput(
new URL("http://" + address + "/yacy/transferRWI.html"),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ targetSeed.getHexHash() + ".yacyh",
timeout,
null,
null,
@@ -1081,7 +1083,7 @@ public final class yacyClient {
try {
final ArrayList v = httpc.wput(
new URL("http://" + address + "/yacy/transferURL.html"),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ targetSeed.getHexHash() + ".yacyh",
timeout,
null,
null,
@@ -1099,7 +1101,7 @@ public final class yacyClient {
result.put("urlPayloadSize", new Integer(urlPayloadSize));
return result;
} catch (Exception e) {
- yacyCore.log.logSevere("yacyClient.transferRWI error:" + e.getMessage());
+ yacyCore.log.logSevere("yacyClient.transferURL error:" + e.getMessage());
return null;
}
}
@@ -1120,7 +1122,7 @@ public final class yacyClient {
try {
final ArrayList v = httpc.wput(
new URL("http://" + address + "/yacy/profile.html"),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ targetSeed.getHexHash() + ".yacyh",
10000,
null,
null,
@@ -1160,7 +1162,7 @@ public final class yacyClient {
"&count=10" +
"&resource=global" +
"&query=" + wordhashe),
- yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
+ target.getHexHash() + ".yacyh",
5000,
null,
null,