From nextgens at freenetproject.org Sun Apr 1 00:06:35 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Sun, 1 Apr 2007 00:06:35 +0000 (UTC)
Subject: [freenet-cvs] r12503 - trunk/freenet/src/freenet/l10n
Message-ID: <20070401000635.DC983479F65@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-01 00:06:35 +0000 (Sun, 01 Apr 2007)
New Revision: 12503
Modified:
trunk/freenet/src/freenet/l10n/freenet.l10n.fr.properties
Log:
Doh... We want translations to be in UTF-8!
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.fr.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.fr.properties 2007-03-31 23:55:58 UTC (rev 12502)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.fr.properties 2007-04-01 00:06:35 UTC (rev 12503)
@@ -1,13 +1,13 @@
testing.test=testfr$(test1)testfr$(test2)testfr
QueueToadlet.emergency=urgence
-QueueToadlet.veryhigh=tr?s haute
+QueueToadlet.veryhigh=tr??s haute
QueueToadlet.high=haute
QueueToadlet.medium=normale
QueueToadlet.low=basse
-QueueToadlet.verylow=tr?s basse
+QueueToadlet.verylow=tr??s basse
QueueToadlet.willneverfinish=ne finira jamais
-QueueToadlet.failedToRemoveRequest=Impossible d'annuler cette t?che
-QueueToadlet.failedToRemove=Impossible d'annuler cette t?che: $(id): $(message)
-QueueToadlet.failedToRestartRequest=Impossible de relancer cette t?che
-QueueToadlet.failedToRestart=Impossible d'annuler la t?che: $(id)
+QueueToadlet.failedToRemoveRequest=Impossible d'annuler cette t??che
+QueueToadlet.failedToRemove=Impossible d'annuler cette t??che: $(id): $(message)
+QueueToadlet.failedToRestartRequest=Impossible de relancer cette t??che
+QueueToadlet.failedToRestart=Impossible d'annuler la t??che: $(id)
QueueToadlet.failedToRemoveId=Impossible d'annuler: $(id)
\ No newline at end of file
From nextgens at freenetproject.org Sun Apr 1 00:20:30 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Sun, 1 Apr 2007 00:20:30 +0000 (UTC)
Subject: [freenet-cvs] r12504 - trunk/apps
Message-ID: <20070401002030.01E5747974F@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-01 00:20:29 +0000 (Sun, 01 Apr 2007)
New Revision: 12504
Added:
trunk/apps/perlFreenet/
Log:
Create a new directory to host a FCPv2 library written in perl. alexlehm will work on it
From alexlehm at freenetproject.org Sun Apr 1 00:50:14 2007
From: alexlehm at freenetproject.org (alexlehm at freenetproject.org)
Date: Sun, 1 Apr 2007 00:50:14 +0000 (UTC)
Subject: [freenet-cvs] r12505 - in trunk/apps/perlFreenet: . Freenet
Message-ID: <20070401005014.EF5C047972E@emu.freenetproject.org>
Author: alexlehm
Date: 2007-04-01 00:50:14 +0000 (Sun, 01 Apr 2007)
New Revision: 12505
Added:
trunk/apps/perlFreenet/Freenet/
trunk/apps/perlFreenet/Freenet/Connection.pm
trunk/apps/perlFreenet/Freenet/Message.pm
trunk/apps/perlFreenet/README
trunk/apps/perlFreenet/perlfn.pl
trunk/apps/perlFreenet/putcomplexdir.pl
Log:
initial commit, added README
Added: trunk/apps/perlFreenet/Freenet/Connection.pm
===================================================================
--- trunk/apps/perlFreenet/Freenet/Connection.pm (rev 0)
+++ trunk/apps/perlFreenet/Freenet/Connection.pm 2007-04-01 00:50:14 UTC (rev 12505)
@@ -0,0 +1,196 @@
+package Freenet::Connection;
+
+use Freenet::Message;
+use IO::socket::INET;
+
+sub new {
+ my $class = shift;
+ my $self = {};
+ bless $self, $class;
+ $self->initialize(@_);
+ return $self;
+}
+
+# we expect a hash with options, right now we only use Node
+# and Client
+#
+# you can use a string with the node hostname
+# or nothing at all
+# Node defaults to hostname:9481
+# or to localhost:9481 if nothing is given.
+# Client name defaults to perlfn, but please choose a sensible name
+# since you can only connect with each client name once
+
+sub initialize
+{
+ my $self = shift;
+ my $options = shift;
+
+ my $node;
+ my $socket;
+ my $clientname;
+ my $debug=0;
+
+ if(defined($options)) {
+ if(ref($options)) {
+ $node=$options->{Node} || "localhost";
+ $clientname=$options->{Client};
+ $debug=$options->{Debug} || 0;
+ } else {
+ # assume it's a string otherwise
+ $node=$options;
+ }
+ }
+
+ $node||="localhost";
+ $clientname||="perlfn";
+
+ # TODO: does this work with IPv6?
+ if($node !~ /:\d+$/) {
+ $node.=":9481";
+ }
+
+ $self->{node}=$node;
+ $self->{clientname}=$clientname;
+ $self->{debug}=$debug;
+ $self->{socket}=undef;
+}
+
+sub debug
+{
+ return shift->{debug};
+}
+
+sub connect
+{
+ my $self=shift;
+
+ # connect to the node
+ $socket=IO::Socket::INET->new(PeerAddr => $self->{node});
+
+ if(!$socket) {
+ # failed for some reason TODO: should wrap this is a proper error?
+ return undef;
+ }
+
+ $self->debug && print "connected to ".$self->{node}."\n";
+
+ $self->{socket}=$socket;
+
+ # now send a ClientHello
+ $msg=Freenet::Message->new("ClientHello",
+ {
+ ExpectedVersion => "2.0",
+ Name => $self->{clientname},
+ }
+ );
+
+ if(!($self->sendmessage($msg))) {
+ return undef;
+ }
+ $response=$self->getmessage();
+
+ # TODO: keep node's features somewhere so we can use it later
+
+ return $response;
+}
+
+sub getmessage
+{
+ my $self=shift;
+
+ my $socket=$self->{socket};
+
+ my $message;
+ my $headers;
+ my $data;
+
+ $_=<$socket>;
+ chomp;
+ $self->debug && print "<$_\n";
+
+ $message=$_;
+
+ while(1) {
+ $_=<$socket>;
+ if($_ eq "") {
+ warn "read empty message from socket, probably the socket was closed by the node\n";
+ return undef;
+ }
+ chomp;
+ $self->debug && print "<$_\n";
+ last if /^EndMessage$/;
+ last if /^Data$/;
+ my($k,$v)=split(/=/,$_,2);
+ $headers->{$k}=$v;
+ }
+
+ if(/^Data$/) {
+ # handle data after message headers
+ my($dl)=$headers->{DataLength};
+ if(!defined($dl)) {
+ warn "warning: Message ends with Data line, but no DataLength. We will probably break afterwards\n";
+ } else {
+ $self->debug && print "debug && print "new($message, $headers);
+ if(defined($data)) {
+ $res->{data}=$data;
+ }
+
+ return $res;
+}
+
+sub sendmessage
+{
+ my($self)=shift;
+ my($msg)=shift;
+ if(!ref($msg)) {
+ # assume the parameters are the same as for Message->new
+ $msg=Freenet::Message->new($msg,shift);
+ }
+ my $sock=$self->{socket};
+
+ if(!ref($msg) eq "Freenet::Message") {
+ warn "wrong argument type\n";
+ }
+
+ print $sock $msg->message,"\n";
+ $self->debug && print ">".$msg->message."\n";
+
+ foreach my $k (keys(%{$msg->header})) {
+ my($h)=$msg->header($k);
+ print $sock "$k=$h\n";
+ $self->debug && print ">$k=$h\n";
+ }
+
+ print $sock "EndMessage\n";
+ $self->debug && print ">EndMessage\n";
+
+ if(defined($msg->data)) {
+ $self->debug && print ">data follows\n";
+ print $sock $msg->data;
+ $self->debug && print ">wrote data\n";
+ }
+
+ return 1;
+}
+
+sub disconnect
+{
+ my $self=shift;
+ my $ret;
+
+ $ret=close($self->{socket});
+ $self->{socket}=undef;
+
+ $self->debug && print "client disconnected\n";
+
+ return $ret;
+}
+
+1;
Added: trunk/apps/perlFreenet/Freenet/Message.pm
===================================================================
--- trunk/apps/perlFreenet/Freenet/Message.pm (rev 0)
+++ trunk/apps/perlFreenet/Freenet/Message.pm 2007-04-01 00:50:14 UTC (rev 12505)
@@ -0,0 +1,67 @@
+package Freenet::Message;
+
+sub new {
+ my $class = shift;
+ my $self = {};
+ bless $self, $class;
+ $self->initialize(@_);
+ return $self;
+}
+
+sub initialize
+{
+ my $self = shift;
+
+ $self->{data}=undef;
+ $self->{message}=shift;
+ # if we don't have header field, you can just leave them out
+ # e.g. ->new("ShutDown");
+ $self->{header}=shift || {};
+}
+
+# TODO: how can these be assigned to?
+sub data
+{
+ return shift->{data};
+}
+
+# TODO: should this be called "name" or "messagename"?
+sub message
+{
+ return shift->{message};
+}
+
+# get header hash ref or one header
+
+sub header
+{
+ my($self)=shift;
+ if(int(@_)==0) {
+ return $self->{header};
+ } else {
+ my $k=shift;
+ return $self->{header}->{$k};
+ }
+}
+
+# as_string is useful for debugging, returns the complete message ending
+# with either EndMessage or Data
+
+sub as_string
+{
+ my($self)=shift;
+
+ my($s)=$self->message."\n";
+ foreach my $k (keys(%{$self->header})) {
+ $s.=$k."=".$self->header($k)."\n";
+ }
+ if(defined($self->data)) {
+ # ignore the data field for now
+ $s.="Data\n";
+ } else {
+ $s.="EndMessage\n";
+ }
+ return $s;
+}
+
+1;
Added: trunk/apps/perlFreenet/README
===================================================================
--- trunk/apps/perlFreenet/README (rev 0)
+++ trunk/apps/perlFreenet/README 2007-04-01 00:50:14 UTC (rev 12505)
@@ -0,0 +1,24 @@
+Perl support for Freenet
+
+This is still very preliminary, you can connect to the server and send/received
+messages including data. Some examples are in perlfn.pl and in putcomplexdir.pl.
+
+There is no support for waiting for or polling messages yet, so longer
+operations will probably not work and you cannot start more than one operation
+unless you take care of sorting the progress messages yourself.
+
+Right now there is no Makefile.PL nor PPM, you can either keep the Freenet
+directory in your local dir or copy them to lib/perl//
+
+There are quite a few things missing, e.g. Perldoc.
+
+Until now, I have used the library under Windows only (Vista and XP) with
+ActiveState Perl 5.8.8, it should work under Linux as well, but this is yet
+untested.
+
+For feedback about the code, please use devel at P7LnnR2qMOTZdYbBa_teC92vTLQ in
+[MAILBOX] or use the bug tracker at https://bugs.freenetproject.org/
+(perlFreenet)
+
+Thats all for now, I'll leave you to finding your own bugs ...
+
Added: trunk/apps/perlFreenet/perlfn.pl
===================================================================
--- trunk/apps/perlFreenet/perlfn.pl (rev 0)
+++ trunk/apps/perlFreenet/perlfn.pl 2007-04-01 00:50:14 UTC (rev 12505)
@@ -0,0 +1,125 @@
+#! perl
+
+use Data::Dumper;
+use File::Slurp;
+
+use Freenet::Message;
+use Freenet::Connection;
+
+$node=Freenet::Connection->new({Node => 'localhost', Client=>'perl testclient', Debug=>1});
+($nodehello=$node->connect) || warn "connect failed\n";
+
+if($nodehello->message ne "NodeHello") {
+ warn "something went wrong, got ".$nodehello->message." instead of NodeHello\n";
+}
+
+# get uptime
+$node->sendmessage("GetNode", {WithVolatile => 'true'});
+$nodedata=$node->getmessage;
+$uptime=$nodedata->header("volatile.uptimeSeconds")/3600.0;
+print "uptime $uptime hours\n";
+
+# get a list of peer node names
+
+$node->sendmessage("ListPeers",
+ {
+ WithVolatile => 'true',
+ WithMetadata => 'true',
+ }
+);
+
+while(1) {
+ my($msg)=$node->getmessage;
+ if($msg->message eq "Peer") {
+ $myName=$msg->header(myName);
+ $status=$msg->header("volatile.status");
+ print "$myName $status\n";
+ }
+ last if $msg->message eq "EndListPeers";
+};
+
+$node->sendmessage("ClientGet",
+ {
+ IgnoreDS=>"false",
+ DSOnly=>"false",
+ URI=>'USK at Aegl9hc-9O2-VMpXBYuxwuj9JAoMDdXHlNjGst1hLD8,xJTwS8hLh5Uv-20UbH9Mp64nnfqjbGkTDaUlo4EPr9M,AQACAAE/fn_rrd/2/activelink.png',
+ Identifier=>"Request Number One",
+ Verbosity=>0,
+ ReturnType=>"direct",
+ MaxSize=>1000000,
+ MaxTempSize=>1000000,
+ MaxRetries=>100,
+ PriorityClass=>1,
+ Persistence=>"connection",
+ ClientToken=>"hello",
+ Global=>"false",
+ }
+);
+
+my($msg)=$node->getmessage;
+print $msg->as_string;
+
+if($msg->message ne "DataFound") {
+ die "didn't get the expected message (got ".$msg->message.")\n";
+}
+
+# from the wiki documentation I thought you have to do GetRequestStatus after
+# DataFound, but apparently the file is returned directly afterwards
+
+#$node->sendmessage(Freenet::Message->new("GetRequestStatus",
+#{
+# Identifier=>"Request Number One",
+# Global=>"true",
+# OnlyData=>"false",
+#}
+#));
+
+$msg=$node->getmessage;
+print $msg->as_string;
+
+print "retrieved file size ".length($msg->data),"\n";
+
+write_file("test.png", {binmode => ':raw' }, $msg->data);
+
+$node->sendmessage("GenerateSSK", {Identifier=>"My Identifier Blah Blah"});
+print $node->getmessage->as_string;
+
+# shut down node (you probably dont want to do this is a test script)
+
+#$node->sendmessage("Shutdown");
+#print $node->getmessage->as_string;
+
+# get CHK of a known file
+
+# have to create the message beforehand since we have to add data element
+
+$msg=Freenet::Message->new("ClientPut",
+ {
+
+ URI=>"CHK@",
+ "Metadata.ContentType"=>"text/pdf",
+ Identifier=>"My Test File",
+ Verbosity=>"0",
+ MaxRetries=>"10",
+ PriorityClass=>"1",
+ GetCHKOnly=>"true",
+ Global=>"false",
+ DontCompress=>"true",
+ ClientToken=>"Hello!!!",
+ UploadFrom=>"direct",
+ TargetFilename=>"document.pdf",
+ }
+);
+
+$data=read_file("c:/document.pdf",{binmode => ':raw'});
+
+$msg->{data}=$data;
+$msg->{header}->{DataLength}=length($data);
+
+$node->sendmessage($msg);
+
+my($msg)=$node->getmessage;
+print $msg->as_string;
+
+$node->disconnect || warn "disconnect failed\n";
+
Added: trunk/apps/perlFreenet/putcomplexdir.pl
===================================================================
--- trunk/apps/perlFreenet/putcomplexdir.pl (rev 0)
+++ trunk/apps/perlFreenet/putcomplexdir.pl 2007-04-01 00:50:14 UTC (rev 12505)
@@ -0,0 +1,55 @@
+#! perl
+
+use Data::Dumper;
+use File::Slurp;
+
+use Freenet::Message;
+use Freenet::Connection;
+
+$node=Freenet::Connection->new({Node => '192.168.178.20', Client=>'perl putcomplexdir', Debug=>1});
+($nodehello=$node->connect) || warn "connect failed\n";
+
+if($nodehello->message ne "NodeHello") {
+ warn "something went wrong, got ".$nodehello->message." instread of NodeHello\n";
+}
+
+$file0=read_file("index.html");
+$file1=read_file("foo.zip",{binmode=>':raw'});
+$file2=read_file("doc.pdf",{binmode=>':raw'});
+
+$msg=Freenet::Message->new("ClientPutComplexDir",
+ {
+ Identifier=>"My Test Dir Insert",
+ Verbosity=>1023,
+ MaxRetries=>999,
+ PriorityClass=>2,
+ URI=>'CHK@',
+ GetCHKOnly=>"false",
+ DontCompress=>"false",
+ ClientToken=>"My Client Token",
+ Persistence=>"connection",
+ Global=>"false",
+ DefaultName=>"index.html",
+ "Files.0.Name"=>"index.html",
+ "Files.0.UploadFrom"=>"direct",
+ "Files.0.Metadata.ContentType"=>"text/html",
+ "Files.0.DataLength"=>length($file0),
+ "Files.1.Name"=>"foo.zip",
+ "Files.1.UploadFrom"=>"direct",
+ "Files.1.Metadata.ContentType"=>"application/zip",
+ "Files.1.DataLength"=>length($file1),
+ "Files.2.Name"=>"doc.pdf",
+ "Files.2.UploadFrom"=>"direct",
+ "Files.2.Metadata.ContentType"=>"application/pdf",
+ "Files.2.DataLength"=>length($file2),
+ }
+);
+
+$msg->{data}=$file0.$file1.$file2;
+
+$node->sendmessage($msg);
+
+while(1) {
+ my($msg)=$node->getmessage;
+}
+$node->disconnect || warn "disconnect failed\n";
From alexlehm at freenetproject.org Sun Apr 1 01:24:53 2007
From: alexlehm at freenetproject.org (alexlehm at freenetproject.org)
Date: Sun, 1 Apr 2007 01:24:53 +0000 (UTC)
Subject: [freenet-cvs] r12506 - trunk/apps/perlFreenet
Message-ID: <20070401012453.A5DB9479EB9@emu.freenetproject.org>
Author: alexlehm
Date: 2007-04-01 01:24:53 +0000 (Sun, 01 Apr 2007)
New Revision: 12506
Modified:
trunk/apps/perlFreenet/putcomplexdir.pl
Log:
left local ip in, changed to localhost
Modified: trunk/apps/perlFreenet/putcomplexdir.pl
===================================================================
--- trunk/apps/perlFreenet/putcomplexdir.pl 2007-04-01 00:50:14 UTC (rev 12505)
+++ trunk/apps/perlFreenet/putcomplexdir.pl 2007-04-01 01:24:53 UTC (rev 12506)
@@ -6,7 +6,7 @@
use Freenet::Message;
use Freenet::Connection;
-$node=Freenet::Connection->new({Node => '192.168.178.20', Client=>'perl putcomplexdir', Debug=>1});
+$node=Freenet::Connection->new({Node => 'localhost', Client=>'perl putcomplexdir', Debug=>1});
($nodehello=$node->connect) || warn "connect failed\n";
if($nodehello->message ne "NodeHello") {
From alexlehm at freenetproject.org Sun Apr 1 01:57:09 2007
From: alexlehm at freenetproject.org (alexlehm at freenetproject.org)
Date: Sun, 1 Apr 2007 01:57:09 +0000 (UTC)
Subject: [freenet-cvs] r12507 - trunk/apps/perlFreenet
Message-ID: <20070401015709.7CB3B479928@emu.freenetproject.org>
Author: alexlehm
Date: 2007-04-01 01:57:09 +0000 (Sun, 01 Apr 2007)
New Revision: 12507
Modified:
trunk/apps/perlFreenet/perlfn.pl
trunk/apps/perlFreenet/putcomplexdir.pl
Log:
wrong handling of binmode in read_file
Modified: trunk/apps/perlFreenet/perlfn.pl
===================================================================
--- trunk/apps/perlFreenet/perlfn.pl 2007-04-01 01:24:53 UTC (rev 12506)
+++ trunk/apps/perlFreenet/perlfn.pl 2007-04-01 01:57:09 UTC (rev 12507)
@@ -111,7 +111,7 @@
}
);
-$data=read_file("c:/document.pdf",{binmode => ':raw'});
+$data=read_file("c:/document.pdf", binmode => ':raw');
$msg->{data}=$data;
$msg->{header}->{DataLength}=length($data);
Modified: trunk/apps/perlFreenet/putcomplexdir.pl
===================================================================
--- trunk/apps/perlFreenet/putcomplexdir.pl 2007-04-01 01:24:53 UTC (rev 12506)
+++ trunk/apps/perlFreenet/putcomplexdir.pl 2007-04-01 01:57:09 UTC (rev 12507)
@@ -10,12 +10,12 @@
($nodehello=$node->connect) || warn "connect failed\n";
if($nodehello->message ne "NodeHello") {
- warn "something went wrong, got ".$nodehello->message." instread of NodeHello\n";
+ warn "something went wrong, got ".$nodehello->message." instead of NodeHello\n";
}
$file0=read_file("index.html");
-$file1=read_file("foo.zip",{binmode=>':raw'});
-$file2=read_file("doc.pdf",{binmode=>':raw'});
+$file1=read_file("foo.zip", binmode=>':raw');
+$file2=read_file("doc.pdf", binmode=>':raw');
$msg=Freenet::Message->new("ClientPutComplexDir",
{
From saces at freenetproject.org Sun Apr 1 13:17:40 2007
From: saces at freenetproject.org (saces at freenetproject.org)
Date: Sun, 1 Apr 2007 13:17:40 +0000 (UTC)
Subject: [freenet-cvs] r12508 - trunk/freenet/src/freenet/node/fcp
Message-ID: <20070401131740.31A73479847@emu.freenetproject.org>
Author: saces
Date: 2007-04-01 13:17:39 +0000 (Sun, 01 Apr 2007)
New Revision: 12508
Added:
trunk/freenet/src/freenet/node/fcp/TestDDADeleteTestFileMessage.java
trunk/freenet/src/freenet/node/fcp/TestDDAResult.java
trunk/freenet/src/freenet/node/fcp/TestDDAResultMessage.java
Modified:
trunk/freenet/src/freenet/node/fcp/TestDDAMessage.java
Log:
empty frame for TestDDA
Added: trunk/freenet/src/freenet/node/fcp/TestDDADeleteTestFileMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestDDADeleteTestFileMessage.java (rev 0)
+++ trunk/freenet/src/freenet/node/fcp/TestDDADeleteTestFileMessage.java 2007-04-01 13:17:39 UTC (rev 12508)
@@ -0,0 +1,66 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.node.fcp;
+
+import java.io.File;
+
+import freenet.node.Node;
+import freenet.node.TestDDAManager;
+import freenet.support.SimpleFieldSet;
+
+/**
+ * DeleteDDATestFile
+ * Identifier=indent123unique [mandatory]
+ * ClientToken=clientid [mandatory] test owner
+ *
+ */
+public class TestDDADeleteTestFileMessage extends FCPMessage {
+
+ static final String name = "DeleteDDATestFile";
+
+ private static final String FN_IDENTIFIER = "Identifier";
+
+ private final String _ident; // unique id
+
+ /**
+ * @throws MessageInvalidException
+ */
+ public TestDDADeleteTestFileMessage(SimpleFieldSet fs) throws MessageInvalidException {
+ _ident = fs.get(FN_IDENTIFIER);
+ if(_ident == null)
+ throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Identifier", null, false);
+ }
+
+ public SimpleFieldSet getFieldSet() {
+ SimpleFieldSet fs = new SimpleFieldSet(true);
+ fs.putSingle("Identifier", _ident);
+ return fs;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void run(FCPConnectionHandler handler, Node node)
+ throws MessageInvalidException {
+ handler.getClientName();
+ TestDDAManager tm = null;// FIXME node.clientCore.testDDAManager;
+ TestDDAResult tr = tm.getTestResult(_ident);
+ if (tr == null) {
+ throw new MessageInvalidException(ProtocolErrorMessage.NO_SUCH_IDENTIFIER, "No such test identifier", _ident, false);
+ }
+ if (!tr.isConfirmed) {
+ throw new MessageInvalidException(ProtocolErrorMessage.INVALID_MESSAGE, "You need to confirm the test first", _ident, false);
+ }
+ File tf = tm.getTestWriteFile(_ident);
+
+ FCPMessage msg;
+
+ if (tf == null) {
+ msg = new ProtocolErrorMessage(ProtocolErrorMessage.INTERNAL_ERROR, false, "Not a write test", _ident, false);
+ }
+
+ handler.outputHandler.queue(this);
+ }
+}
Modified: trunk/freenet/src/freenet/node/fcp/TestDDAMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestDDAMessage.java 2007-04-01 01:57:09 UTC (rev 12507)
+++ trunk/freenet/src/freenet/node/fcp/TestDDAMessage.java 2007-04-01 13:17:39 UTC (rev 12508)
@@ -14,6 +14,7 @@
import java.util.Random;
import freenet.node.Node;
+import freenet.node.NodeClientCore;
import freenet.support.HexUtil;
import freenet.support.SimpleFieldSet;
@@ -22,20 +23,11 @@
* Identifier=indent123unique [mandatory]
* DirToTest=/path/to/dir [mandatory] the dir to test
* TestList=true [default: false] can we list the dir?
- * ReadFilename=fileindir.ext the filename for read test
- * readtest skipped if missing or empty
- * the read test file needs to be an existing regular file
- * and must have size != 0!
- * WriteFilename=hallo.test the filename for write test
- * WriteFilename= the node will generate an unique filename (recommended)
- * writetest skipped on missing
- * if a name is given, the client have to make sure the file doesn't exist!
+ * TestRead=fileindir.ext the filename for read test
+ * readtest skipped if missing
+ * TestWrite=true the node will generate an unique filename
+ * writetest skipped if missing or not true
*
- * DeleteTestFile= [default: true]
- * the testfile is only left if the read test was ok.
- *
- *
- *
*/
public class TestDDAMessage extends FCPMessage {
@@ -43,42 +35,49 @@
static final String name = "TestDDA";
+ private static final String FN_IDENTIFIER = "Identifier";
+ private static final String FN_TEST2DIR = "DirToTest";
+ private static final String FN_TESTLIST = "TestList";
+ private static final String FN_TESTREAD = "TestRead";
+ private static final String FN_TESTWRITE = "TestWrite";
+
private boolean resultList = false;
private boolean resultWrite = false;
- private String writeTestFilename = null; // set if it is generated
private String readResult = null;
private String writeResult = null;
- final boolean testlist;
- final String identifier;
- final String dir2test;
- final String readfilename;
- final String writefilename;
-
- private final boolean deleteFile;
+ private final boolean _testlist;
+ private final boolean _testwrite;
+ private final String identifier; // unique id
+ private final String dir2test; // the dir to test
+ private final String _readfilename;
+ private String writefilename;
+
/**
* @throws MessageInvalidException
*/
public TestDDAMessage(SimpleFieldSet fs) throws MessageInvalidException {
- identifier = fs.get("Identifier");
+ identifier = fs.get(FN_IDENTIFIER);
if(identifier == null)
throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Identifier", null, false);
- dir2test = fs.get("DirToTest");
+ dir2test = fs.get(FN_TEST2DIR);
if(dir2test == null)
- throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Identifier", identifier, false);
+ throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Dir to test given", identifier, false);
if(dir2test.trim().length() == 0)
throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "DirToTest can't be empty!", identifier, false);
- String rfn = fs.get("ReadFilename");
+ String rfn = fs.get(FN_TESTREAD);
if(rfn != null)
if (rfn.trim().length() > 0)
- readfilename = rfn;
+ _readfilename = rfn;
else
throw new MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Read test filename can't be empty!", identifier, false);
- else readfilename = null;
+ else _readfilename = null;
+ _testwrite = fs.getBoolean(FN_TESTWRITE, false);
+
String wfn = fs.get("WriteFilename");
if (wfn == null)
@@ -86,9 +85,7 @@
else
writefilename = wfn;
- deleteFile = fs.getBoolean("DeleteTestFile", true);
-
- testlist = fs.getBoolean("TestList", false);
+ _testlist = fs.getBoolean(FN_TESTLIST, false);
}
public SimpleFieldSet getFieldSet() {
@@ -97,12 +94,12 @@
fs.putSingle("TestedDir", dir2test);
fs.putSingle("Status", getStatus());
if (status == 0) {
- if (testlist)
+ if (_testlist)
fs.putSingle("ListTest", getResultName(resultList));
else
fs.putSingle("ListTest", "Skipped");
- if (readfilename != null) {
+ if (_readfilename != null) {
if (readResult == null) {
fs.putSingle("ReadTest", getResultName(false));
} else {
@@ -113,11 +110,11 @@
fs.putSingle("ReadTest", "Skipped");
if (writefilename != null) {
- if (writeTestFilename != null) {
- fs.putSingle("WriteFileName", writeTestFilename);
- } else {
+// if (writeTestFilename != null) {
+// fs.putSingle("WriteFileName", writeTestFilename);
+// } else {
fs.putSingle("WriteFileName", writefilename);
- }
+// }
fs.putSingle("WriteData", writeResult);
fs.putSingle("WriteTest", getResultName(resultWrite));
} else
@@ -137,6 +134,8 @@
public void run(FCPConnectionHandler handler, Node node)
throws MessageInvalidException {
+ handler.getClientName();
+ NodeClientCore core = node.clientCore;
realTest();
handler.outputHandler.queue(this);
}
@@ -167,9 +166,9 @@
resultList = (t_dirList != null);
// read
- if (readfilename != null) {
+ if (_readfilename != null) {
- File t_read = new File(dir, readfilename);
+ File t_read = new File(dir, _readfilename);
if (!t_read.isFile())
throw new MessageInvalidException(ProtocolErrorMessage.FILE_NOT_FOUND, "Read test filename must be an existing regular file!", identifier, false);
@@ -206,7 +205,7 @@
if (writefilename.trim().length() == 0) {
//generate one
f = File.createTempFile("NodeDDAtest", ".dat", dir);
- writeTestFilename = f.getName();
+ // writeTestFilename = f.getName();
} else {
f = new File(dir, writefilename);
if (f.exists()) {
@@ -229,10 +228,7 @@
writeResult= HexUtil.bytesToHex(bb, 0 ,8);
resultWrite = Arrays.equals(b, bb);
-
- if (deleteFile)
- f.delete();
-
+
} catch (IOException ioe) {
}
}
Added: trunk/freenet/src/freenet/node/fcp/TestDDAResult.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestDDAResult.java (rev 0)
+++ trunk/freenet/src/freenet/node/fcp/TestDDAResult.java 2007-04-01 13:17:39 UTC (rev 12508)
@@ -0,0 +1,14 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.node.fcp;
+
+
+/**
+ *
+ */
+public class TestDDAResult {
+
+ boolean isConfirmed;
+
+}
Added: trunk/freenet/src/freenet/node/fcp/TestDDAResultMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestDDAResultMessage.java (rev 0)
+++ trunk/freenet/src/freenet/node/fcp/TestDDAResultMessage.java 2007-04-01 13:17:39 UTC (rev 12508)
@@ -0,0 +1,59 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.node.fcp;
+
+import freenet.node.Node;
+import freenet.support.SimpleFieldSet;
+
+/**
+ * TestDDA
+ * Identifier=indent123unique [mandatory]
+ * DirToTest=/path/to/dir [mandatory] the dir to test
+ * TestList=true [default: false] can we list the dir?
+ * TestRead=fileindir.ext the filename for read test
+ * readtest skipped if missing
+ * TestWrite=true the node will generate an unique filename
+ * writetest skipped if missing or not true
+ *
+ */
+public class TestDDAResultMessage extends FCPMessage {
+
+ static final String name = "TestDDAResult";
+
+ private static final String FN_IDENTIFIER = "Identifier";
+
+ private final String _ident; // unique id
+ private final String _msg;
+
+ /**
+ * @throws MessageInvalidException
+ */
+// public TestDDAResultMessage(SimpleFieldSet fs) throws MessageInvalidException {
+// _ident = fs.get(FN_IDENTIFIER);
+// if(_ident == null)
+// throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Identifier", null, false);
+//
+// }
+
+ private TestDDAResultMessage(String ident, String msg) {
+ _ident = ident;
+ _msg = msg;
+ }
+
+ public SimpleFieldSet getFieldSet() {
+ SimpleFieldSet fs = new SimpleFieldSet(true);
+ fs.putSingle("Identifier", _ident);
+ return fs;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void run(FCPConnectionHandler handler, Node node)
+ throws MessageInvalidException {
+ throw new MessageInvalidException(ProtocolErrorMessage.INVALID_MESSAGE, "SimpleProgress goes from server to client not the other way around", _ident, false);
+ }
+
+}
From saces at freenetproject.org Sun Apr 1 13:25:08 2007
From: saces at freenetproject.org (saces at freenetproject.org)
Date: Sun, 1 Apr 2007 13:25:08 +0000 (UTC)
Subject: [freenet-cvs] r12509 - trunk/freenet/src/freenet/node
Message-ID: <20070401132508.3F685479ECA@emu.freenetproject.org>
Author: saces
Date: 2007-04-01 13:25:08 +0000 (Sun, 01 Apr 2007)
New Revision: 12509
Added:
trunk/freenet/src/freenet/node/TestDDAManager.java
Log:
empty frame for TestDDA
Added: trunk/freenet/src/freenet/node/TestDDAManager.java
===================================================================
--- trunk/freenet/src/freenet/node/TestDDAManager.java (rev 0)
+++ trunk/freenet/src/freenet/node/TestDDAManager.java 2007-04-01 13:25:08 UTC (rev 12509)
@@ -0,0 +1,42 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.node;
+
+import java.io.File;
+
+import freenet.node.fcp.MessageInvalidException;
+import freenet.node.fcp.TestDDAResult;
+
+
+/**
+ * the testmanager?
+ *
+ */
+public class TestDDAManager {
+
+ /**
+ * @throws MessageInvalidException
+ */
+ TestDDAManager() {
+ }
+
+ /**
+ * @param ident
+ * @return
+ */
+ public File getTestWriteFile(String ident) {
+ return null;
+ }
+
+
+ /**
+ * @param _ident
+ * @return
+ */
+ public TestDDAResult getTestResult(String _ident) {
+ return null;
+ }
+
+
+}
From mario at freenetproject.org Sun Apr 1 18:52:58 2007
From: mario at freenetproject.org (mario at freenetproject.org)
Date: Sun, 1 Apr 2007 18:52:58 +0000 (UTC)
Subject: [freenet-cvs] r12514 - trunk/freenet/src/freenet/l10n
Message-ID: <20070401185258.60966479D83@emu.freenetproject.org>
Author: mario
Date: 2007-04-01 18:52:58 +0000 (Sun, 01 Apr 2007)
New Revision: 12514
Added:
trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties
Log:
test
Added: trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties (rev 0)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties 2007-04-01 18:52:58 UTC (rev 12514)
@@ -0,0 +1 @@
+// polish placeholder
\ No newline at end of file
From mario at freenetproject.org Sun Apr 1 19:00:06 2007
From: mario at freenetproject.org (mario at freenetproject.org)
Date: Sun, 1 Apr 2007 19:00:06 +0000 (UTC)
Subject: [freenet-cvs] r12515 - trunk/freenet/src/freenet/l10n
Message-ID: <20070401190006.E36AA479EDD@emu.freenetproject.org>
Author: mario
Date: 2007-04-01 19:00:06 +0000 (Sun, 01 Apr 2007)
New Revision: 12515
Modified:
trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties
Log:
test diacritical chars
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties 2007-04-01 18:52:58 UTC (rev 12514)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties 2007-04-01 19:00:06 UTC (rev 12515)
@@ -1 +1,3 @@
-// polish placeholder
\ No newline at end of file
+// polish placeholder
+// diacritical characters test: ????????????????
+
From mario at freenetproject.org Sun Apr 1 19:15:52 2007
From: mario at freenetproject.org (mario at freenetproject.org)
Date: Sun, 1 Apr 2007 19:15:52 +0000 (UTC)
Subject: [freenet-cvs] r12516 - trunk/freenet/src/freenet/l10n
Message-ID: <20070401191552.7DBE8479F6D@emu.freenetproject.org>
Author: mario
Date: 2007-04-01 19:15:52 +0000 (Sun, 01 Apr 2007)
New Revision: 12516
Modified:
trunk/freenet/src/freenet/l10n/L10n.java
trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties
Log:
first cut at polish translation
Modified: trunk/freenet/src/freenet/l10n/L10n.java
===================================================================
--- trunk/freenet/src/freenet/l10n/L10n.java 2007-04-01 19:00:06 UTC (rev 12515)
+++ trunk/freenet/src/freenet/l10n/L10n.java 2007-04-01 19:15:52 UTC (rev 12516)
@@ -15,6 +15,10 @@
* @author Florent Daignière <nextgens at freenetproject.org>
*
* TODO: Maybe we ought to use the locale to set the default language.
+ *
+ * comment(mario): for www interface we might detect locale from http requests?
+ * for other access (telnet) using system locale would probably be good, but
+ * it would be nice to have a command to switch locale on the fly.
*/
public class L10n {
@@ -22,7 +26,7 @@
private static String prefix = "freenet.l10n.";
// English has to remain the first one!
- public static final String[] availableLanguages = { "en", "fr" };
+ public static final String[] availableLanguages = { "en", "fr", "pl"};
private String selectedLanguage = availableLanguages[0];
private static Properties currentProperties = null;
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties 2007-04-01 19:00:06 UTC (rev 12515)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.pl.properties 2007-04-01 19:15:52 UTC (rev 12516)
@@ -1,3 +1,16 @@
-// polish placeholder
+// polish translations
// diacritical characters test: ????????????????
+testing.test=testpl$(test1)testpl$(test2)testpl
+QueueToadlet.emergency=nadzwyczajny
+QueueToadlet.veryhigh=bardzo wysoki
+QueueToadlet.high=wysoki
+QueueToadlet.medium=?redni
+QueueToadlet.low=niski
+QueueToadlet.verylow=bardzo niski
+QueueToadlet.willneverfinish=najni?szy
+QueueToadlet.failedToRemoveRequest=Usuni?cie ??dania nie powiod?o si?
+QueueToadlet.failedToRemove=Usuni?cie $(id) nie uda?o si?: $(message)
+QueueToadlet.failedToRestartRequest=Wznowienie ??dania nie powiod?o si?
+QueueToadlet.failedToRestart=Ponowienie $(id) nie powiod?o si?
+QueueToadlet.failedToRemoveId=Usuni?cie $(id) nie powiod?o si?
\ No newline at end of file
From nextgens at freenetproject.org Sun Apr 1 19:39:00 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Sun, 1 Apr 2007 19:39:00 +0000 (UTC)
Subject: [freenet-cvs] r12517 - in trunk: freenet/src/freenet/l10n plugins
plugins/TranslationHelper
Message-ID: <20070401193900.AF1B5479FB7@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-01 19:39:00 +0000 (Sun, 01 Apr 2007)
New Revision: 12517
Added:
trunk/plugins/TranslationHelper/
trunk/plugins/TranslationHelper/TranslationHelper.java
Modified:
trunk/freenet/src/freenet/l10n/L10n.java
Log:
new plugin : TranslationHelper... it provides only basic stuffs... and ought to be improved (the CSS hasn't been touched and I'm not a XHTML expert ;))
see http://archives.freenetproject.org/message/20070401.001318.cbb0ddd3.en.html
Modified: trunk/freenet/src/freenet/l10n/L10n.java
===================================================================
--- trunk/freenet/src/freenet/l10n/L10n.java 2007-04-01 19:15:52 UTC (rev 12516)
+++ trunk/freenet/src/freenet/l10n/L10n.java 2007-04-01 19:39:00 UTC (rev 12517)
@@ -4,6 +4,7 @@
package freenet.l10n;
import java.io.InputStream;
+import java.util.Enumeration;
import java.util.MissingResourceException;
import java.util.Properties;
@@ -69,11 +70,19 @@
*/
public static String getString(String key) {
String result = currentProperties.getProperty(key);
- if(result != null) return result;
-
+ if(result != null)
+ return result;
+ else
+ return getDefaultString(key);
+ }
+
+ public static String getDefaultString(String key) {
+ String result = null;
// We instanciate it only if necessary
if(fallbackProperties == null) fallbackProperties = loadProperties(availableLanguages[0]);
+
result = fallbackProperties.getProperty(key);
+
if(result != null) {
Logger.normal(CLASS_NAME, "The translation for " + key + " hasn't been found! please tell the maintainer.");
return result;
@@ -107,7 +116,7 @@
* @param name
* @return the Properties object or null if not found
*/
- private static Properties loadProperties (String name) {
+ public static Properties loadProperties (String name) {
name = prefix.replace ('.', '/').concat(prefix.concat(name.concat(".properties")));
Properties result = null;
@@ -134,6 +143,10 @@
return currentClass.selectedLanguage;
}
+ public static Enumeration getKeys() {
+ return currentProperties.propertyNames();
+ }
+
public static void main(String[] args) {
L10n.setLanguage("en");
System.out.println(L10n.getString("testing.test"));
Added: trunk/plugins/TranslationHelper/TranslationHelper.java
===================================================================
--- trunk/plugins/TranslationHelper/TranslationHelper.java (rev 0)
+++ trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-01 19:39:00 UTC (rev 12517)
@@ -0,0 +1,203 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package plugins.TranslationHelper;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import freenet.l10n.L10n;
+import freenet.pluginmanager.FredPlugin;
+import freenet.pluginmanager.FredPluginHTTP;
+import freenet.pluginmanager.FredPluginThreadless;
+import freenet.pluginmanager.PluginHTTPException;
+import freenet.pluginmanager.PluginRespirator;
+import freenet.support.HTMLNode;
+import freenet.support.api.HTTPRequest;
+
+/**
+ * This plugin is a helper to manage freenet translation files.
+ *
+ * @author Florent Daignière <nextgens at freenetproject.org>
+ */
+public class TranslationHelper implements FredPlugin, FredPluginHTTP, FredPluginThreadless {
+ public static String PLUGIN_NAME = "TranslationHelper";
+ public static String PLUGIN_BASE_URL = "/plugins/plugins." + PLUGIN_NAME + '.' + PLUGIN_NAME + '/';
+ private PluginRespirator pr;
+ private Properties editedProperties;
+ private String editedLang;
+
+ public void runPlugin(PluginRespirator pr) {
+ this.pr = pr;
+ editedLang = L10n.availableLanguages[0];
+ editedProperties = L10n.loadProperties(editedLang);
+ }
+
+ public void terminate() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String handleHTTPGet(HTTPRequest request) throws PluginHTTPException {
+ if(request.isParameterSet("reload")) {
+ editedLang = request.getParam("reload");
+ HTMLNode pageNode = pr.getPageMaker().getPageNode(PLUGIN_NAME+" page : warning", false, null);
+ HTMLNode contentNode = pr.getPageMaker().getContentNode(pageNode);
+
+ HTMLNode availableLanguagesInfobox = contentNode.addChild("div", "class", "infobox infobox-warning");
+ HTMLNode availableLanguagesInfoboxHeader = availableLanguagesInfobox.addChild("div", "class", "infobox-header");
+ HTMLNode availableLanguagesInfoboxContent = availableLanguagesInfobox.addChild("div", "class", "infobox-content");
+
+ availableLanguagesInfoboxHeader.addChild("#", "Please confirm!");
+
+ availableLanguagesInfoboxContent.addChild("#", "Please confirm that you want to reload the default translations from " + editedLang);
+ HTMLNode updateForm = pr.addFormChild(availableLanguagesInfoboxContent, PLUGIN_BASE_URL, "reload");
+
+ updateForm.addChild("input",
+ new String[] { "type", "name", "value" },
+ new String[] { "hidden", "reload", request.getParam("lang")
+ });
+ updateForm.addChild("input",
+ new String[] { "type", "name", "value" },
+ new String[] { "submit", "confirm", "Confirm and reload!"
+ });
+
+ return pageNode.generate();
+ }else if(request.isParameterSet("lang")) {
+ editedLang = request.getParam("lang");
+ HTMLNode pageNode = pr.getPageMaker().getPageNode(PLUGIN_NAME+" page for "+editedLang, false, null);
+ HTMLNode contentNode = pr.getPageMaker().getContentNode(pageNode);
+
+ HTMLNode translationNode = contentNode.addChild("div", "class", "translation");
+ HTMLNode updateForm = pr.addFormChild(translationNode, PLUGIN_BASE_URL, "update");
+ HTMLNode legendTable = updateForm.addChild("table", "class", "translation");
+
+ HTMLNode legendRow = legendTable.addChild("tr");
+ legendRow.addChild("td", "class", "translation-key", "Translation key");
+ legendRow.addChild("td", "class", "translation-key", "Original translation");
+ legendRow.addChild("td", "class", "translation-key", "Current translation");
+
+ final Enumeration keys = L10n.getKeys();
+
+ while(keys.hasMoreElements()){
+ String key = (String)keys.nextElement();
+ HTMLNode contentRow = legendTable.addChild("tr");
+ contentRow.addChild("td", "class", "translation-key",
+ key
+ );
+ contentRow.addChild("td", "class", "translation-orig",
+ L10n.getDefaultString(key)
+ );
+ contentRow.addChild("td", "class", "translation-new").addChild(
+ "input",
+ new String[] { "type", "name", "value" },
+ new String[] { "text", key, editedProperties.getProperty(key)
+ });
+ }
+ HTMLNode contentRow = legendTable.addChild("tr");
+ contentRow.addChild("input",
+ new String[] { "type", "name", "value" },
+ new String[] { "hidden", "lang", request.getParam("lang")
+ });
+ contentRow.addChild("input",
+ new String[] { "type", "name", "value" },
+ new String[] { "submit", "update", "Update the translation!"
+ });
+ contentRow.addChild("%", " ");
+ contentRow.addChild("a", "href", PLUGIN_BASE_URL+"?getTranlationFile").addChild("#", "Download the translation file");
+
+ contentRow.addChild("%", " ");
+ contentRow.addChild("a", "href", PLUGIN_BASE_URL).addChild("#", "Return to the plugin's main page");
+
+ return pageNode.generate();
+ } else if(request.isParameterSet("getTranlationFile")) {
+ StringWriter out = new StringWriter();
+ try {
+ editedProperties.store(out, "Translation file for "+editedLang);
+ } catch (IOException e) {} // huh ?
+ return out.toString();
+ }
+
+ HTMLNode pageNode = pr.getPageMaker().getPageNode(PLUGIN_NAME+" page", false, null);
+ HTMLNode contentNode = pr.getPageMaker().getContentNode(pageNode);
+
+ HTMLNode availableLanguagesInfobox = contentNode.addChild("div", "class", "infobox infobox-normal");
+ HTMLNode availableLanguagesInfoboxHeader = availableLanguagesInfobox.addChild("div", "class", "infobox-header");
+ HTMLNode availableLanguagesInfoboxContent = availableLanguagesInfobox.addChild("div", "class", "infobox-content");
+
+ availableLanguagesInfoboxHeader.addChild("#", "Available languages");
+
+ availableLanguagesInfoboxContent.addChild("#", "Here is the list of available languages on this freenet node :");
+ HTMLNode availableLanguagesList = availableLanguagesInfoboxContent.addChild("ul");
+ for(int i=0; i
Author: nextgens
Date: 2007-04-01 19:45:18 +0000 (Sun, 01 Apr 2007)
New Revision: 12518
Modified:
trunk/plugins/MDNSDiscovery/MDNSDiscovery.java
Log:
push the new version of MDNSDiscovery (mostly useless changes for now)
Modified: trunk/plugins/MDNSDiscovery/MDNSDiscovery.java
===================================================================
--- trunk/plugins/MDNSDiscovery/MDNSDiscovery.java 2007-04-01 19:39:00 UTC (rev 12517)
+++ trunk/plugins/MDNSDiscovery/MDNSDiscovery.java 2007-04-01 19:45:18 UTC (rev 12518)
@@ -11,7 +11,6 @@
import plugins.MDNSDiscovery.javax.jmdns.ServiceEvent;
import plugins.MDNSDiscovery.javax.jmdns.ServiceInfo;
import plugins.MDNSDiscovery.javax.jmdns.ServiceListener;
-import freenet.clients.http.PageMaker;
import freenet.config.Config;
import freenet.pluginmanager.*;
import freenet.support.HTMLNode;
@@ -31,13 +30,13 @@
* TODO: Plug into config. callbacks to reflect changes @see #1217
* TODO: Maybe we should make add forms onto that toadlet and let the user choose what to advertise or not
*/
-public class MDNSDiscovery implements FredPlugin, FredPluginHTTP{
+public class MDNSDiscovery implements FredPlugin, FredPluginHTTP {
public static String freenetServiceType = "_freenet._udp.local.";
private boolean goon = true;
private JmDNS jmdns;
private Config nodeConfig;
- private PageMaker pageMaker;
private LinkedList ourAdvertisedServices, ourDisabledServices;
+ private PluginRespirator pr;
/**
* Called upon plugin unloading : we unregister advertised services
@@ -49,6 +48,7 @@
}
public void runPlugin(PluginRespirator pr) {
+ this.pr = pr;
// wait until the node is initialised.
while(pr.getNode() == null || !pr.getNode().isHasStarted()){
try{
@@ -57,7 +57,6 @@
}
nodeConfig = pr.getNode().config;
- pageMaker = new PageMaker("clean");
ourAdvertisedServices = new LinkedList();
ourDisabledServices = new LinkedList();
final ServiceInfo fproxyInfo, TMCIInfo, fcpInfo, nodeInfo;
@@ -186,8 +185,8 @@
}
public String handleHTTPGet(HTTPRequest request) throws PluginHTTPException {
- HTMLNode pageNode = pageMaker.getPageNode("MDNSDiscovery plugin configuration page", false, null /* FIXME */);
- HTMLNode contentNode = pageMaker.getContentNode(pageNode);
+ HTMLNode pageNode = pr.getPageMaker().getPageNode("MDNSDiscovery plugin configuration page", false, null);
+ HTMLNode contentNode = pr.getPageMaker().getContentNode(pageNode);
ServiceInfo[] foundNodes = jmdns.list(MDNSDiscovery.freenetServiceType);
@@ -210,7 +209,7 @@
for(int i=0; i
Author: nextgens
Date: 2007-04-01 20:00:26 +0000 (Sun, 01 Apr 2007)
New Revision: 12519
Modified:
trunk/plugins/TranslationHelper/TranslationHelper.java
Log:
Fix my 1.6ism so that it compiles
Modified: trunk/plugins/TranslationHelper/TranslationHelper.java
===================================================================
--- trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-01 19:45:18 UTC (rev 12518)
+++ trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-01 20:00:26 UTC (rev 12519)
@@ -3,8 +3,9 @@
* http://www.gnu.org/ for further details of the GPL. */
package plugins.TranslationHelper;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.StringWriter;
+import java.io.OutputStream;
import java.util.Enumeration;
import java.util.Properties;
@@ -113,11 +114,11 @@
return pageNode.generate();
} else if(request.isParameterSet("getTranlationFile")) {
- StringWriter out = new StringWriter();
+ OutputStream os = new ByteArrayOutputStream();
try {
- editedProperties.store(out, "Translation file for "+editedLang);
+ editedProperties.store(os, "Translation file for "+editedLang);
} catch (IOException e) {} // huh ?
- return out.toString();
+ return os.toString();
}
HTMLNode pageNode = pr.getPageMaker().getPageNode(PLUGIN_NAME+" page", false, null);
From zothar at freenetproject.org Sun Apr 1 20:04:16 2007
From: zothar at freenetproject.org (zothar at freenetproject.org)
Date: Sun, 1 Apr 2007 20:04:16 +0000 (UTC)
Subject: [freenet-cvs] r12520 - trunk/freenet/src/freenet/node
Message-ID: <20070401200416.66848479737@emu.freenetproject.org>
Author: zothar
Date: 2007-04-01 20:04:16 +0000 (Sun, 01 Apr 2007)
New Revision: 12520
Modified:
trunk/freenet/src/freenet/node/PeerNode.java
Log:
Don't add 'idle' to peer node exported volatile data if the peer has never been connected with.
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2007-04-01 20:00:26 UTC (rev 12519)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2007-04-01 20:04:16 UTC (rev 12520)
@@ -1933,7 +1933,7 @@
synchronized(this) {
fs.putSingle("averagePingTime", Double.toString(averagePingTime()));
long idle = now - lastReceivedPacketTime();
- if(idle > (60 * 1000)) { // 1 minute
+ if(idle > (60 * 1000) && -1 != lastReceivedPacketTime()) { // 1 minute
fs.putSingle("idle", Long.toString(idle));
}
if(peerAddedTime > 1) {
From nextgens at freenetproject.org Mon Apr 2 00:53:45 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 00:53:45 +0000 (UTC)
Subject: [freenet-cvs] r12521 - trunk/freenet
Message-ID: <20070402005345.085EE479F2C@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 00:53:44 +0000 (Mon, 02 Apr 2007)
New Revision: 12521
Modified:
trunk/freenet/build.xml
Log:
Commit mario's patch to build.xml:
add junit.location to unit target classpath to MakeItWork(TM)
Modified: trunk/freenet/build.xml
===================================================================
--- trunk/freenet/build.xml 2007-04-01 20:04:16 UTC (rev 12520)
+++ trunk/freenet/build.xml 2007-04-02 00:53:44 UTC (rev 12521)
@@ -140,6 +140,7 @@
+
From nextgens at freenetproject.org Mon Apr 2 14:34:22 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 14:34:22 +0000 (UTC)
Subject: [freenet-cvs] r12523 - trunk/freenet/src/freenet/crypt
Message-ID: <20070402143422.3E913479FA1@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 14:34:22 +0000 (Mon, 02 Apr 2007)
New Revision: 12523
Modified:
trunk/freenet/src/freenet/crypt/DSA.java
Log:
Remove some dead-code
Modified: trunk/freenet/src/freenet/crypt/DSA.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSA.java 2007-04-02 11:33:12 UTC (rev 12522)
+++ trunk/freenet/src/freenet/crypt/DSA.java 2007-04-02 14:34:22 UTC (rev 12523)
@@ -49,22 +49,6 @@
}
/**
- * Precalculates a number of r, kInv pairs given a random source
- */
- public static BigInteger[][] signaturePrecalculate(DSAGroup g,
- int count, Random r) {
- BigInteger[][] result=new BigInteger[count][2];
-
- for (int i=0; i
Author: sback
Date: 2007-04-02 14:40:36 +0000 (Mon, 02 Apr 2007)
New Revision: 12524
Added:
trunk/freenet/test/freenet/crypt/DSATest.java
Log:
DSA.java test cases. Some border cases are still missing
Added: trunk/freenet/test/freenet/crypt/DSATest.java
===================================================================
--- trunk/freenet/test/freenet/crypt/DSATest.java (rev 0)
+++ trunk/freenet/test/freenet/crypt/DSATest.java 2007-04-02 14:40:36 UTC (rev 12524)
@@ -0,0 +1,187 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL.
+ *
+ * DSATest.java
+ * JUnit based test
+ *
+ * @author sback
+ */
+
+package freenet.crypt;
+
+
+import java.math.BigInteger;
+import java.util.Random;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import net.i2p.util.NativeBigInteger;
+
+
+public class DSATest extends TestCase{
+
+ /*-------------FIPS-EXAMPLE-CONSTANTS---------------------------------------
+ * These are the values as they appear in the Appendix 5
+ * "Example of the DSA" of FIPS PUB 186-2.
+ * We can consider them sure examples */
+ private static final BigInteger FIPS_P = new NativeBigInteger(
+ "8df2a494492276aa3d25759bb06869cbeac0d83afb8d0cf7"+
+ "cbb8324f0d7882e5d0762fc5b7210eafc2e9adac32ab7aac"+
+ "49693dfbf83724c2ec0736ee31c80291",16);
+ private static final BigInteger FIPS_Q = new NativeBigInteger(
+ "c773218c737ec8ee993b4f2ded30f48edace915f",16);
+ private static final BigInteger FIPS_G = new NativeBigInteger(
+ "626d027839ea0a13413163a55b4cb500299d5522956cefcb"+
+ "3bff10f399ce2c2e71cb9de5fa24babf58e5b79521925c9c"+
+ "c42e9f6f464b088cc572af53e6d78802",16);
+ private static final BigInteger FIPS_X = new NativeBigInteger(
+ "2070b3223dba372fde1c0ffc7b2e3b498b260614",16);
+ private static final BigInteger FIPS_Y = new NativeBigInteger(
+ "19131871d75b1612a819f29d78d1b0d7346f7aa77bb62a85"+
+ "9bfd6c5675da9d212d3a36ef1672ef660b8c7c255cc0ec74"+
+ "858fba33f44c06699630a76b030ee333",16);
+ private static final BigInteger FIPS_K = new NativeBigInteger(
+ "358dad571462710f50e254cf1a376b2bdeaadfbf",16);
+ private static final BigInteger FIPS_K_INV = new NativeBigInteger(
+ "0d5167298202e49b4116ac104fc3f415ae52f917",16);
+ private static final BigInteger FIPS_SHA1_M = new NativeBigInteger(
+ "a9993e364706816aba3e25717850c26c9cd0d89d",16);
+ private static final BigInteger FIPS_R = new NativeBigInteger(
+ "8bac1ab66410435cb7181f95b16ab97c92b341c0",16);
+ private static final BigInteger FIPS_S = new NativeBigInteger(
+ "41e2345f1f56df2458f426d155b4ba2db6dcd8c8",16);
+ private static final DSAGroup FIPS_DSA_GROUP =
+ new DSAGroup(FIPS_P,FIPS_Q,FIPS_G);
+ private static final DSAPrivateKey FIPS_DSA_PRIVATE_KEY =
+ new DSAPrivateKey(FIPS_X);
+ private static final DSAPublicKey FIPS_DSA_PUBLIC_KEY =
+ new DSAPublicKey(FIPS_DSA_GROUP,FIPS_Y);
+ private static final DSASignature FIPS_DSA_SIGNATURE =
+ new DSASignature(FIPS_R,FIPS_S);
+ /*------------------------------------------------------------------------*/
+
+ private RandomSource randomSource;
+
+ public DSATest(String testName) { super(testName); }
+
+ protected void setUp() throws Exception {
+ randomSource = new DummyRandomSource();
+ }
+
+ protected void tearDown() throws Exception {}
+
+ /**
+ * Test of verify and sign method consistency using FIPS examples.*/
+ public void testSignAndVerify() {
+ System.out.println("signAndVerify");
+
+ DSASignature aSignature =
+ DSA.sign(FIPS_DSA_GROUP, FIPS_DSA_PRIVATE_KEY, FIPS_K, FIPS_SHA1_M, randomSource);
+
+ assertTrue(DSA.verify(FIPS_DSA_PUBLIC_KEY,aSignature,FIPS_SHA1_M,false));
+ }
+
+ /** Test of verify(DSAPublicKey kp,
+ DSASignature sig,
+ BigInteger m, boolean forceMod)
+ * method comparing it with the DSA values
+ * based on FIPS examples */
+ public void testVerify() {
+ System.out.println("testVerify");
+
+ assertTrue(DSA.verify(FIPS_DSA_PUBLIC_KEY,FIPS_DSA_SIGNATURE,FIPS_SHA1_M,false));
+ }
+
+ /**
+ * Test sign method consistency
+ * It performs two signature of the same message
+ * and verifies if they are identical */
+ public void testSameSignConsistency() {
+ System.out.println("sameSignConsistency");
+
+ DSASignature firstSignature =
+ DSA.sign(FIPS_DSA_GROUP, FIPS_DSA_PRIVATE_KEY, FIPS_K, FIPS_SHA1_M, randomSource);
+
+ DSASignature secondSignature =
+ DSA.sign(FIPS_DSA_GROUP, FIPS_DSA_PRIVATE_KEY, FIPS_K, FIPS_SHA1_M, randomSource);
+
+ assertEquals(firstSignature.getR(),secondSignature.getR());
+ assertEquals(firstSignature.getS(),secondSignature.getS());
+ }
+
+ /**
+ * Test sign(DSAGroup g, DSAPrivateKey x, BigInteger m,RandomSource r)
+ * method, using a q value that is too small [shorter than DSAGroup.Q_BIT_LENGTH]
+ * to generate a correct k value */
+ public void testSignSmallQValue(){
+ System.out.println("signWithSmallQValue");
+ try {
+ DSA.sign(FIPS_DSA_GROUP,FIPS_DSA_PRIVATE_KEY,FIPS_SHA1_M,randomSource);
+ } catch (AssertionError anAssertionError) {
+ assertNotNull(anAssertionError);
+ }
+ }
+
+ /**
+ * Test sign(DSAGroup g, DSAPrivateKey x,
+ BigInteger r, BigInteger kInv,
+ BigInteger m, RandomSource random)
+ * method comparing it with the DSASignature
+ * based on FIPS examples */
+ public void testSign_grp_pvtKey_r_kInv_m_rand() {
+ System.out.println("sign(grp,pvtKey,r,kInv,m,rand)");
+
+ DSASignature aSignature =
+ DSA.sign(FIPS_DSA_GROUP,FIPS_DSA_PRIVATE_KEY,FIPS_R,FIPS_K_INV,FIPS_SHA1_M,randomSource);
+
+ assertEquals(aSignature.getR(),FIPS_R);
+ assertEquals(aSignature.getS(),FIPS_S);
+ }
+
+ /**
+ * Test sign(DSAGroup g,
+ DSAPrivateKey x,
+ BigInteger k,
+ BigInteger m,
+ RandomSource random)
+ * method comparing it with the DSASignature
+ * based on FIPS examples */
+ public void testSign_grp_pvtKey_k_m_rand() {
+ System.out.println("sign(grp,pvtKey,k,m,rand)");
+
+ DSASignature aSignature =
+ DSA.sign(FIPS_DSA_GROUP,FIPS_DSA_PRIVATE_KEY,FIPS_K,FIPS_SHA1_M,randomSource);
+
+ assertEquals(aSignature.getR(),FIPS_R);
+ assertEquals(aSignature.getS(),FIPS_S);
+ }
+
+ /**
+ * Test sign(DSAGroup g, DSAPrivateKey x, BigInteger m,
+ RandomSource r)
+ * method using verify method.
+ * As the verify test passed, then we can consider it
+ * a tested way to verify this sign method accuracy,
+ * since it is impossible to test it using
+ * FIPS Examples [as they are based on SHA1 and thus they use
+ * q values that are shorter than current DSAGroup.Q_BIT_LENGTH].*/
+ public void testSign_grp_pvtKey_m_rand() {
+ System.out.println("sign(grp,pvtKey,m,rand)");
+
+ DSAGroup aDSAgroup = Global.DSAgroupBigA;
+
+ System.out.println(aDSAgroup.getQ().bitCount());
+
+ DSAPrivateKey aDSAPrivKey=new DSAPrivateKey(aDSAgroup,randomSource);
+ DSAPublicKey aDSAPubKey=new DSAPublicKey(aDSAgroup,aDSAPrivKey);
+ DSASignature aSignature=
+ DSA.sign(aDSAgroup,aDSAPrivKey,BigInteger.ZERO,randomSource);
+
+ assertTrue(DSA.verify(aDSAPubKey,aSignature,BigInteger.ZERO,false));
+ }
+
+
+}
+
+
+
From nextgens at freenetproject.org Mon Apr 2 17:46:42 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 17:46:42 +0000 (UTC)
Subject: [freenet-cvs] r12525 - trunk/freenet/src/freenet/clients/http
Message-ID: <20070402174642.B0E6C479742@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 17:46:42 +0000 (Mon, 02 Apr 2007)
New Revision: 12525
Modified:
trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
Log:
Allow plugins to send HTTP redirects
Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-04-02 14:40:36 UTC (rev 12524)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-04-02 17:46:42 UTC (rev 12525)
@@ -71,10 +71,15 @@
writeReply(ctx, 200, "text/html", "OK", pm.handleHTTPPost(plugin, request));
}
- catch(PluginHTTPException e)
+ catch(PluginHTTPException ex)
{
// TODO: make it into html
- writeReply(ctx, e.getCode(), e.getMimeType(), e.getDesc(), e.getReply());
+ if((ex.getCode() < 400) && (ex.getCode() >= 300)) {
+ headers = new MultiValueTable();
+ headers.put("Location", ex.getReply());
+ ctx.sendReplyHeaders(ex.getCode(), "Found", headers, null, 0);
+ }else
+ writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
}
catch(Throwable t)
{
@@ -196,9 +201,7 @@
// Plugin may need to know where it was accessed from, so it can e.g. produce relative URLs.
//writeReply(ctx, 200, "text/html", "OK", mkPage("plugin", pm.handleHTTPGet(plugin, data)));
- writeReply(ctx, 200, "text/html", "OK", pm.handleHTTPGet(plugin, request));
-
-
+ writeReply(ctx, 200, "text/html", "OK", pm.handleHTTPGet(plugin, request));
}
//FetchResult result = fetch(key);
@@ -206,7 +209,12 @@
} catch (PluginHTTPException ex) {
// TODO: make it into html
- writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
+ if((ex.getCode() < 400) && (ex.getCode() >= 300)) {
+ MultiValueTable headers = new MultiValueTable();
+ headers.put("Location", ex.getReply());
+ ctx.sendReplyHeaders(ex.getCode(), "Found", headers, null, 0);
+ }else
+ writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
} catch (Throwable t) {
Logger.error(this, "Caught "+t, t);
String msg = "Internal ErrorInternal Error: please report
";
From nextgens at freenetproject.org Mon Apr 2 17:47:58 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 17:47:58 +0000 (UTC)
Subject: [freenet-cvs] r12526 - trunk/plugins/TranslationHelper
Message-ID: <20070402174758.A5C6E47983D@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 17:47:58 +0000 (Mon, 02 Apr 2007)
New Revision: 12526
Modified:
trunk/plugins/TranslationHelper/TranslationHelper.java
Log:
TranslationHelper: remove useless confirmation screens
Modified: trunk/plugins/TranslationHelper/TranslationHelper.java
===================================================================
--- trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-02 17:46:42 UTC (rev 12525)
+++ trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-02 17:47:58 UTC (rev 12526)
@@ -163,36 +163,10 @@
editedProperties.setProperty(key, request.getPartAsString(key, 256));
}
- HTMLNode pageNode = pr.getPageMaker().getPageNode(PLUGIN_NAME+" page", false, null);
- HTMLNode contentNode = pr.getPageMaker().getContentNode(pageNode);
-
- HTMLNode returnToPluginInfobox = contentNode.addChild("div", "class", "infobox infobox-normal");
- HTMLNode returnToPluginInfoboxHeader = returnToPluginInfobox.addChild("div", "class", "infobox-header");
- HTMLNode returnToPluginInfoboxContent = returnToPluginInfobox.addChild("div", "class", "infobox-content");
-
- returnToPluginInfoboxHeader.addChild("#", "Changes have been taken into account");
-
- returnToPluginInfoboxContent.addChild("#","Your changes have been taken into account. Please ");
- returnToPluginInfoboxContent.addChild("a", "href", PLUGIN_BASE_URL+"?lang="+editedLang).addChild("#", "click here to continue.");
- returnToPluginInfoboxContent.addChild("%", " ");
- returnToPluginInfoboxContent.addChild("a", "href", PLUGIN_BASE_URL).addChild("#", "Return to the plugin's main page");
- return pageNode.generate();
+ throw new PluginHTTPException(302, "", "Found", PLUGIN_BASE_URL+"?lang="+editedLang);
}else if(request.isPartSet("reload")) {
editedProperties = L10n.loadProperties(editedLang);
- HTMLNode pageNode = pr.getPageMaker().getPageNode(PLUGIN_NAME+" page", false, null);
- HTMLNode contentNode = pr.getPageMaker().getContentNode(pageNode);
-
- HTMLNode returnToPluginInfobox = contentNode.addChild("div", "class", "infobox infobox-normal");
- HTMLNode returnToPluginInfoboxHeader = returnToPluginInfobox.addChild("div", "class", "infobox-header");
- HTMLNode returnToPluginInfoboxContent = returnToPluginInfobox.addChild("div", "class", "infobox-content");
-
- returnToPluginInfoboxHeader.addChild("#", "Changes have been taken into account");
-
- returnToPluginInfoboxContent.addChild("#","Your changes have been taken into account. Please ");
- returnToPluginInfoboxContent.addChild("a", "href", PLUGIN_BASE_URL+"?lang="+editedLang).addChild("#", "click here to continue.");
- returnToPluginInfoboxContent.addChild("%", " ");
- returnToPluginInfoboxContent.addChild("a", "href", PLUGIN_BASE_URL).addChild("#", "Return to the plugin's main page");
- return pageNode.generate();
+ throw new PluginHTTPException(302, "", "Found", PLUGIN_BASE_URL+"?lang="+editedLang);
}
return null;
}
From nextgens at freenetproject.org Mon Apr 2 18:19:36 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 18:19:36 +0000 (UTC)
Subject: [freenet-cvs] r12527 - trunk/freenet/test/freenet/crypt
Message-ID: <20070402181936.95552479ED2@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 18:19:36 +0000 (Mon, 02 Apr 2007)
New Revision: 12527
Removed:
trunk/freenet/test/freenet/crypt/DSATest.java
Log:
revert r12524: sback's test doesn't run in reasonnable times
Deleted: trunk/freenet/test/freenet/crypt/DSATest.java
===================================================================
--- trunk/freenet/test/freenet/crypt/DSATest.java 2007-04-02 17:47:58 UTC (rev 12526)
+++ trunk/freenet/test/freenet/crypt/DSATest.java 2007-04-02 18:19:36 UTC (rev 12527)
@@ -1,187 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL.
- *
- * DSATest.java
- * JUnit based test
- *
- * @author sback
- */
-
-package freenet.crypt;
-
-
-import java.math.BigInteger;
-import java.util.Random;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import net.i2p.util.NativeBigInteger;
-
-
-public class DSATest extends TestCase{
-
- /*-------------FIPS-EXAMPLE-CONSTANTS---------------------------------------
- * These are the values as they appear in the Appendix 5
- * "Example of the DSA" of FIPS PUB 186-2.
- * We can consider them sure examples */
- private static final BigInteger FIPS_P = new NativeBigInteger(
- "8df2a494492276aa3d25759bb06869cbeac0d83afb8d0cf7"+
- "cbb8324f0d7882e5d0762fc5b7210eafc2e9adac32ab7aac"+
- "49693dfbf83724c2ec0736ee31c80291",16);
- private static final BigInteger FIPS_Q = new NativeBigInteger(
- "c773218c737ec8ee993b4f2ded30f48edace915f",16);
- private static final BigInteger FIPS_G = new NativeBigInteger(
- "626d027839ea0a13413163a55b4cb500299d5522956cefcb"+
- "3bff10f399ce2c2e71cb9de5fa24babf58e5b79521925c9c"+
- "c42e9f6f464b088cc572af53e6d78802",16);
- private static final BigInteger FIPS_X = new NativeBigInteger(
- "2070b3223dba372fde1c0ffc7b2e3b498b260614",16);
- private static final BigInteger FIPS_Y = new NativeBigInteger(
- "19131871d75b1612a819f29d78d1b0d7346f7aa77bb62a85"+
- "9bfd6c5675da9d212d3a36ef1672ef660b8c7c255cc0ec74"+
- "858fba33f44c06699630a76b030ee333",16);
- private static final BigInteger FIPS_K = new NativeBigInteger(
- "358dad571462710f50e254cf1a376b2bdeaadfbf",16);
- private static final BigInteger FIPS_K_INV = new NativeBigInteger(
- "0d5167298202e49b4116ac104fc3f415ae52f917",16);
- private static final BigInteger FIPS_SHA1_M = new NativeBigInteger(
- "a9993e364706816aba3e25717850c26c9cd0d89d",16);
- private static final BigInteger FIPS_R = new NativeBigInteger(
- "8bac1ab66410435cb7181f95b16ab97c92b341c0",16);
- private static final BigInteger FIPS_S = new NativeBigInteger(
- "41e2345f1f56df2458f426d155b4ba2db6dcd8c8",16);
- private static final DSAGroup FIPS_DSA_GROUP =
- new DSAGroup(FIPS_P,FIPS_Q,FIPS_G);
- private static final DSAPrivateKey FIPS_DSA_PRIVATE_KEY =
- new DSAPrivateKey(FIPS_X);
- private static final DSAPublicKey FIPS_DSA_PUBLIC_KEY =
- new DSAPublicKey(FIPS_DSA_GROUP,FIPS_Y);
- private static final DSASignature FIPS_DSA_SIGNATURE =
- new DSASignature(FIPS_R,FIPS_S);
- /*------------------------------------------------------------------------*/
-
- private RandomSource randomSource;
-
- public DSATest(String testName) { super(testName); }
-
- protected void setUp() throws Exception {
- randomSource = new DummyRandomSource();
- }
-
- protected void tearDown() throws Exception {}
-
- /**
- * Test of verify and sign method consistency using FIPS examples.*/
- public void testSignAndVerify() {
- System.out.println("signAndVerify");
-
- DSASignature aSignature =
- DSA.sign(FIPS_DSA_GROUP, FIPS_DSA_PRIVATE_KEY, FIPS_K, FIPS_SHA1_M, randomSource);
-
- assertTrue(DSA.verify(FIPS_DSA_PUBLIC_KEY,aSignature,FIPS_SHA1_M,false));
- }
-
- /** Test of verify(DSAPublicKey kp,
- DSASignature sig,
- BigInteger m, boolean forceMod)
- * method comparing it with the DSA values
- * based on FIPS examples */
- public void testVerify() {
- System.out.println("testVerify");
-
- assertTrue(DSA.verify(FIPS_DSA_PUBLIC_KEY,FIPS_DSA_SIGNATURE,FIPS_SHA1_M,false));
- }
-
- /**
- * Test sign method consistency
- * It performs two signature of the same message
- * and verifies if they are identical */
- public void testSameSignConsistency() {
- System.out.println("sameSignConsistency");
-
- DSASignature firstSignature =
- DSA.sign(FIPS_DSA_GROUP, FIPS_DSA_PRIVATE_KEY, FIPS_K, FIPS_SHA1_M, randomSource);
-
- DSASignature secondSignature =
- DSA.sign(FIPS_DSA_GROUP, FIPS_DSA_PRIVATE_KEY, FIPS_K, FIPS_SHA1_M, randomSource);
-
- assertEquals(firstSignature.getR(),secondSignature.getR());
- assertEquals(firstSignature.getS(),secondSignature.getS());
- }
-
- /**
- * Test sign(DSAGroup g, DSAPrivateKey x, BigInteger m,RandomSource r)
- * method, using a q value that is too small [shorter than DSAGroup.Q_BIT_LENGTH]
- * to generate a correct k value */
- public void testSignSmallQValue(){
- System.out.println("signWithSmallQValue");
- try {
- DSA.sign(FIPS_DSA_GROUP,FIPS_DSA_PRIVATE_KEY,FIPS_SHA1_M,randomSource);
- } catch (AssertionError anAssertionError) {
- assertNotNull(anAssertionError);
- }
- }
-
- /**
- * Test sign(DSAGroup g, DSAPrivateKey x,
- BigInteger r, BigInteger kInv,
- BigInteger m, RandomSource random)
- * method comparing it with the DSASignature
- * based on FIPS examples */
- public void testSign_grp_pvtKey_r_kInv_m_rand() {
- System.out.println("sign(grp,pvtKey,r,kInv,m,rand)");
-
- DSASignature aSignature =
- DSA.sign(FIPS_DSA_GROUP,FIPS_DSA_PRIVATE_KEY,FIPS_R,FIPS_K_INV,FIPS_SHA1_M,randomSource);
-
- assertEquals(aSignature.getR(),FIPS_R);
- assertEquals(aSignature.getS(),FIPS_S);
- }
-
- /**
- * Test sign(DSAGroup g,
- DSAPrivateKey x,
- BigInteger k,
- BigInteger m,
- RandomSource random)
- * method comparing it with the DSASignature
- * based on FIPS examples */
- public void testSign_grp_pvtKey_k_m_rand() {
- System.out.println("sign(grp,pvtKey,k,m,rand)");
-
- DSASignature aSignature =
- DSA.sign(FIPS_DSA_GROUP,FIPS_DSA_PRIVATE_KEY,FIPS_K,FIPS_SHA1_M,randomSource);
-
- assertEquals(aSignature.getR(),FIPS_R);
- assertEquals(aSignature.getS(),FIPS_S);
- }
-
- /**
- * Test sign(DSAGroup g, DSAPrivateKey x, BigInteger m,
- RandomSource r)
- * method using verify method.
- * As the verify test passed, then we can consider it
- * a tested way to verify this sign method accuracy,
- * since it is impossible to test it using
- * FIPS Examples [as they are based on SHA1 and thus they use
- * q values that are shorter than current DSAGroup.Q_BIT_LENGTH].*/
- public void testSign_grp_pvtKey_m_rand() {
- System.out.println("sign(grp,pvtKey,m,rand)");
-
- DSAGroup aDSAgroup = Global.DSAgroupBigA;
-
- System.out.println(aDSAgroup.getQ().bitCount());
-
- DSAPrivateKey aDSAPrivKey=new DSAPrivateKey(aDSAgroup,randomSource);
- DSAPublicKey aDSAPubKey=new DSAPublicKey(aDSAgroup,aDSAPrivKey);
- DSASignature aSignature=
- DSA.sign(aDSAgroup,aDSAPrivKey,BigInteger.ZERO,randomSource);
-
- assertTrue(DSA.verify(aDSAPubKey,aSignature,BigInteger.ZERO,false));
- }
-
-
-}
-
-
-
From nextgens at freenetproject.org Mon Apr 2 18:54:57 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 18:54:57 +0000 (UTC)
Subject: [freenet-cvs] r12528 - in trunk/freenet/src/freenet: clients/http
pluginmanager
Message-ID: <20070402185457.E3D6E479F38@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 18:54:57 +0000 (Mon, 02 Apr 2007)
New Revision: 12528
Modified:
trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
trunk/freenet/src/freenet/pluginmanager/PluginHTTPException.java
Log:
Extend the plugin framework a bit... maybe I need to do .getByte("UTF-8") though... I don't know
Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-04-02 18:19:36 UTC (rev 12527)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-04-02 18:54:57 UTC (rev 12528)
@@ -74,10 +74,10 @@
catch(PluginHTTPException ex)
{
// TODO: make it into html
- if((ex.getCode() < 400) && (ex.getCode() >= 300)) {
- headers = new MultiValueTable();
- headers.put("Location", ex.getReply());
- ctx.sendReplyHeaders(ex.getCode(), "Found", headers, null, 0);
+ if(ex.getHeaders() != null) {
+ String data = ex.getReply();
+ ctx.sendReplyHeaders(ex.getCode(), "Found", ex.getHeaders(), ex.getMimeType(), (data == null ? 0 : data.length()));
+ ctx.writeData(data.getBytes());
}else
writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
}
@@ -209,10 +209,10 @@
} catch (PluginHTTPException ex) {
// TODO: make it into html
- if((ex.getCode() < 400) && (ex.getCode() >= 300)) {
- MultiValueTable headers = new MultiValueTable();
- headers.put("Location", ex.getReply());
- ctx.sendReplyHeaders(ex.getCode(), "Found", headers, null, 0);
+ if(ex.getHeaders() != null) {
+ String data = ex.getReply();
+ ctx.sendReplyHeaders(ex.getCode(), "Found", ex.getHeaders(), ex.getMimeType(), (data == null ? 0 : data.length()));
+ ctx.writeData(data.getBytes());
}else
writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
} catch (Throwable t) {
Modified: trunk/freenet/src/freenet/pluginmanager/PluginHTTPException.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginHTTPException.java 2007-04-02 18:19:36 UTC (rev 12527)
+++ trunk/freenet/src/freenet/pluginmanager/PluginHTTPException.java 2007-04-02 18:54:57 UTC (rev 12528)
@@ -3,6 +3,8 @@
* http://www.gnu.org/ for further details of the GPL. */
package freenet.pluginmanager;
+import freenet.support.MultiValueTable;
+
public class PluginHTTPException extends Exception {
private static final long serialVersionUID = -1;
@@ -10,7 +12,7 @@
private String mimeType;
private String desc;
private String reply;
-
+ private MultiValueTable headers = null;
public PluginHTTPException () {
this(404, "text/html", "FAIL", "Page not found");
@@ -21,6 +23,14 @@
this.desc = desc;
this.reply = reply;
}
+
+ public PluginHTTPException (int code, String desc, MultiValueTable headers, String mimeType, String reply) {
+ this.code = code;
+ this.desc = desc;
+ this.headers = headers;
+ this.mimeType = mimeType;
+ this.reply = reply;
+ }
public void setCode(int code) {
// FIXME: check!
@@ -47,5 +57,7 @@
public String getReply() {
return reply;
}
-
+ public MultiValueTable getHeaders() {
+ return headers;
+ }
}
From nextgens at freenetproject.org Mon Apr 2 18:56:12 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 18:56:12 +0000 (UTC)
Subject: [freenet-cvs] r12529 - trunk/plugins/TranslationHelper
Message-ID: <20070402185612.12873479F66@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 18:56:11 +0000 (Mon, 02 Apr 2007)
New Revision: 12529
Modified:
trunk/plugins/TranslationHelper/TranslationHelper.java
Log:
TranslationHelper: now translation files will be downloaded to disk.
Modified: trunk/plugins/TranslationHelper/TranslationHelper.java
===================================================================
--- trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-02 18:54:57 UTC (rev 12528)
+++ trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-02 18:56:11 UTC (rev 12529)
@@ -16,6 +16,7 @@
import freenet.pluginmanager.PluginHTTPException;
import freenet.pluginmanager.PluginRespirator;
import freenet.support.HTMLNode;
+import freenet.support.MultiValueTable;
import freenet.support.api.HTTPRequest;
/**
@@ -113,12 +114,16 @@
contentRow.addChild("a", "href", PLUGIN_BASE_URL).addChild("#", "Return to the plugin's main page");
return pageNode.generate();
+ // It doesn't help: we need to decode unicode characters!
+ //throw new PluginHTTPException(200, "text/html; charset=ISO-8859-1", "Found", pageNode.generate());
} else if(request.isParameterSet("getTranlationFile")) {
OutputStream os = new ByteArrayOutputStream();
try {
editedProperties.store(os, "Translation file for "+editedLang);
} catch (IOException e) {} // huh ?
- return os.toString();
+ MultiValueTable headers = new MultiValueTable();
+ headers.put("Content-Disposition", "attachment; filename=\"" + "freenet.l10n."+editedLang+".properties" + '"');
+ throw new PluginHTTPException(200, "Ok", headers, "text/plain", os.toString());
}
HTMLNode pageNode = pr.getPageMaker().getPageNode(PLUGIN_NAME+" page", false, null);
@@ -151,7 +156,6 @@
// "a new one"
// );
-
return pageNode.generate();
}
@@ -163,10 +167,15 @@
editedProperties.setProperty(key, request.getPartAsString(key, 256));
}
- throw new PluginHTTPException(302, "", "Found", PLUGIN_BASE_URL+"?lang="+editedLang);
+ MultiValueTable headers = new MultiValueTable();
+ headers.put("Location", PLUGIN_BASE_URL+"?lang="+editedLang);
+ throw new PluginHTTPException(302, "Found", headers, null, null);
}else if(request.isPartSet("reload")) {
editedProperties = L10n.loadProperties(editedLang);
- throw new PluginHTTPException(302, "", "Found", PLUGIN_BASE_URL+"?lang="+editedLang);
+
+ MultiValueTable headers = new MultiValueTable();
+ headers.put("Location", PLUGIN_BASE_URL+"?lang="+editedLang);
+ throw new PluginHTTPException(302, "Found", headers, null, null);
}
return null;
}
From nextgens at freenetproject.org Mon Apr 2 21:14:48 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 21:14:48 +0000 (UTC)
Subject: [freenet-cvs] r12530 - trunk/freenet/src/freenet/clients/http
Message-ID: <20070402211448.2AC73479825@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 21:14:48 +0000 (Mon, 02 Apr 2007)
New Revision: 12530
Modified:
trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
Log:
Doh
Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-04-02 18:56:11 UTC (rev 12529)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-04-02 21:14:48 UTC (rev 12530)
@@ -77,7 +77,8 @@
if(ex.getHeaders() != null) {
String data = ex.getReply();
ctx.sendReplyHeaders(ex.getCode(), "Found", ex.getHeaders(), ex.getMimeType(), (data == null ? 0 : data.length()));
- ctx.writeData(data.getBytes());
+ if(data != null)
+ ctx.writeData(data.getBytes());
}else
writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
}
@@ -212,7 +213,8 @@
if(ex.getHeaders() != null) {
String data = ex.getReply();
ctx.sendReplyHeaders(ex.getCode(), "Found", ex.getHeaders(), ex.getMimeType(), (data == null ? 0 : data.length()));
- ctx.writeData(data.getBytes());
+ if(data != null)
+ ctx.writeData(data.getBytes());
}else
writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
} catch (Throwable t) {
From nextgens at freenetproject.org Mon Apr 2 21:22:12 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 21:22:12 +0000 (UTC)
Subject: [freenet-cvs] r12531 - trunk/freenet/src/freenet/clients/http
Message-ID: <20070402212212.B6FEC4798D2@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 21:22:12 +0000 (Mon, 02 Apr 2007)
New Revision: 12531
Modified:
trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
Log:
WelcomeToadlet: don't let the browser hang onto a POST while stopping/restarting the node... Handle "refresh" properly
Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2007-04-02 21:14:48 UTC (rev 12530)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2007-04-02 21:22:12 UTC (rev 12531)
@@ -378,28 +378,30 @@
redirectToRoot(ctx);
return;
}
- // Tell the user that the node is shutting down
- HTMLNode pageNode = ctx.getPageMaker().getPageNode("Node Shutdown", false, ctx);
- HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
- HTMLNode infobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-information", "The Freenet node has been successfully shut down."));
- HTMLNode infoboxContent = ctx.getPageMaker().getContentNode(infobox);
- infoboxContent.addChild("#", "Thank you for using Freenet.");
- writeReply(ctx, 200, "text/html; charset=utf-8", "OK", pageNode.generate());
- this.node.exit("Shutdown from fproxy");
+ MultiValueTable headers = new MultiValueTable();
+ headers.put("Location", "/?terminated&formPassword=" + core.formPassword);
+ ctx.sendReplyHeaders(302, "Found", headers, null, 0);
+ node.ps.queueTimedJob(new Runnable(){
+ public void run() {
+ node.exit("Shutdown from fproxy");
+ }
+ }, 1);
+ return;
}else if(request.isPartSet("restartconfirm")){
if(noPassword) {
redirectToRoot(ctx);
return;
}
- // Tell the user that the node is restarting
- HTMLNode pageNode = ctx.getPageMaker().getPageNode("Node Restart", false, ctx);
- HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
- HTMLNode infobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-information", "The Freenet is being restarted."));
- HTMLNode infoboxContent = ctx.getPageMaker().getContentNode(infobox);
- infoboxContent.addChild("#", "Please wait while the node is being restarted. This might take up to 3 minutes. Thank you for using Freenet.");
- writeReply(ctx, 200, "text/html; charset=utf-8", "OK", pageNode.generate());
- Logger.normal(this, "Node is restarting");
- node.getNodeStarter().restart();
+
+ MultiValueTable headers = new MultiValueTable();
+ headers.put("Location", "/?restarted&formPassword=" + core.formPassword);
+ ctx.sendReplyHeaders(302, "Found", headers, null, 0);
+ node.ps.queueTimedJob(new Runnable(){
+ public void run() {
+ node.getNodeStarter().restart();
+ }
+ }, 1);
+ return;
}else {
redirectToRoot(ctx);
}
@@ -448,6 +450,33 @@
this.writeReply(ctx, 200, "text/plain", "OK", sw.toString());
return;
+ } else if (request.isParameterSet("terminated")) {
+ if((!request.isParameterSet("formPassword")) || !request.getParam("formPassword").equals(core.formPassword)) {
+ redirectToRoot(ctx);
+ return;
+ }
+ // Tell the user that the node is shutting down
+ HTMLNode pageNode = ctx.getPageMaker().getPageNode("Node Shutdown", false, ctx);
+ HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
+ HTMLNode infobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-information", "The Freenet node has been successfully shut down."));
+ HTMLNode infoboxContent = ctx.getPageMaker().getContentNode(infobox);
+ infoboxContent.addChild("#", "Thank you for using Freenet.");
+ this.writeReply(ctx, 200, "text/html; charset=utf-8", "OK", pageNode.generate());
+ return;
+ } else if (request.isParameterSet("restarted")) {
+ if((!request.isParameterSet("formPassword")) || !request.getParam("formPassword").equals(core.formPassword)) {
+ redirectToRoot(ctx);
+ return;
+ }
+ // Tell the user that the node is restarting
+ HTMLNode pageNode = ctx.getPageMaker().getPageNode("Node Restart", false, ctx);
+ HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
+ HTMLNode infobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-information", "The Freenet is being restarted."));
+ HTMLNode infoboxContent = ctx.getPageMaker().getContentNode(infobox);
+ infoboxContent.addChild("#", "Please wait while the node is being restarted. This might take up to 3 minutes. Thank you for using Freenet.");
+ writeReply(ctx, 200, "text/html; charset=utf-8", "OK", pageNode.generate());
+ Logger.normal(this, "Node is restarting");
+ return;
}else if (request.getParam("newbookmark").length() > 0) {
HTMLNode pageNode = ctx.getPageMaker().getPageNode("Add a Bookmark", ctx);
HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
From nextgens at freenetproject.org Mon Apr 2 21:40:49 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 21:40:49 +0000 (UTC)
Subject: [freenet-cvs] r12532 - trunk/freenet/src/freenet/crypt
Message-ID: <20070402214049.ADE1E47972A@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 21:40:49 +0000 (Mon, 02 Apr 2007)
New Revision: 12532
Modified:
trunk/freenet/src/freenet/crypt/DSA.java
Log:
Send an IllegalArgumentException insteed of an AssertionError in DSA.java
Modified: trunk/freenet/src/freenet/crypt/DSA.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSA.java 2007-04-02 21:22:12 UTC (rev 12531)
+++ trunk/freenet/src/freenet/crypt/DSA.java 2007-04-02 21:40:49 UTC (rev 12532)
@@ -66,7 +66,8 @@
}
private static BigInteger generateK(DSAGroup g, Random r){
- assert g.getQ().bitLength() >= DSAGroup.Q_BIT_LENGTH;
+ if(g.getQ().bitLength() < DSAGroup.Q_BIT_LENGTH)
+ throw new IllegalArgumentException("Q is too short! (" + g.getQ().bitLength() + '<' + DSAGroup.Q_BIT_LENGTH + ')');
BigInteger k;
do {
From nextgens at freenetproject.org Mon Apr 2 23:35:37 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Mon, 2 Apr 2007 23:35:37 +0000 (UTC)
Subject: [freenet-cvs] r12533 - trunk/plugins/TranslationHelper
Message-ID: <20070402233537.049FA479F2A@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-02 23:35:36 +0000 (Mon, 02 Apr 2007)
New Revision: 12533
Modified:
trunk/plugins/TranslationHelper/TranslationHelper.java
Log:
TranslationHelper: now french unicode characters are looking "normal"; It's a hack wich probably won't work with other encodings.
Modified: trunk/plugins/TranslationHelper/TranslationHelper.java
===================================================================
--- trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-02 21:40:49 UTC (rev 12532)
+++ trunk/plugins/TranslationHelper/TranslationHelper.java 2007-04-02 23:35:36 UTC (rev 12533)
@@ -92,10 +92,26 @@
contentRow.addChild("td", "class", "translation-orig",
L10n.getDefaultString(key)
);
+ String newValue = editedProperties.getProperty(key);
+
+ // Deal with unicode characters:
+ // It works for french characters: I'm not sure about others.
+ StringBuffer sb = new StringBuffer();
+ int index = 0;
+ while (index <= newValue.length() - 1) {
+ if(newValue.charAt(index) == (char)195) { // unicode marker
+ char generatedChar = (char)((195 & 11110000) + (newValue.charAt(index + 1)));
+ sb.append(generatedChar);
+ index++;
+ }else
+ sb.append(newValue.charAt(index));
+ index++;
+ }
+
contentRow.addChild("td", "class", "translation-new").addChild(
"input",
new String[] { "type", "name", "value" },
- new String[] { "text", key, editedProperties.getProperty(key)
+ new String[] { "text", key, sb.toString()
});
}
HTMLNode contentRow = legendTable.addChild("tr");
From nextgens at freenetproject.org Tue Apr 3 00:29:41 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Tue, 3 Apr 2007 00:29:41 +0000 (UTC)
Subject: [freenet-cvs] r12534 - trunk/plugins/UPnP
Message-ID: <20070403002941.665D8479FAC@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-03 00:29:41 +0000 (Tue, 03 Apr 2007)
New Revision: 12534
Modified:
trunk/plugins/UPnP/UPnP.java
Log:
UPnP: query for ActionsArguments as well
Modified: trunk/plugins/UPnP/UPnP.java
===================================================================
--- trunk/plugins/UPnP/UPnP.java 2007-04-02 23:35:36 UTC (rev 12533)
+++ trunk/plugins/UPnP/UPnP.java 2007-04-03 00:29:41 UTC (rev 12534)
@@ -4,6 +4,11 @@
package plugins.UPnP;
import java.util.LinkedList;
+
+import plugins.UPnP.org.cybergarage.upnp.Action;
+import plugins.UPnP.org.cybergarage.upnp.ActionList;
+import plugins.UPnP.org.cybergarage.upnp.Argument;
+import plugins.UPnP.org.cybergarage.upnp.ArgumentList;
import plugins.UPnP.org.cybergarage.upnp.ControlPoint;
import plugins.UPnP.org.cybergarage.upnp.Device;
import plugins.UPnP.org.cybergarage.upnp.DeviceList;
@@ -26,7 +31,6 @@
*
* @see http://www.upnp.org/
* @see http://en.wikipedia.org/wiki/Universal_Plug_and_Play
- * @see http://azureus.sourceforge.net/
*/
public class UPnP implements FredPluginHTTP, FredPlugin, FredPluginThreadless, DeviceChangeListener {
private ControlPoint upnpControlPoint;
@@ -63,7 +67,27 @@
}
sb.append("");
}
+
+ private void listActionsArguments(Action action, StringBuffer sb) {
+ ArgumentList ar = action.getArgumentList();
+ for(int i=0; iargument ("+i+") :" + argument.getName()+"");
+ }
+ }
+ private void listActions(Service service, StringBuffer sb) {
+ ActionList al = service.getActionList();
+ for(int i=0; iaction ("+i+") :" + action.getName());
+ listActionsArguments(action, sb);
+ sb.append("");
+ }
+ }
+
private void listSubServices(Device dev, StringBuffer sb) {
ServiceList sl = dev.getServiceList();
for(int i=0; i");
}else
sb.append("~~~~~~~ "+serv.getServiceType());
+ listActions(serv, sb);
listStateTable(serv, sb);
sb.append("");
}
@@ -147,22 +172,6 @@
Device dev = rootDevList.getDevice(i);
if(!"urn:schemas-upnp-org:device:InternetGatewayDevice:1".equals(dev.getDeviceType())) continue;
listSubDev("WANDevice", dev, sb);
-
-
- //Service wanCommonInterfaceConfig = wan.getService("WANCommonInterfaceConfig");
- //sb.append("status:" + wanCommonInterfaceConfig.getStateVariable("PhysicalLinkStatus") + " type:" + wanCommonInterfaceConfig.getStateVariable("WANAccessType") + " upstream:" + wanCommonInterfaceConfig.getStateVariable("Layer1UpstreamMaxBitRate") + " downstream:" + wanCommonInterfaceConfig.getStateVariable("Layer1DownstreamMaxBitRate"));
- Device wan = dev.getDevice("WANDevice");
- Device wanConnectionDevice = wan.getDevice("WANConnectionDevice");
- if(wanConnectionDevice == null) break;
- System.out.println(wanConnectionDevice.getDeviceList().getDevice(0).getDeviceType());
- Device wanIPConnectionDevice = dev.getDevice("WANIPConnectionDevice");
- if(wanIPConnectionDevice == null) break;
- System.out.println(wanIPConnectionDevice.getDeviceList().getDevice(0).getDeviceType());
-
- StateVariable type = wanIPConnectionDevice.getStateVariable("ConnectionType");
- StateVariable ip = wanIPConnectionDevice.getStateVariable("ExternalIPAddress");
-
- sb.append("[" + i + "] : " + dev.getFriendlyName() + " : "+ type.getValue() + ip.getValue() + "
");
}
sb.append("");
From toad at freenetproject.org Tue Apr 3 15:58:50 2007
From: toad at freenetproject.org (toad at freenetproject.org)
Date: Tue, 3 Apr 2007 15:58:50 +0000 (UTC)
Subject: [freenet-cvs] r12535 - trunk/freenet/src/freenet/node
Message-ID: <20070403155850.D5AE5479FDD@emu.freenetproject.org>
Author: toad
Date: 2007-04-03 15:58:50 +0000 (Tue, 03 Apr 2007)
New Revision: 12535
Modified:
trunk/freenet/src/freenet/node/NodeStarter.java
Log:
logging
Modified: trunk/freenet/src/freenet/node/NodeStarter.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStarter.java 2007-04-03 00:29:41 UTC (rev 12534)
+++ trunk/freenet/src/freenet/node/NodeStarter.java 2007-04-03 15:58:50 UTC (rev 12535)
@@ -209,6 +209,7 @@
*/
public int stop( int exitCode )
{
+ System.err.println("Shutting down with exit code "+exitCode);
node.park();
// see #354
WrapperManager.signalStopping(120000);
From toad at freenetproject.org Tue Apr 3 16:03:28 2007
From: toad at freenetproject.org (toad at freenetproject.org)
Date: Tue, 3 Apr 2007 16:03:28 +0000 (UTC)
Subject: [freenet-cvs] r12536 - trunk/freenet/src/freenet/store
Message-ID: <20070403160328.7A2F0479FF4@emu.freenetproject.org>
Author: toad
Date: 2007-04-03 16:03:28 +0000 (Tue, 03 Apr 2007)
New Revision: 12536
Modified:
trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
logging (mostly)
Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2007-04-03 15:58:50 UTC (rev 12535)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2007-04-03 16:03:28 UTC (rev 12536)
@@ -492,8 +492,10 @@
try {
atime = environment.openSecondaryDatabase
(null, prefix+"CHK_accessTime", chkDB, secDbConfig);
- if(atime.count() < chkDB.count()) {
- System.err.println("Access times database: "+atime.count()+" but main database: "+chkDB.count());
+ long chkDBCount = chkDB.count();
+ long atimeCount = atime.count();
+ if(atimeCount < chkDBCount) {
+ System.err.println("Access times database: "+atimeCount+" but main database: "+chkDBCount);
throw new DatabaseException("Needs repopulation");
}
} catch (DatabaseException e) {
@@ -537,7 +539,9 @@
System.err.println("Opening block db index");
blockNums = environment.openSecondaryDatabase
(null, prefix+"CHK_blockNum", chkDB, blockNoDbConfig);
- if(blockNums.count() < chkDB.count()) {
+ long blockNumsCount = blockNums.count();
+ long chkDBCount = chkDB.count();
+ if(blockNumsCount < chkDBCount) {
System.err.println("Block nums database: "+atime.count()+" but main database: "+chkDB.count());
throw new DatabaseException("Needs repopulation");
}
From toad at freenetproject.org Tue Apr 3 16:06:04 2007
From: toad at freenetproject.org (toad at freenetproject.org)
Date: Tue, 3 Apr 2007 16:06:04 +0000 (UTC)
Subject: [freenet-cvs] r12537 - trunk/freenet/src/freenet/store
Message-ID: <20070403160604.EFA8047A023@emu.freenetproject.org>
Author: toad
Date: 2007-04-03 16:06:04 +0000 (Tue, 03 Apr 2007)
New Revision: 12537
Modified:
trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
catch Throwable
Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2007-04-03 16:03:28 UTC (rev 12536)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2007-04-03 16:06:04 UTC (rev 12537)
@@ -2200,7 +2200,7 @@
System.err.println("Closed database");
reallyClosed = true;
}
- }catch(Exception ex){
+ }catch(Throwable ex){
Logger.error(this,"Error while closing database.",ex);
ex.printStackTrace();
}
From toad at freenetproject.org Tue Apr 3 16:10:58 2007
From: toad at freenetproject.org (toad at freenetproject.org)
Date: Tue, 3 Apr 2007 16:10:58 +0000 (UTC)
Subject: [freenet-cvs] r12538 - trunk/freenet/src/freenet/store
Message-ID: <20070403161058.C9FF3479733@emu.freenetproject.org>
Author: toad
Date: 2007-04-03 16:10:58 +0000 (Tue, 03 Apr 2007)
New Revision: 12538
Modified:
trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
more logging
Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2007-04-03 16:06:04 UTC (rev 12537)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2007-04-03 16:10:58 UTC (rev 12538)
@@ -515,6 +515,10 @@
(null, prefix+"CHK_accessTime", chkDB, secDbConfig);
}
} catch (DatabaseException e1) {
+ // Log this now because close() will probably throw too
+ System.err.println("Error opening access times db: "+e1);
+ e1.printStackTrace();
+ Logger.error(this, "Error opening access times db: "+e1, e1);
close(false);
throw e1;
}
@@ -564,6 +568,10 @@
(null, prefix+"CHK_blockNum", chkDB, blockNoDbConfig);
}
} catch (DatabaseException e1) {
+ // Log this now because close() will probably throw too
+ System.err.println("Error opening block nums db: "+e1);
+ e1.printStackTrace();
+ Logger.error(this, "Error opening block nums db: "+e1, e1);
close(false);
throw e1;
}
@@ -2201,8 +2209,12 @@
reallyClosed = true;
}
}catch(Throwable ex){
- Logger.error(this,"Error while closing database.",ex);
- ex.printStackTrace();
+ try {
+ Logger.error(this,"Error while closing database.",ex);
+ ex.printStackTrace();
+ } catch (Throwable t) {
+ // Return anyway
+ }
}
}
From toad at freenetproject.org Tue Apr 3 16:14:53 2007
From: toad at freenetproject.org (toad at freenetproject.org)
Date: Tue, 3 Apr 2007 16:14:53 +0000 (UTC)
Subject: [freenet-cvs] r12539 - trunk/freenet/src/freenet/store
Message-ID: <20070403161453.3BC5C4798BD@emu.freenetproject.org>
Author: toad
Date: 2007-04-03 16:14:53 +0000 (Tue, 03 Apr 2007)
New Revision: 12539
Modified:
trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
more logging
Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2007-04-03 16:10:58 UTC (rev 12538)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2007-04-03 16:14:53 UTC (rev 12539)
@@ -546,7 +546,7 @@
long blockNumsCount = blockNums.count();
long chkDBCount = chkDB.count();
if(blockNumsCount < chkDBCount) {
- System.err.println("Block nums database: "+atime.count()+" but main database: "+chkDB.count());
+ System.err.println("Block nums database: "+blockNumsCount+" but main database: "+chkDBCount);
throw new DatabaseException("Needs repopulation");
}
} catch (DatabaseException e) {
From ian at freenetproject.org Tue Apr 3 19:35:44 2007
From: ian at freenetproject.org (ian at freenetproject.org)
Date: Tue, 3 Apr 2007 19:35:44 +0000 (UTC)
Subject: [freenet-cvs] r12540 - in trunk/website: pages papers
Message-ID: <20070403193544.65DB647A044@emu.freenetproject.org>
Author: ian
Date: 2007-04-03 19:35:44 +0000 (Tue, 03 Apr 2007)
New Revision: 12540
Added:
trunk/website/papers/ddisrs.pdf
Modified:
trunk/website/pages/papers.php
Log:
Use correct paper
Modified: trunk/website/pages/papers.php
===================================================================
--- trunk/website/pages/papers.php 2007-04-03 16:14:53 UTC (rev 12539)
+++ trunk/website/pages/papers.php 2007-04-03 19:35:44 UTC (rev 12540)
@@ -37,7 +37,7 @@
circa 2002 - probably the best introduction to the theory behind
Freenet.
-
+
FreeNet White Paper
Original white paper by Ian Clarke, Division of Informatics, University of Edinburgh 1999.
Added: trunk/website/papers/ddisrs.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/website/papers/ddisrs.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
From nextgens at freenetproject.org Wed Apr 4 00:05:49 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Wed, 4 Apr 2007 00:05:49 +0000 (UTC)
Subject: [freenet-cvs] r12541 - trunk/freenet/src/freenet/clients/http
Message-ID: <20070404000549.7F662388288@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-04 00:05:49 +0000 (Wed, 04 Apr 2007)
New Revision: 12541
Modified:
trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
Log:
PproxyToadlet: enforce the fact that we want UTF-8
Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-04-03 19:35:44 UTC (rev 12540)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-04-04 00:05:49 UTC (rev 12541)
@@ -78,7 +78,7 @@
String data = ex.getReply();
ctx.sendReplyHeaders(ex.getCode(), "Found", ex.getHeaders(), ex.getMimeType(), (data == null ? 0 : data.length()));
if(data != null)
- ctx.writeData(data.getBytes());
+ ctx.writeData(data.getBytes("UTF-8"));
}else
writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
}
@@ -214,7 +214,7 @@
String data = ex.getReply();
ctx.sendReplyHeaders(ex.getCode(), "Found", ex.getHeaders(), ex.getMimeType(), (data == null ? 0 : data.length()));
if(data != null)
- ctx.writeData(data.getBytes());
+ ctx.writeData(data.getBytes("UTF-8"));
}else
writeReply(ctx, ex.getCode(), ex.getMimeType(), ex.getDesc(), ex.getReply());
} catch (Throwable t) {
From nextgens at freenetproject.org Fri Apr 6 17:19:08 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Fri, 6 Apr 2007 17:19:08 +0000 (UTC)
Subject: [freenet-cvs] r12542 - trunk/website/pages
Message-ID: <20070406171908.9C864479849@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-06 17:19:08 +0000 (Fri, 06 Apr 2007)
New Revision: 12542
Modified:
trunk/website/pages/download.php
Log:
website: update the download page
Modified: trunk/website/pages/download.php
===================================================================
--- trunk/website/pages/download.php 2007-04-04 00:05:49 UTC (rev 12541)
+++ trunk/website/pages/download.php 2007-04-06 17:19:08 UTC (rev 12542)
@@ -47,7 +47,7 @@
-If wget isn't available on your operating system you can use curl.
+If wget isn't available on your operating system you can use curl... MacOS users can double click the downloaded file; it ought to work.
Afer you start Freenet, wait a few seconds for it to start up (on a
slow computer, you may need to wait about 30 seconds), and visit
From nextgens at freenetproject.org Fri Apr 6 17:35:23 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Fri, 6 Apr 2007 17:35:23 +0000 (UTC)
Subject: [freenet-cvs] r12543 - trunk/apps/new_installer
Message-ID: <20070406173523.9E5D2479FA0@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-06 17:35:23 +0000 (Fri, 06 Apr 2007)
New Revision: 12543
Modified:
trunk/apps/new_installer/ProcessPanel.Spec.xml
trunk/apps/new_installer/install.xml
Log:
new_installer: DOH! maybe fix the installer on MacOS
Modified: trunk/apps/new_installer/ProcessPanel.Spec.xml
===================================================================
--- trunk/apps/new_installer/ProcessPanel.Spec.xml 2007-04-06 17:19:08 UTC (rev 12542)
+++ trunk/apps/new_installer/ProcessPanel.Spec.xml 2007-04-06 17:35:23 UTC (rev 12543)
@@ -7,4 +7,8 @@
+
+
+
+
Modified: trunk/apps/new_installer/install.xml
===================================================================
--- trunk/apps/new_installer/install.xml 2007-04-06 17:19:08 UTC (rev 12542)
+++ trunk/apps/new_installer/install.xml 2007-04-06 17:35:23 UTC (rev 12543)
@@ -27,6 +27,7 @@
+
@@ -145,6 +146,7 @@
+
An UNIX specific catch-all pack
From nextgens at freenetproject.org Fri Apr 6 18:55:45 2007
From: nextgens at freenetproject.org (nextgens at freenetproject.org)
Date: Fri, 6 Apr 2007 18:55:45 +0000 (UTC)
Subject: [freenet-cvs] r12544 - in trunk/apps/new_installer: . res/unix/bin
Message-ID: <20070406185545.3CB99479FA5@emu.freenetproject.org>
Author: nextgens
Date: 2007-04-06 18:55:45 +0000 (Fri, 06 Apr 2007)
New Revision: 12544
Added:
trunk/apps/new_installer/res/unix/bin/cleanup.sh
trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh
trunk/apps/new_installer/res/unix/bin/install_freenet-ext.sh
trunk/apps/new_installer/res/unix/bin/install_freenet-stable-latest.sh
trunk/apps/new_installer/res/unix/bin/install_frost.sh
trunk/apps/new_installer/res/unix/bin/install_jSite.sh
trunk/apps/new_installer/res/unix/bin/install_librarian.sh
trunk/apps/new_installer/res/unix/bin/install_mdns.sh
trunk/apps/new_installer/res/unix/bin/install_plugins.sh
trunk/apps/new_installer/res/unix/bin/install_stun.sh
trunk/apps/new_installer/res/unix/bin/install_thaw.sh
trunk/apps/new_installer/res/unix/bin/install_updater.sh
trunk/apps/new_installer/res/unix/bin/setup.sh
Modified:
trunk/apps/new_installer/ProcessPanel.Spec.xml
trunk/apps/new_installer/install.xml
trunk/apps/new_installer/res/unix/bin/1run.sh
Log:
new_installer: split the installer into small parts so that the progressbar works ... I ought to do the same for windows someday... Feedback would be appreciated
Modified: trunk/apps/new_installer/ProcessPanel.Spec.xml
===================================================================
--- trunk/apps/new_installer/ProcessPanel.Spec.xml 2007-04-06 17:35:23 UTC (rev 12543)
+++ trunk/apps/new_installer/ProcessPanel.Spec.xml 2007-04-06 18:55:45 UTC (rev 12544)
@@ -1,14 +1,99 @@
-
-
-
+
+
+
+
+
+
-
+
+
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modified: trunk/apps/new_installer/install.xml
===================================================================
--- trunk/apps/new_installer/install.xml 2007-04-06 17:35:23 UTC (rev 12543)
+++ trunk/apps/new_installer/install.xml 2007-04-06 18:55:45 UTC (rev 12544)
@@ -28,6 +28,7 @@
+
@@ -147,6 +148,7 @@
+
An UNIX specific catch-all pack
@@ -156,8 +158,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modified: trunk/apps/new_installer/res/unix/bin/1run.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/1run.sh 2007-04-06 17:35:23 UTC (rev 12543)
+++ trunk/apps/new_installer/res/unix/bin/1run.sh 2007-04-06 18:55:45 UTC (rev 12544)
@@ -3,136 +3,10 @@
INSTALL_PATH="${INSTALL_PATH:-$PWD}"
cd "$INSTALL_PATH"
-if test -s freenet.ini
-then
- echo "This script isn't meant to be used more than once. I will rename your freenet.ini to freenet.old.ini and go on, but don't complain if it breaks\!"
- mv freenet.ini freenet.old.ini
-fi
-# We need the exec flag on /bin
-chmod a+rx bin/* lib/* &>/dev/null
-
-# Tweak freenet.ini before the first startup
-echo "node.updater.enabled=true" > freenet.ini
-if test -e update
-then
- echo "Enabling the auto-update feature"
- echo "node.updater.autoupdate=true" >> freenet.ini
- rm -f update
-fi
-
-PLUGINS=""
-if test -e stun
-then
- echo "Enabling the STUN plugin"
- mkdir plugins &>/dev/null
- PLUGINS="plugins.JSTUN.JSTUN at file://$INSTALL_PATH/plugins/JSTUN.jar;$PLUGINS"
- java -jar bin/sha1test.jar plugins/JSTUN.jar.url plugins &>/dev/null
- mv plugins/JSTUN.jar.url plugins/JSTUN.jar
- rm -f plugins/JSTUN.jar.url
- rm -f stun
-fi
-
-if test -e mdns
-then
- echo "Enabling the MDNSDiscovery plugin"
- mkdir plugins &>/dev/null
- PLUGINS="plugins.MDNSDiscovery.MDNSDiscovery at file://$INSTALL_PATH/plugins/MDNSDiscovery.jar;$PLUGINS"
- java -jar bin/sha1test.jar plugins/MDNSDiscovery.jar.url plugins &>/dev/null
- mv plugins/MDNSDiscovery.jar.url plugins/MDNSDiscovery.jar
- rm -f plugins/MDNSDiscovery.jar.url
- rm -f mdns
-fi
-
-if test -e librarian
-then
- echo "Enabling the Librarian plugin"
- mkdir plugins &>/dev/null
- PLUGINS="plugins.Librarian.Librarian at file://$INSTALL_PATH/plugins/Librarian.jar;$PLUGINS"
- java -jar bin/sha1test.jar plugins/Librarian.jar.url plugins &>/dev/null
- mv plugins/Librarian.jar.url plugins/Librarian.jar
- rm -f plugins/Librarian.jar.url
- rm -f librarian
-fi
-
-# Register plugins
-echo "pluginmanager.loadplugin=$PLUGINS" >> freenet.ini
-
-echo "Detecting tcp-ports availability..."
-# Try to auto-detect the first available port for fproxy
-FPROXY_PORT=8888
-java -jar bin/bindtest.jar $FPROXY_PORT &>/dev/null
-if test $? -ne 0
-then
- FPROXY_PORT=8889
- echo "Can not bind fproxy to 8888: let's try $FPROXY_PORT instead."
- java -jar bin/bindtest.jar $FPROXY_PORT
- if test $? -ne 0
- then
- FPROXY_PORT=9999
- echo "Can not bind fproxy to 8889: force it to $FPROXY_PORT instead."
- fi
- cat welcome.html | sed "s/8888/$FPROXY_PORT/g" >welcome2.html
- mv welcome2.html welcome.html
-fi
-echo -e "fproxy.enabled=true\nfproxy.port=$FPROXY_PORT" >> freenet.ini
-
-# Try to auto-detect the first available port for fcp
-FCP_PORT=9481
-java -jar bin/bindtest.jar $FCP_PORT
-if test $? -ne 0
-then
- FCP_PORT=9482
- echo "Can not bind fcp to 9481: force it to $FCP_PORT instead."
-fi
-echo -e "fcp.enabled=true\nfcp.port=$FCP_PORT" >> freenet.ini
-
-# Try to auto-detect the first available port for console
-CONSOLE_PORT=2323
-java -jar bin/bindtest.jar $CONSOLE_PORT
-if test $? -ne 0
-then
- CONSOLE_PORT=2324
- echo "Can not bind console to 2323: force it to $CONSOLE_PORT instead."
-fi
-echo -e "console.enabled=true\nconsole.port=$CONSOLE_PORT" >> freenet.ini
-
-echo "Downloading freenet-stable-latest.jar"
-java -jar bin/sha1test.jar freenet-stable-latest.jar "$INSTALL_PATH" &>/dev/null || exit 1
-ln -s freenet-stable-latest.jar freenet.jar
-echo "Downloading freenet-ext.jar"
-java -jar bin/sha1test.jar freenet-ext.jar "$INSTALL_PATH" &>/dev/null || exit 1
-echo "Downloading update.sh"
-java -jar bin/sha1test.jar update/update.sh "$INSTALL_PATH" &>/dev/null || exit 1
-chmod a+rx "$INSTALL_PATH/update.sh"
-
# Starting the node up
./run.sh start
-if test -e thaw
-then
- rm -f thaw
- echo "Downloading Thaw"
- java -jar bin/sha1test.jar Thaw/Thaw.jar ./ &>/dev/null || exit 1
-fi
-
-if test -e jsite
-then
- rm -f jsite
- echo "Downloading jSite"
- java -jar bin/sha1test.jar jSite/jSite.jar ./ &>/dev/null || exit 1
-fi
-
-if test -e frost
-then
- rm -f frost
- echo "Downloading frost"
- java -jar bin/sha1test.jar frost/frost.zip ./ &>/dev/null || exit 1
- echo "Unzipping frost"
- mkdir frost
- java -jar bin/uncompress.jar frost.zip frost &>/dev/null
-fi
-
echo "Starting up a browser"
java -cp bin/browser.jar BareBonesBrowserLaunch "file://$INSTALL_PATH/welcome.html"
Added: trunk/apps/new_installer/res/unix/bin/cleanup.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/cleanup.sh (rev 0)
+++ trunk/apps/new_installer/res/unix/bin/cleanup.sh 2007-04-06 18:55:45 UTC (rev 12544)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+INSTALL_PATH="${INSTALL_PATH:-$PWD}"
+
+cd "$INSTALL_PATH"
+
+# We keep application installers in case users want to perform updates
+rm -f 1run.sh cleanup.sh detect_port_availability.sh install_freenet-ext.sh install_freenet-stable-latest.sh install_librarian.sh install_mdns.sh install_plugins.sh install_stun.sh install_updater.sh setup.sh
Property changes on: trunk/apps/new_installer/res/unix/bin/cleanup.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh (rev 0)
+++ trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh 2007-04-06 18:55:45 UTC (rev 12544)
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+INSTALL_PATH="${INSTALL_PATH:-$PWD}"
+
+cd "$INSTALL_PATH"
+
+echo "Detecting tcp-ports availability..."
+# Try to auto-detect the first available port for fproxy
+FPROXY_PORT=8888
+java -jar bin/bindtest.jar $FPROXY_PORT &>/dev/null
+if test $? -ne 0
+then
+ FPROXY_PORT=8889
+ echo "Can not bind fproxy to 8888: let's try $FPROXY_PORT instead."
+ java -jar bin/bindtest.jar $FPROXY_PORT
+ if test $? -ne 0
+ then
+ FPROXY_PORT=9999
+ echo "Can not bind fproxy to 8889: force it to $FPROXY_PORT instead."
+ fi
+ cat welcome.html | sed "s/8888/$FPROXY_PORT/g" >welcome2.html
+ mv welcome2.html welcome.html
+fi
+echo -e "fproxy.enabled=true\nfproxy.port=$FPROXY_PORT" >> freenet.ini
+
+# Try to auto-detect the first available port for fcp
+FCP_PORT=9481
+java -jar bin/bindtest.jar $FCP_PORT
+if test $? -ne 0
+then
+ FCP_PORT=9482
+ echo "Can not bind fcp to 9481: force it to $FCP_PORT instead."
+fi
+echo -e "fcp.enabled=true\nfcp.port=$FCP_PORT" >> freenet.ini
+
+# Try to auto-detect the first available port for console
+CONSOLE_PORT=2323
+java -jar bin/bindtest.jar $CONSOLE_PORT
+if test $? -ne 0
+then
+ CONSOLE_PORT=2324
+ echo "Can not bind console to 2323: force it to $CONSOLE_PORT instead."
+fi
+echo -e "console.enabled=true\nconsole.port=$CONSOLE_PORT" >> freenet.ini
Property changes on: trunk/apps/new_installer/res/unix/bin/detect_port_availability.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/apps/new_installer/res/unix/bin/install_freenet-ext.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/install_freenet-ext.sh (rev 0)
+++ trunk/apps/new_installer/res/unix/bin/install_freenet-ext.sh 2007-04-06 18:55:45 UTC (rev 12544)
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+INSTALL_PATH="${INSTALL_PATH:-$PWD}"
+
+cd "$INSTALL_PATH"
+
+echo "Downloading freenet-ext.jar"
+java -jar bin/sha1test.jar freenet-ext.jar "$INSTALL_PATH" &>/dev/null || exit 1
Property changes on: trunk/apps/new_installer/res/unix/bin/install_freenet-ext.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/apps/new_installer/res/unix/bin/install_freenet-stable-latest.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/install_freenet-stable-latest.sh (rev 0)
+++ trunk/apps/new_installer/res/unix/bin/install_freenet-stable-latest.sh 2007-04-06 18:55:45 UTC (rev 12544)
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+INSTALL_PATH="${INSTALL_PATH:-$PWD}"
+
+cd "$INSTALL_PATH"
+
+echo "Downloading freenet-stable-latest.jar"
+java -jar bin/sha1test.jar freenet-stable-latest.jar "$INSTALL_PATH" &>/dev/null || exit 1
+ln -s freenet-stable-latest.jar freenet.jar
Property changes on: trunk/apps/new_installer/res/unix/bin/install_freenet-stable-latest.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/apps/new_installer/res/unix/bin/install_frost.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/install_frost.sh (rev 0)
+++ trunk/apps/new_installer/res/unix/bin/install_frost.sh 2007-04-06 18:55:45 UTC (rev 12544)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+INSTALL_PATH="${INSTALL_PATH:-$PWD}"
+
+cd "$INSTALL_PATH"
+
+if test -e frost
+then
+ rm -f frost
+ echo "Downloading frost"
+ java -jar bin/sha1test.jar frost/frost.zip ./ &>/dev/null || exit 1
+ echo "Unzipping frost"
+ mkdir frost
+ java -jar bin/uncompress.jar frost.zip frost &>/dev/null
+fi
Property changes on: trunk/apps/new_installer/res/unix/bin/install_frost.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/apps/new_installer/res/unix/bin/install_jSite.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/install_jSite.sh (rev 0)
+++ trunk/apps/new_installer/res/unix/bin/install_