orbiter 19 years ago
parent 29a0fd064f
commit fb7902aa68

@ -1433,7 +1433,7 @@ do upload
} }
} }
public static ArrayList wput( public static byte[] wput(
URL url, URL url,
String vhost, String vhost,
int timeout, int timeout,
@ -1455,16 +1455,16 @@ do upload
files 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)); //System.out.println("wput-out=" + new String(a));
int s = 0; //return nxTools.strings(a);
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;
} }
public static void main(String[] args) { public static void main(String[] args) {

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

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

Loading…
Cancel
Save