mirror of
https://github.com/torproject/collector.git
synced 2024-11-30 12:50:27 +00:00
Don't fail if extra-info descriptors are missing.
This commit is contained in:
parent
1732539892
commit
77bfec0122
@ -10,20 +10,28 @@ public class ExtraInfoDownloader {
|
||||
+ authority + "... ");
|
||||
Stack<String> extraInfos = new Stack<String>();
|
||||
for (String fingerprint : directories.keySet()) {
|
||||
BufferedInputStream in = new BufferedInputStream(new URL(
|
||||
"http://" + authority + "/tor/extra/fp/" + fingerprint).
|
||||
openStream());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int len;
|
||||
byte[] data = new byte[1024];
|
||||
while ((len = in.read(data, 0, 1024)) >= 0) {
|
||||
sb.append(new String(data, 0, len));
|
||||
}
|
||||
in.close();
|
||||
String extraInfo = sb.toString();
|
||||
if (extraInfo.length() > 0) {
|
||||
BufferedReader br = new BufferedReader(new StringReader(extraInfo));
|
||||
rdp.parse(br);
|
||||
URL u = new URL("http://" + authority + "/tor/extra/fp/"
|
||||
+ fingerprint);
|
||||
HttpURLConnection huc = (HttpURLConnection) u.openConnection();
|
||||
huc.setRequestMethod("GET");
|
||||
huc.connect();
|
||||
int response = huc.getResponseCode();
|
||||
if (response == 200) {
|
||||
BufferedInputStream in = new BufferedInputStream(
|
||||
huc.getInputStream());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int len;
|
||||
byte[] data = new byte[1024];
|
||||
while ((len = in.read(data, 0, 1024)) >= 0) {
|
||||
sb.append(new String(data, 0, len));
|
||||
}
|
||||
in.close();
|
||||
String extraInfo = sb.toString();
|
||||
if (extraInfo.length() > 0) {
|
||||
BufferedReader br = new BufferedReader(
|
||||
new StringReader(extraInfo));
|
||||
rdp.parse(br);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("done");
|
||||
|
Loading…
Reference in New Issue
Block a user