orbiter 19 years ago
parent 29a0fd064f
commit fb7902aa68

@ -1433,7 +1433,7 @@ do upload
}
}
public static ArrayList wput(
public static byte[] wput(
URL url,
String vhost,
int timeout,
@ -1455,16 +1455,16 @@ do upload
files
);
if (a == null) return null;
// support of gzipped data
a = serverFileUtils.uncompressGZipArray(a);
// return result
return a;
//System.out.println("wput-out=" + new String(a));
int s = 0;
int e;
ArrayList v = new ArrayList();
while (s < a.length) {
e = s; while (e < a.length) if (a[e++] < 32) {e--; break;}
v.add(new String(a, s, e - s));
s = e; while (s < a.length) if (a[s++] >= 32) {s--; break;}
}
return v;
//return nxTools.strings(a);
}
public static void main(String[] args) {

@ -72,6 +72,7 @@ public class nxTools {
}
public static HashMap table(ArrayList list) {
if (list == null) return new HashMap();
Iterator i = list.iterator();
int pos;
String line;
@ -154,6 +155,7 @@ public class nxTools {
}
public static ArrayList strings(byte[] a, String encoding) {
if (a == null) return new ArrayList();
int s = 0;
int e;
ArrayList v = new ArrayList();

@ -140,7 +140,7 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
obj,
null
)
), "UTF-8"
);
} catch (Exception e) {
if (Thread.currentThread().isInterrupted()) {
@ -457,7 +457,7 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
obj,
null
)
), "UTF-8"
);
} catch (IOException e) {
yacyCore.log.logFine("SEARCH failed FROM " + targetPeer.hash + ":" + targetPeer.getName() + " (" + e.getMessage() + "), score=" + targetPeer.selectscore + ", DHTdist=" + yacyDHTAction.dhtDistance(targetPeer.hash, wordhashes));
@ -636,7 +636,7 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
post,
null
)
), "UTF-8"
);
} catch (Exception e) {
// most probably a network time-out exception
@ -672,7 +672,8 @@ public final class yacyClient {
// sending request
try {
final ArrayList v = httpc.wput(
return nxTools.table(
httpc.wput(
new URL("http://" + address + "/yacy/message.html"),
yacySeed.b64Hash2hexHash(targetHash) + ".yacyh",
20000,
@ -681,9 +682,7 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
post,
null
);
return nxTools.table(v);
), "UTF-8");
} catch (Exception e) {
yacyCore.log.logSevere("yacyClient.postMessage error:" + e.getMessage());
return null;
@ -736,7 +735,7 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
post,
null
)
), "UTF-8"
);
} catch (Exception e) {
// most probably a network time-out exception
@ -769,7 +768,8 @@ public final class yacyClient {
// sending request
try {
final URL url = new URL("http://" + targetAddress + "/yacy/transfer.html");
final ArrayList v = httpc.wput(
return nxTools.table(
httpc.wput(
url,
url.getHost(), // yacyCore.seedDB.mySeed.getHexHash() + ".yacyh",
20000,
@ -778,9 +778,7 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
post,
files
);
return nxTools.table(v);
), "UTF-8");
} catch (Exception e) {
yacyCore.log.logSevere("yacyClient.postMessage error:" + e.getMessage());
return null;
@ -863,7 +861,7 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
post,
null
)
), "UTF-8"
);
} catch (Exception e) {
// most probably a network time-out exception
@ -1084,7 +1082,8 @@ public final class yacyClient {
post.put("entryc", Integer.toString(indexcount));
post.put("indexes", entrypost.toString());
try {
final ArrayList v = httpc.wput(
final ArrayList v = nxTools.strings(
httpc.wput(
new URL("http://" + address + "/yacy/transferRWI.html"),
targetSeed.getHexHash() + ".yacyh",
timeout,
@ -1093,9 +1092,9 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
post,
null
);
), "UTF-8");
// this should return a list of urlhashes that are unknwon
if (v != null) {
if ((v != null) && (v.size() > 0)) {
yacyCore.seedDB.mySeed.incSI(indexcount);
}
@ -1146,7 +1145,8 @@ public final class yacyClient {
}
post.put("urlc", Integer.toString(urlc));
try {
final ArrayList v = httpc.wput(
final ArrayList v = nxTools.strings(
httpc.wput(
new URL("http://" + address + "/yacy/transferURL.html"),
targetSeed.getHexHash() + ".yacyh",
timeout,
@ -1155,9 +1155,9 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
post,
null
);
), "UTF-8");
if (v != null) {
if ((v != null) && (v.size() > 0)) {
yacyCore.seedDB.mySeed.incSU(urlc);
}
@ -1185,7 +1185,8 @@ public final class yacyClient {
String address = targetSeed.getAddress();
if (address == null) { address = "localhost:8080"; }
try {
final ArrayList v = httpc.wput(
return nxTools.table(
httpc.wput(
new URL("http://" + address + "/yacy/profile.html"),
targetSeed.getHexHash() + ".yacyh",
10000,
@ -1194,9 +1195,7 @@ public final class yacyClient {
(useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,
post,
null
);
return nxTools.table(v);
), "UTF-8");
} catch (Exception e) {
yacyCore.log.logSevere("yacyClient.getProfile error:" + e.getMessage());
return null;

Loading…
Cancel
Save