Browse code

Fix a date bug.

Jacob Appelbaum authored on28/06/2008 08:58:47
Showing1 changed files
... ...
@@ -41,8 +41,10 @@ sub FetchDate {
41 41
 
42 42
     my $request = new HTTP::Request GET => "$url";
43 43
     my $result = $lua->request($request);
44
+    my $code = $result->code();
45
+    print "Result code $code\n";
44 46
 
45
-    if ($result->is_success){
47
+    if ($result->is_success && $code eq "200"){
46 48
        my $taint = $result->content;
47 49
        my $content = sanitize($taint);
48 50
        if ($content) {
... ...
@@ -66,6 +68,8 @@ sub FetchDate {
66 68
        print "Our request failed, we had no result.\n";
67 69
        return "Unknown";
68 70
     }
71
+
72
+    return "Unknown";
69 73
 }
70 74
 
71 75
 # This is the list of all known Tor mirrors
... ...
@@ -83,7 +87,7 @@ my %m = (
83 87
             rsyncWebsiteMirror => "rsync://tor.cypherpunks.at/tor",
84 88
             httpDistMirror => "http://tor.cypherpunks.at/dist/",
85 89
             rsyncDistMirror => "rsync: tor.cypherpunks.at::tor/dist/",
86
-            updateDate => "",
90
+            updateDate => "Unknown",
87 91
         },
88 92
 
89 93
        mirror001 => {
... ...
@@ -99,7 +103,7 @@ my %m = (
99 103
             rsyncWebsiteMirror => "",
100 104
             httpDistMirror => "http://tor.depthstrike.com/dist/",
101 105
             rsyncDistMirror => "",
102
-            updateDate => "",
106
+            updateDate => "Unknown",
103 107
         },
104 108
 
105 109
        mirror002 => {
... ...
@@ -114,7 +118,7 @@ my %m = (
114 118
             rsyncWebsiteMirror => "",
115 119
             httpDistMirror => "http://tor.hermetix.org/dist/",
116 120
             rsyncDistMirror => "",
117
-            updateDate => "",
121
+            updateDate => "Unknown",
118 122
         },
119 123
 
120 124
        mirror003 => {
... ...
@@ -130,7 +134,7 @@ my %m = (
130 134
             rsyncWebsiteMirror => "",
131 135
             httpDistMirror => "http://tor.boinc.ch/dist/",
132 136
             rsyncDistMirror => "",
133
-            updateDate => "",
137
+            updateDate => "Unknown",
134 138
         },
135 139
 
136 140
        mirror004 => {
... ...
@@ -146,7 +150,7 @@ my %m = (
146 150
             rsyncWebsiteMirror => "",
147 151
             httpDistMirror => "http://tor.anonymity.cn/dist/",
148 152
             rsyncDistMirror => "",
149
-            updateDate => "",
153
+            updateDate => "Unknown",
150 154
         },
151 155
 
152 156
        mirror004 => {
... ...
@@ -162,7 +166,7 @@ my %m = (
162 166
             rsyncWebsiteMirror => "",
163 167
             httpDistMirror => "http://tor.blingblingsquad.net/dist/",
164 168
             rsyncDistMirror => "",
165
-            updateDate => "",
169
+            updateDate => "Unknown",
166 170
         },
167 171
 
168 172
        mirror005 => {
... ...
@@ -178,7 +182,7 @@ my %m = (
178 182
             rsyncWebsiteMirror => "",
179 183
             httpDistMirror => "",
180 184
             rsyncDistMirror => "",
181
-            updateDate => "",
185
+            updateDate => "Unknown",
182 186
         },
183 187
 
184 188
        mirror006 => {
... ...
@@ -194,7 +198,7 @@ my %m = (
194 198
             rsyncWebsiteMirror => "",
195 199
             httpDistMirror => "http://tor.cybermirror.org/dist/",
196 200
             rsyncDistMirror => "",
197
-            updateDate => "",
201
+            updateDate => "Unknown",
198 202
         },
199 203
 
200 204
        mirror007 => {
... ...
@@ -210,7 +214,7 @@ my %m = (
210 214
             rsyncWebsiteMirror => "",
211 215
             httpDistMirror => "",
212 216
             rsyncDistMirror => "",
213
-            updateDate => "",
217
+            updateDate => "Unknown",
214 218
         },
215 219
 
216 220
        mirror008 => {
... ...
@@ -226,7 +230,7 @@ my %m = (
226 230
             rsyncWebsiteMirror => "",
227 231
             httpDistMirror => "http://mirror.bsdhost.eu/www.torproject.org/dist/",
228 232
             rsyncDistMirror => "",
229
-            updateDate => "",
233
+            updateDate => "Unknown",
230 234
         },
231 235
 
232 236
        mirror009 => {
... ...
@@ -242,7 +246,7 @@ my %m = (
242 246
             rsyncWebsiteMirror => "rsync: mirror.onionland.org::tor/",
243 247
             httpDistMirror => "http://mirror.onionland.org/dist/",
244 248
             rsyncDistMirror => "rsync: mirror.onionland.org::tor/dist/",
245
-            updateDate => "",
249
+            updateDate => "Unknown",
246 250
         },
247 251
 
248 252
        mirror010 => {
... ...
@@ -259,7 +263,7 @@ my %m = (
259 263
             rsyncWebsiteMirror => "",
260 264
             httpDistMirror => "http://tor.plentyfact.net/dist/",
261 265
             rsyncDistMirror => "",
262
-            updateDate => "",
266
+            updateDate => "Unknown",
263 267
         },
264 268
 
265 269
        mirror011 => {
... ...
@@ -275,7 +279,7 @@ my %m = (
275 279
             rsyncWebsiteMirror => "",
276 280
             httpDistMirror => "http://tor-anonymizer.mirror.loxal.net/dist/",
277 281
             rsyncDistMirror => "",
278
-            updateDate => "",
282
+            updateDate => "Unknown",
279 283
         },
280 284
 
281 285
        mirror012 => {
... ...
@@ -291,7 +295,7 @@ my %m = (
291 295
             rsyncWebsiteMirror => "",
292 296
             httpDistMirror => "http://www.centervenus.com/mirrors/tor/dist/",
293 297
             rsyncDistMirror => "",
294
-            updateDate => "",
298
+            updateDate => "Unknown",
295 299
         },
296 300
 
297 301
        mirror013 => {
... ...
@@ -307,7 +311,7 @@ my %m = (
307 311
             rsyncWebsiteMirror => "", 
308 312
             httpDistMirror => "http://tor.zdg-gmbh.eu/dist/",
309 313
             rsyncDistMirror => "",
310
-            updateDate => "",
314
+            updateDate => "Unknown",
311 315
         },
312 316
 
313 317
        mirror014 => {
... ...
@@ -323,7 +327,7 @@ my %m = (
323 327
             ftpWebsiteMirror => "ftp://miroir-francais.fr/pub/tor/",
324 328
             httpDistMirror => "",
325 329
             rsyncDistMirror => "",
326
-            updateDate => "",
330
+            updateDate => "Unknown",
327 331
         },
328 332
 
329 333
        mirror015 => {
... ...
@@ -339,7 +343,7 @@ my %m = (
339 343
             ftpWebsiteMirror => "",
340 344
             httpDistMirror => "",
341 345
             rsyncDistMirror => "",
342
-            updateDate => "",
346
+            updateDate => "Unknown",
343 347
         },
344 348
 
345 349
        mirror016 => {
... ...
@@ -355,7 +359,7 @@ my %m = (
355 359
             ftpWebsiteMirror => "",
356 360
             httpDistMirror => "http://tor.amorphis.eu/dist/",
357 361
             rsyncDistMirror => "",
358
-            updateDate => "",
362
+            updateDate => "Unknown",
359 363
         },
360 364
 
361 365
        mirror017 => {
... ...
@@ -371,7 +375,7 @@ my %m = (
371 375
             ftpWebsiteMirror => "ftp://ftp.bit.nl/mirror/tor/",
372 376
             httpDistMirror => "",
373 377
             rsyncDistMirror => "",
374
-            updateDate => "",
378
+            updateDate => "Unknown",
375 379
         },
376 380
 
377 381
        mirror018 => {
... ...
@@ -387,7 +391,7 @@ my %m = (
387 391
             ftpWebsiteMirror => "",
388 392
             httpDistMirror => "http://tor.ccc.de/dist/",
389 393
             rsyncDistMirror => "",
390
-            updateDate => "",
394
+            updateDate => "Unknown",
391 395
         },
392 396
 
393 397
        mirror018 => {
... ...
@@ -403,7 +407,7 @@ my %m = (
403 407
             ftpWebsiteMirror => "",
404 408
             httpDistMirror => "http://tor.kamagurka.org/dist/",
405 409
             rsyncDistMirror => "",
406
-            updateDate => "",
410
+            updateDate => "Unknown",
407 411
         },
408 412
 
409 413
        mirror019 => {
... ...
@@ -419,7 +423,7 @@ my %m = (
419 423
             ftpWebsiteMirror => "ftp://ftp.osmirror.nl/pub/tor/",
420 424
             httpDistMirror => "",
421 425
             rsyncDistMirror => "",
422
-            updateDate => "",
426
+            updateDate => "Unknown",
423 427
         },
424 428
 
425 429
 
... ...
@@ -436,7 +440,7 @@ my %m = (
436 440
             ftpWebsiteMirror => "",
437 441
             httpDistMirror => "",
438 442
             rsyncDistMirror => "",
439
-            updateDate => "",
443
+            updateDate => "Unknown",
440 444
         },
441 445
 
442 446
        mirror021 => {
... ...
@@ -452,7 +456,7 @@ my %m = (
452 456
             ftpWebsiteMirror => "ftp://ftp.se.linux.org/pub/crypto/tor/",
453 457
             httpDistMirror => "",
454 458
             rsyncDistMirror => "",
455
-            updateDate => "",
459
+            updateDate => "Unknown",
456 460
         },
457 461
 
458 462
        mirror022 => {
... ...
@@ -468,7 +472,7 @@ my %m = (
468 472
             ftpWebsiteMirror => "",
469 473
             httpDistMirror => "",
470 474
             rsyncDistMirror => "",
471
-            updateDate => "",
475
+            updateDate => "Unknown",
472 476
         },
473 477
 
474 478
        mirror023 => {
... ...
@@ -484,7 +488,7 @@ my %m = (
484 488
             ftpWebsiteMirror => "",
485 489
             httpDistMirror => "",
486 490
             rsyncDistMirror => "",
487
-            updateDate => "",
491
+            updateDate => "Unknown",
488 492
         },
489 493
 
490 494
        mirror024 => {
... ...
@@ -500,7 +504,7 @@ my %m = (
500 504
             ftpWebsiteMirror => "ftp://libertarianactivism.com/tor.eff.org/dist/",
501 505
             httpDistMirror => "",
502 506
             rsyncDistMirror => "",
503
-            updateDate => "",
507
+            updateDate => "Unknown",
504 508
         },
505 509
 
506 510
        mirror025 => {
... ...
@@ -516,7 +520,7 @@ my %m = (
516 520
             ftpWebsiteMirror => "",
517 521
             httpDistMirror => "http://www.theonionrouter.com/dist/",
518 522
             rsyncDistMirror => "",
519
-            updateDate => "",
523
+            updateDate => "Unknown",
520 524
         },
521 525
 
522 526
        mirror026 => {
... ...
@@ -532,7 +536,7 @@ my %m = (
532 536
             ftpWebsiteMirror => "",
533 537
             httpDistMirror => "",
534 538
             rsyncDistMirror => "",
535
-            updateDate => "",
539
+            updateDate => "Unknown",
536 540
         },
537 541
 
538 542
        mirror027 => {
... ...
@@ -549,7 +553,7 @@ my %m = (
549 553
             ftpWebsiteMirror => "",
550 554
             httpDistMirror => "",
551 555
             rsyncDistMirror => "",
552
-            updateDate => "",
556
+            updateDate => "Unknown",
553 557
         },
554 558
 
555 559
        mirror028 => {
... ...
@@ -566,7 +570,7 @@ my %m = (
566 570
             ftpWebsiteMirror => "",
567 571
             httpDistMirror => "",
568 572
             rsyncDistMirror => "",
569
-            updateDate => "",
573
+            updateDate => "Unknown",
570 574
         },
571 575
 );
572 576