Changeset a3e146a8


Ignore:
Timestamp:
Apr 9, 2017 6:52:22 AM (3 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
f541dbe
Parents:
fa6fc84 (diff), dd8f763 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

propagate from branch 'i2p.i2p' (head 5d56a7eb371dddb9336e596bda69f99c91294b05)

to branch 'i2p.i2p.str4d.ui' (head 3aeafcdb5c0ffbc9c77f574558f8438d3e81133e)

Files:
54 added
29 deleted
128 edited
1 moved

Legend:

Unmodified
Added
Removed
  • .tx/config

    rfa6fc84 ra3e146a8  
    405405trans.ko = installer/resources/locale-man/man_ko.po
    406406trans.nl = installer/resources/locale-man/man_nl.po
     407trans.pl = installer/resources/locale-man/man_pl.po
    407408trans.pt = installer/resources/locale-man/man_pt.po
     409trans.pt_BR = installer/resources/locale-man/man_pt_BR.po
     410trans.ru_RU = installer/resources/locale-man/man_ru.po
     411trans.sv_SE = installer/resources/locale-man/man_sv.po
    408412trans.zh_CN = installer/resources/locale-man/man_zh.po
    409413
  • LICENSE.txt

    rfa6fc84 ra3e146a8  
    213213       See licenses/LICENSE-Apache2.0.txt
    214214
    215    Jetty 8.1.21.v20160908:
     215   Jetty 9.2.21.v20170120:
    216216   See licenses/ABOUT-Jetty.html
    217217   See licenses/NOTICE-Jetty.html
    218218   See licenses/LICENSE-Apache2.0.txt
    219219   See licenses/LICENSE-ECLIPSE-1.0.html
    220    See licenses/NOTICE-Commons-Logging.txt
    221220
    222221   JRobin 1.6.0-1:
     
    285284      See licenses/LICENSE-LGPLv2.1.txt
    286285
    287    Tomcat 6.0.48:
     286   Tomcat 8.0.33:
    288287   Copyright 1999-2016 The Apache Software Foundation
    289288   See licenses/LICENSE-Apache2.0.txt
  • apps/addressbook/build.xml

    rfa6fc84 ra3e146a8  
    11<?xml version="1.0"?>
    2 <project name="addressbook" default="war" basedir=".">
     2<project name="addressbook" default="all" basedir=".">
    33
    44        <property name="src" value="java/src"/>
     
    99        <property name="javac.compilerargs" value="" />
    1010        <property name="javac.version" value="1.7" />
     11
     12        <target name="all" depends="jar, emptyWar"/>
    1113       
    1214        <target name="init">
     
    3739        </target>
    3840
    39         <target name="dependServlet" if="depend.available">
    40             <depend
    41                 cache="../../build"
    42                 srcdir="${src}"
    43                 destdir="${build}" >
    44                 <!-- Depend on classes instead of jars where available -->
    45                 <classpath>
    46                     <pathelement location="../../core/java/build/obj" />
    47                     <pathelement location="../jetty/jettylib/javax.servlet.jar" />
    48                 </classpath>
    49             </depend>
    50         </target>
    51 
    52         <target name="compile" depends="init, depend">
     41        <target name="compile" depends="init, depend, warUpToDate">
    5342            <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
    5443                       includeAntRuntime="false"
    55                        srcdir="${src}" destdir="${build}"
    56                        excludes="net/i2p/addressbook/Servlet.java">
     44                       srcdir="${src}" destdir="${build}">
    5745            <compilerarg line="${javac.compilerargs}" />
    5846            <classpath>
     
    6250        </target>
    6351
    64         <target name="compileServlet" depends="init, dependServlet, compile">
    65             <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
    66                        includeAntRuntime="false"
    67                        srcdir="${src}" destdir="${build}"
    68                        includes="net/i2p/addressbook/Servlet.java">
    69             <compilerarg line="${javac.compilerargs}" />
    70             <classpath>
    71                 <pathelement location="../../core/java/build/i2p.jar" />
    72                 <pathelement location="../jetty/jettylib/javax.servlet.jar" />
    73             </classpath>
    74                 </javac>
    75         </target>
    76 
    77         <!-- unused for now (except for Android), as we oddly ship addressbook as a .war -->
    7852        <target name="jar" depends="compile, changes">
    7953                <!-- set if unset -->
     
    9266                </jar>
    9367        </target>
    94        
    95         <target name="war" depends="compileServlet, changes, warUpToDate" unless="war.uptodate">
    96                 <mkdir dir="${dist}/tmp"/>
    97                 <mkdir dir="${dist}/tmp/WEB-INF"/>
    98                 <mkdir dir="${dist}/tmp/WEB-INF/classes"/>
    99                 <copy todir="${dist}/tmp/WEB-INF/classes">
    100                         <fileset dir="${build}"/>
    101                 </copy>
    102                 <!-- set if unset -->
    103                 <property name="workspace.changes.tr" value="" />
    104                 <war basedir="${dist}/tmp" webxml="web.xml" destfile="${dist}/${war}">
    105                         <manifest>
    106                                 <attribute name="Implementation-Version" value="${full.version}" />
    107                                 <attribute name="Built-By" value="${build.built-by}" />
    108                                 <attribute name="Build-Date" value="${build.timestamp}" />
    109                                 <attribute name="Base-Revision" value="${workspace.version}" />
    110                                 <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
    111                                 <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
    112                                 <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
    113                         </manifest>
    114                 </war>
    115                 <delete dir="${dist}/tmp"/>
    116         </target>
     68
     69        <target name="emptyWar" depends="init">
     70            <jar destfile="${dist}/${war}" >
     71                <manifest>
     72                    <attribute name="Note" value="Intentionally empty" />
     73                </manifest>
     74            </jar>
     75        </target>
    11776       
    11877        <target name="warUpToDate">
  • apps/addressbook/java/src/net/i2p/addressbook/Daemon.java

    rfa6fc84 ra3e146a8  
    4444/**
    4545 * Main class of addressbook.  Performs updates, and runs the main loop.
     46 * As of 0.9.30, package private, run with DaemonThread.
    4647 *
    4748 * @author Ragnarok
    4849 *
    4950 */
    50 public class Daemon {
     51class Daemon {
    5152    public static final String VERSION = "2.0.4";
    52     private static final Daemon _instance = new Daemon();
    5353    private volatile boolean _running;
    5454    private static final boolean DEBUG = false;
     
    788788     */
    789789    public static void main(String[] args) {
     790        Daemon daemon = new Daemon();
    790791        if (args != null && args.length > 0 && args[0].equals("test"))
    791             _instance.test(args);
     792            daemon.test(args);
    792793        else
    793             _instance.run(args);
     794            daemon.run(args);
    794795    }
    795796
    796797    /** @since 0.9.26 */
    797     private static void test(String[] args) {
     798    public static void test(String[] args) {
    798799        Properties ctxProps = new Properties();
    799800        String PROP_FORCE = "i2p.naming.blockfile.writeInAppContext";
     
    876877     * refetch its subscriptions.
    877878     */
    878     public static void wakeup() {
    879         synchronized (_instance) {
    880             _instance.notifyAll();
    881         }
    882     }
    883 
    884     public static void stop() {
    885         _instance._running = false;
     879    public void wakeup() {
     880        synchronized (this) {
     881            notifyAll();
     882        }
     883    }
     884
     885    public void stop() {
     886        _running = false;
    886887        wakeup();
    887888    }
  • apps/addressbook/java/src/net/i2p/addressbook/DaemonThread.java

    rfa6fc84 ra3e146a8  
    3737
    3838    private final String[] args;
     39    private final Daemon daemon;
    3940
    4041    /**
     
    4546    public DaemonThread(String[] args) {
    4647        this.args = args;
     48        daemon = new Daemon();
    4749    }
    4850
     
    5759        //}
    5860        I2PAppContext.getGlobalContext().namingService().registerUpdater(this);
    59         Daemon.main(this.args);
    60         I2PAppContext.getGlobalContext().namingService().unregisterUpdater(this);
     61        try {
     62            if (args != null && args.length > 0 && args[0].equals("test"))
     63                daemon.test(args);
     64            else
     65                daemon.run(args);
     66        } finally {
     67            I2PAppContext.getGlobalContext().namingService().unregisterUpdater(this);
     68        }
    6169    }
    6270
    6371    public void halt() {
    64         Daemon.stop();
     72        daemon.stop();
    6573        interrupt();
    6674    }
    6775
    6876    /**
    69      *  The NamingServiceUpdater interface
    70      *  @param options ignored
     77     *  The NamingServiceUpdater interface.
     78     *  While this may be called directly, the recommended way
     79     *  is to call I2PAppContext.namingService().requestUpdate(Properties)
     80     *  which will call this.
     81     *
     82     *  @param options ignored, may be null
    7183     *  @since 0.8.7
    7284     */
  • apps/i2psnark/java/src/org/klomp/snark/I2PSnarkUtil.java

    rfa6fc84 ra3e146a8  
    7171    private List<String> _openTrackers;
    7272    private DHT _dht;
     73    private long _startedTime;
    7374
    7475    private static final int EEPGET_CONNECT_TIMEOUT = 45*1000;
     
    261262                opts.setProperty(I2PClient.PROP_SIGTYPE, "EdDSA_SHA512_Ed25519");
    262263            _manager = I2PSocketManagerFactory.createManager(_i2cpHost, _i2cpPort, opts);
     264            if (_manager != null)
     265                _startedTime = _context.clock().now();
    263266            _connecting = false;
    264267        }
     
    296299            _dht = null;
    297300        }
     301        _startedTime = 0;
    298302        I2PSocketManager mgr = _manager;
    299303        // FIXME this can cause race NPEs elsewhere
     
    311315    }
    312316   
     317    /**
     318     * When did we connect to the network?
     319     * For RPC
     320     * @return 0 if not connected
     321     * @since 0.9.30
     322     */
     323    public long getStartedTime() {
     324        return _startedTime;
     325    }
     326
    313327    /** connect to the given destination */
    314328    I2PSocket connect(PeerID peer) throws IOException {
  • apps/i2psnark/java/src/org/klomp/snark/Peer.java

    rfa6fc84 ra3e146a8  
    9090  //private static final long OPTION_AZMP      = 0x1000000000000000l;
    9191  private long options;
     92  private final boolean _isIncoming;
    9293
    9394  /**
     
    104105    this.metainfo = metainfo;
    105106    _id = __id.incrementAndGet();
     107    _isIncoming = false;
    106108    //_log.debug("Creating a new peer with " + peerID.toString(), new Exception("creating"));
    107109  }
     
    131133    if (_log.shouldLog(Log.DEBUG))
    132134        _log.debug("Creating a new peer " + peerID.toString(), new Exception("creating " + _id));
     135    _isIncoming = true;
     136  }
     137
     138  /**
     139   * Is this an incoming connection?
     140   * For RPC
     141   * @since 0.9.30
     142   */
     143  public boolean isIncoming() {
     144      return _isIncoming;
    133145  }
    134146
  • apps/i2psnark/java/src/org/klomp/snark/Snark.java

    rfa6fc84 ra3e146a8  
    2929import java.util.Properties;
    3030import java.util.StringTokenizer;
     31import java.util.concurrent.atomic.AtomicInteger;
    3132
    3233import net.i2p.I2PAppContext;
     
    238239  // String indicating main activity
    239240  private volatile String activity = "Not started";
    240   private final long savedUploaded;
    241 
     241  private long savedUploaded;
     242  private long _startedTime;
     243  private static final AtomicInteger __RPCID = new AtomicInteger();
     244  private final int _rpcID = __RPCID.incrementAndGet();
    242245
    243246  /**
     
    543546      try {
    544547          x_startTorrent();
     548          _startedTime = _util.getContext().clock().now();
    545549      } finally {
    546550          starting = false;
     
    634638        // TODO: Cache the config-in-mem to compare vs config-on-disk
    635639        // (needed for auto-save to not double-save in some cases)
    636         //boolean changed = storage.isChanged() || getUploaded() != savedUploaded;
    637         boolean changed = true;
    638         if (changed && completeListener != null)
    639             completeListener.updateStatus(this);
     640        long nowUploaded = getUploaded();
     641        boolean changed = storage.isChanged() || nowUploaded != savedUploaded;
    640642        try {
    641643            storage.close();
     
    644646            ioe.printStackTrace();
    645647        }
     648        savedUploaded = nowUploaded;
     649        if (changed && completeListener != null)
     650            completeListener.updateStatus(this);
    646651    }
    647652    if (fast)
     
    12861291    allChecked = true;
    12871292    checking = false;
    1288     if (storage.isChanged() && completeListener != null)
     1293    if (storage.isChanged() && completeListener != null) {
    12891294        completeListener.updateStatus(this);
     1295        // this saved the status, so reset the variables
     1296        storage.clearChanged();
     1297        savedUploaded = getUploaded();
     1298    }
    12901299  }
    12911300 
     
    12961305    //storage.close();
    12971306    //System.out.println("Completely received: " + torrent);
    1298     if (completeListener != null)
     1307    if (completeListener != null) {
    12991308        completeListener.torrentComplete(this);
     1309        // this saved the status, so reset the variables
     1310        savedUploaded = getUploaded();
     1311        storage.clearChanged();
     1312    }
    13001313  }
    13011314
     
    13651378    return total > limit;
    13661379  }
     1380
     1381  /**
     1382   *  A unique ID for this torrent, useful for RPC
     1383   *  @return positive value unless you wrap around
     1384   *  @since 0.9.30
     1385   */
     1386  public int getRPCID() {
     1387    return _rpcID;
     1388  }
     1389   
     1390    /**
     1391     * When did we start this torrent
     1392     * For RPC
     1393     * @return 0 if not started before. Not cleared when stopped.
     1394     * @since 0.9.30
     1395     */
     1396    public long getStartedTime() {
     1397        return _startedTime;
     1398    }
    13671399}
  • apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java

    rfa6fc84 ra3e146a8  
    2828
    2929import net.i2p.I2PAppContext;
     30import net.i2p.app.ClientApp;
    3031import net.i2p.app.ClientAppManager;
     32import net.i2p.app.ClientAppState;
    3133import net.i2p.crypto.SHA1Hash;
    3234import net.i2p.crypto.SigType;
     
    5254 * Manage multiple snarks
    5355 */
    54 public class SnarkManager implements CompleteListener {
     56public class SnarkManager implements CompleteListener, ClientApp {
    5557   
    5658    /**
     
    247249    public void start() {
    248250        _running = true;
     251        if ("i2psnark".equals(_contextName)) {
     252            // Register with the ClientAppManager so the rpc plugin can find us
     253            // only if default instance
     254            ClientAppManager cmgr = _context.clientAppManager();
     255            if (cmgr != null)
     256                cmgr.register(this);
     257        }
    249258        _peerCoordinatorSet = new PeerCoordinatorSet();
    250259        _connectionAcceptor = new ConnectionAcceptor(_util, _peerCoordinatorSet);
     
    316325        _idleChecker.cancel();
    317326        stopAllTorrents(true);
     327        if ("i2psnark".equals(_contextName)) {
     328            // only if default instance
     329            ClientAppManager cmgr = _context.clientAppManager();
     330            if (cmgr != null)
     331                cmgr.unregister(this);
     332        }
    318333        if (_log.shouldWarn())
    319334            _log.warn("Snark stop() end");
     
    322337    /** @since 0.9.1 */
    323338    public boolean isStopping() { return _stopping; }
     339
     340    /**
     341     *  ClientApp method. Does nothing.
     342     *  Doesn't matter, we are only registering.
     343     *  @since 0.9.30
     344     */
     345    public void startup() {}
     346
     347    /**
     348     *  ClientApp method. Does nothing.
     349     *  Doesn't matter, we are only registering.
     350     *  @since 0.9.30
     351     */
     352    public void shutdown(String[] args) {}
     353
     354    /**
     355     *  ClientApp method.
     356     *  Doesn't matter, we are only registering.
     357     *  @return INITIALIZED always.
     358     *  @since 0.9.30
     359     */
     360    public ClientAppState getState() {
     361        return ClientAppState.INITIALIZED;
     362    }
     363
     364    /**
     365     *  ClientApp method.
     366     *  @since 0.9.30
     367     */
     368    public String getName() {
     369        return "i2psnark";
     370    }
     371
     372    /**
     373     *  ClientApp method.
     374     *  @since 0.9.30
     375     */
     376    public String getDisplayName() {
     377        return "i2psnark: " + _contextPath;
     378    }
    324379
    325380    /** hook to I2PSnarkUtil for the servlet */
     
    439494        }
    440495        return f;
     496    }
     497
     498    /**
     499     * For RPC
     500     * @since 0.9.30
     501     */
     502    public File getConfigDir() {
     503        return _configDir;
    441504    }
    442505
     
    15271590     *
    15281591     * @param metainfo the metainfo for the torrent
    1529      * @param bitfield the current completion status of the torrent
     1592     * @param bitfield the current completion status of the torrent, or null
    15301593     * @param filename the absolute path to save the metainfo to, generally ending in ".torrent", which is also the name of the torrent
    1531      *                 Must be a filesystem-safe name.
     1594     *                 Must be a filesystem-safe name. If null, will generate a name from the metainfo.
    15321595     * @param baseFile may be null, if so look in rootDataDir
    15331596     * @throws RuntimeException via Snark.fatal()
     
    15431606                addMessage(_t("Torrent with this info hash is already running: {0}", snark.getBaseName()));
    15441607                return false;
    1545             } else {
     1608            } else if (bitfield != null) {
    15461609                saveTorrentStatus(metainfo, bitfield, null, baseFile, true, 0, true); // no file priorities
    15471610            }
    15481611            // so addTorrent won't recheck           
     1612            if (filename == null) {
     1613                File f = new File(getDataDir(), Storage.filterName(metainfo.getName()) + ".torrent");
     1614                if (f.exists()) {
     1615                    addMessage(_t("Failed to copy torrent file to {0}", f.getAbsolutePath()));
     1616                    _log.error("Torrent file already exists: " + f);
     1617                }
     1618                filename = f.getAbsolutePath();
     1619            }
    15491620            try {
    15501621                locked_writeMetaInfo(metainfo, filename, areFilesPublic());
  • apps/i2psnark/java/src/org/klomp/snark/Storage.java

    rfa6fc84 ra3e146a8  
    304304  public boolean isChanged() {
    305305      return changed;
     306  }
     307
     308  /**
     309   *  Clear the storage changed variable
     310   *  @since 0.9.30
     311   */
     312  void clearChanged() {
     313      changed = false;
    306314  }
    307315
  • apps/i2psnark/java/src/org/klomp/snark/dht/NodeInfo.java

    rfa6fc84 ra3e146a8  
    107107            throw new DataFormatException("Bad format");
    108108        byte[] nid = Base64.decode(parts[0]);
    109         if (nid == null)
     109        if (nid == null || nid.length != NID.HASH_LENGTH)
    110110            throw new DataFormatException("Bad NID");
    111111        nID = new NID(nid);
    112112        byte[] h = Base64.decode(parts[1]);
    113         if (h == null)
     113        if (h == null || h.length != Hash.HASH_LENGTH)
    114114            throw new DataFormatException("Bad hash");
    115115        //hash = new Hash(h);
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    rfa6fc84 ra3e146a8  
    18041804                else if ("CwsL".equals(ch))
    18051805                    client = "I2PSnarkXL";
     1806                else if ("LVhE".equals(ch))
     1807                    client = "XD" + getAzVersion(pid.getID());
    18061808                else if ("ZV".equals(ch.substring(2,4)) || "VUZP".equals(ch))
    18071809                    client = "Robert" + getRobtVersion(pid.getID());
  • apps/i2psnark/jetty-i2psnark.xml

    rfa6fc84 ra3e146a8  
    2323  <Call name="addConnector">
    2424    <Arg>
    25         <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
     25        <New class="org.eclipse.jetty.server.ServerConnector">
     26          <Arg><Ref id="Server" /></Arg>
     27          <Arg type="int">1</Arg>     <!-- number of acceptors -->
     28          <Arg type="int">0</Arg>     <!-- default number of selectors -->
     29          <Arg>
     30            <Array type="org.eclipse.jetty.server.ConnectionFactory">    <!-- varargs so we need an array -->
     31              <Item>
     32                <New class="org.eclipse.jetty.server.HttpConnectionFactory">
     33                  <Arg>
     34                    <New class="org.eclipse.jetty.server.HttpConfiguration" />
     35                  </Arg>
     36                </New>
     37              </Item>
     38            </Array>
     39          </Arg>
    2640          <Set name="host">127.0.0.1</Set>
    2741          <Set name="port">8002</Set>
    28           <Set name="maxIdleTime">600000</Set>
    29           <Set name="Acceptors">1</Set>
    30           <Set name="statsOn">false</Set>
    31           <Set name="lowResourcesConnections">5000</Set>
    32           <Set name="lowResourcesMaxIdleTime">5000</Set>
    33           <Set name="useDirectBuffers">false</Set>
     42          <Set name="idleTimeout">600000</Set>
    3443        </New>
    3544    </Arg>
     
    97106      <Call name="addAppProvider">
    98107        <Arg>
    99           <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
     108          <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
    100109            <Set name="monitoredDirName">./contexts</Set>
    101110            <Set name="scanInterval">0</Set>
  • apps/i2psnark/readme-standalone.txt

    rfa6fc84 ra3e146a8  
    55I2PSnark web ui will be at http://127.0.0.1:8002/i2psnark/
    66
    7 Please note that http://127.0.0.1:8002/ will 404, to be fixed
    8 
    97I2PSnark is GPL'ed software, based on Snark (http://www.klomp.org/) to run on top of I2P
    108(https://geti2p.net/) within a webserver (such as the bundled Jetty from
    119https://www.eclipse.org/jetty/).  For more information about I2PSnark, get in touch
    1210with the folks at http://forum.i2p2.de/
     11
     12
     13To add RPC support:
     14
     151) Stop i2psnark standalone if running.
     16
     172a) If you have the i2psnark-rpc plugin installed in your router already,
     18    copy the file ~/.i2p/plugins/i2psnark-rpc/console/webapps/transmission.war
     19    to the webapps/ directory in your standalone install.
     20
     212b) If you do not have the i2psnark-rpc plugin installed, get the i2p.plugins.i2psnark-rpc
     22    branch out of monotone, build with 'ant war', and copy the file src/build/transmission.war.jar
     23    to the file webapps/transmission.war in your standalone install.
     24
     253) Start i2psnark standalone as usual. The transmission web interface will be at
     26   http://127.0.0.1:8002/transmission/web/ or if you have transmission-remote installed,
     27   test with 'transmission-remote 8002 -l'
  • apps/i2ptunnel/java/build.xml

    rfa6fc84 ra3e146a8  
    278278                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
    279279                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
    280                 <!-- jsp-api.jar only present for debian builds -->
     280
     281                <!-- following jars only present for debian builds -->
    281282                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    282                 <!-- tomcat-api.jar only present for debian builds -->
    283283                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
    284                 <!-- jasper-el.jar only present for debian builds -->
     284                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
     285                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
     286
    285287                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
    286288                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
    287289                <pathelement location="../../jetty/jettylib/commons-el.jar" />
     290                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
    288291                <pathelement location="${ant.home}/lib/ant.jar" />
    289292                <pathelement location="build/i2ptunnel.jar" />
     
    310313                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
    311314                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
    312                 <!-- jsp-api.jar only present for debian builds -->
     315
     316                <!-- following jars only present for debian builds -->
    313317                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    314                 <!-- tomcat-api.jar only present for debian builds -->
    315318                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
    316                 <!-- jasper-el.jar only present for debian builds -->
    317319                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
     320                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
     321                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
     322
    318323                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
    319324                <pathelement location="../../jetty/jettylib/commons-el.jar" />
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java

    rfa6fc84 ra3e146a8  
    314314
    315315    /**
    316      *  Add a subsession to a shared client if necessary.
    317      *
     316     *  Add a DSA_SHA1 subsession to the shared client if necessary.
     317     *
     318     *  @return subsession, or null if none was added
    318319     *  @since 0.9.20
    319320     */
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java

    rfa6fc84 ra3e146a8  
    205205            "\r\n" +
    206206            "<html><body><H1>I2P ERROR: SSL to I2P address rejected</H1>" +
    207             "SSL for to .i2p addresses denied by configuration." +
     207            "SSL to .i2p addresses denied by configuration." +
    208208            "You may change the configuration in I2PTunnel";
    209209
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java

    rfa6fc84 ra3e146a8  
    211211        } catch (IOException ex) {
    212212            try {
    213                 socket.close();
     213                socket.reset();
    214214            } catch (IOException ioe) {}
    215215            if (_log.shouldLog(Log.WARN))
     
    217217        } catch (OutOfMemoryError oom) {
    218218            try {
    219                 socket.close();
     219                socket.reset();
    220220            } catch (IOException ioe) {}
    221221            if (_log.shouldLog(Log.ERROR))
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java

    rfa6fc84 ra3e146a8  
    1919import java.net.UnknownHostException;
    2020import java.security.GeneralSecurityException;
     21import java.util.List;
    2122import java.util.Map;
    2223import java.util.Properties;
     
    3031
    3132import net.i2p.I2PException;
     33import net.i2p.client.I2PClient;
    3234import net.i2p.client.I2PSession;
    3335import net.i2p.client.I2PSessionException;
     
    3638import net.i2p.client.streaming.I2PSocketManager;
    3739import net.i2p.client.streaming.I2PSocketManagerFactory;
     40import net.i2p.crypto.SigType;
    3841import net.i2p.data.Base64;
    3942import net.i2p.data.Hash;
     
    6871    public static final String PROP_USE_SSL = "useSSL";
    6972    public static final String PROP_UNIQUE_LOCAL = "enableUniqueLocal";
     73    /** @since 0.9.30 */
     74    public static final String PROP_ALT_PKF = "altPrivKeyFile";
    7075    /** apparently unused */
    7176    protected static volatile long __serverId = 0;
     
    218223            rv.setName("I2PTunnel Server");
    219224            getTunnel().addSession(rv.getSession());
     225            String alt = props.getProperty(PROP_ALT_PKF);
     226            if (alt != null)
     227                addSubsession(rv, alt);
    220228            return rv;
    221229        } catch (I2PSessionException ise) {
     
    226234    }
    227235
     236    /**
     237     *  Add a non-DSA_SHA1 subsession to the DSA_SHA1 server if necessary.
     238     *
     239     *  @return subsession, or null if none was added
     240     *  @since 0.9.30
     241     */
     242    private I2PSession addSubsession(I2PSocketManager sMgr, String alt) {
     243        File altFile = TunnelController.filenameToFile(alt);
     244        if (alt == null)
     245            return null;
     246        I2PSession sess = sMgr.getSession();
     247        if (sess.getMyDestination().getSigType() != SigType.DSA_SHA1)
     248            return null;
     249        Properties props = new Properties();
     250        props.putAll(getTunnel().getClientOptions());
     251        // fixme get actual sig type
     252        String name = props.getProperty("inbound.nickname");
     253        if (name != null)
     254            props.setProperty("inbound.nickname", name + " (EdDSA)");
     255        name = props.getProperty("outbound.nickname");
     256        if (name != null)
     257            props.setProperty("outbound.nickname", name + " (EdDSA)");
     258        props.setProperty(I2PClient.PROP_SIGTYPE, "EdDSA_SHA512_Ed25519");
     259        FileInputStream privData = null;
     260        try {
     261            privData = new FileInputStream(altFile);
     262            return sMgr.addSubsession(privData, props);
     263        } catch (IOException ioe) {
     264            _log.error("Failed to add subssession", ioe);
     265            return null;
     266        } catch (I2PSessionException ise) {
     267            _log.error("Failed to add subssession", ise);
     268            return null;
     269        } finally {
     270            if (privData != null) try { privData.close(); } catch (IOException ioe) {}
     271        }
     272    }
     273
    228274
    229275    /**
     
    239285            try {
    240286                sockMgr.getSession().connect();
     287                // Now connect the subsessions, if any
     288                List<I2PSession> subs = sockMgr.getSubsessions();
     289                if (!subs.isEmpty()) {
     290                    for (I2PSession sub : subs) {
     291                        try {
     292                            sub.connect();
     293                            if (_log.shouldInfo())
     294                                _log.info("Connected subsession " + sub);
     295                        } catch (I2PSessionException ise) {
     296                            // not fatal?
     297                            String msg = "Unable to connect subsession " + sub;
     298                            this.l.log(msg);
     299                            _log.error(msg, ise);
     300                        }
     301                    }
     302                }
    241303            } catch (I2PSessionException ise) {
    242304                // try to make this error sensible as it will happen...
     
    619681        } catch (SocketException ex) {
    620682            try {
    621                 socket.close();
     683                socket.reset();
    622684            } catch (IOException ioe) {}
    623685            if (_log.shouldLog(Log.ERROR))
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelController.java

    rfa6fc84 ra3e146a8  
    44import java.io.FileOutputStream;
    55import java.io.IOException;
     6import java.security.GeneralSecurityException;
    67import java.util.ArrayList;
    78import java.util.Collection;
     
    1718import net.i2p.client.I2PClientFactory;
    1819import net.i2p.client.I2PSession;
     20import net.i2p.client.I2PSessionException;
     21import net.i2p.crypto.KeyGenerator;
    1922import net.i2p.crypto.SigType;
    2023import net.i2p.data.Destination;
     24import net.i2p.data.KeyCertificate;
     25import net.i2p.data.PrivateKey;
     26import net.i2p.data.PrivateKeyFile;
     27import net.i2p.data.PublicKey;
     28import net.i2p.data.SigningPrivateKey;
     29import net.i2p.data.SigningPublicKey;
     30import net.i2p.data.SimpleDataStructure;
    2131import net.i2p.i2ptunnel.socks.I2PSOCKSTunnel;
    2232import net.i2p.util.FileUtil;
    2333import net.i2p.util.I2PAppThread;
    2434import net.i2p.util.Log;
     35import net.i2p.util.RandomSource;
    2536import net.i2p.util.SecureFile;
    2637import net.i2p.util.SecureFileOutputStream;
     
    8495    private static final String OPT_LOW_TAGS = PFX_OPTION + "crypto.lowTagThreshold";
    8596    private static final String OPT_SIG_TYPE = PFX_OPTION + I2PClient.PROP_SIGTYPE;
     97    /** @since 0.9.30 */
     98    private static final String OPT_ALT_PKF = PFX_OPTION + I2PTunnelServer.PROP_ALT_PKF;
    8699
    87100    /** all of these @since 0.9.14 */
     
    107120    public static final SigType PREFERRED_SIGTYPE;
    108121    static {
    109         if (SystemVersion.isARM() || SystemVersion.isGNU() || SystemVersion.isAndroid()) {
     122        if (SystemVersion.isGNU() || SystemVersion.isAndroid()) {
    110123            if (SigType.ECDSA_SHA256_P256.isAvailable())
    111124                PREFERRED_SIGTYPE = SigType.ECDSA_SHA256_P256;
     
    147160        _messages = new ArrayList<String>(4);
    148161        boolean keyOK = true;
    149         if (createKey && (getType().endsWith("server") || getPersistentClientKey()))
     162        if (createKey && (!isClient() || getPersistentClientKey())) {
    150163            keyOK = createPrivateKey();
     164            if (keyOK && !isClient() && !getType().equals(TYPE_STREAMR_SERVER)) {
     165                // check rv?
     166                createAltPrivateKey();
     167            }
     168        }
    151169        _state = keyOK && getStartOnLoad() ? TunnelState.START_ON_LOAD : TunnelState.STOPPED;
    152170    }
     
    187205            log("Private key created and saved in " + keyFile.getAbsolutePath());
    188206            log("You should backup this file in a secure place.");
    189             log("New destination: " + destStr);
     207            log("New alternate destination: " + destStr);
    190208            String b32 = dest.toBase32();
    191209            log("Base32: " + b32);
     
    215233    }
    216234   
     235    /**
     236     * Creates alternate Destination with the same encryption keys as the primary Destination,
     237     * but a different signing key.
     238     *
     239     * Must have already called createPrivateKey() successfully.
     240     * Does nothing unless option OPT_ALT_PKF is set with the privkey file name.
     241     * Does nothing if the file already exists.
     242     *
     243     * @return success
     244     * @since 0.9.30
     245     */
     246    private boolean createAltPrivateKey() {
     247        if (PREFERRED_SIGTYPE == SigType.DSA_SHA1)
     248            return false;
     249        File keyFile = getPrivateKeyFile();
     250        if (keyFile == null)
     251            return false;
     252        if (!keyFile.exists())
     253            return false;
     254        File altFile = getAlternatePrivateKeyFile();
     255        if (altFile == null)
     256            return false;
     257        if (altFile.equals(keyFile))
     258            return false;
     259        if (altFile.exists())
     260            return true;
     261        PrivateKeyFile pkf = new PrivateKeyFile(keyFile);
     262        FileOutputStream out = null;
     263        try {
     264            Destination dest = pkf.getDestination();
     265            if (dest == null)
     266                return false;
     267            if (dest.getSigType() != SigType.DSA_SHA1)
     268                return false;
     269            PublicKey pub = dest.getPublicKey();
     270            PrivateKey priv = pkf.getPrivKey();
     271            SimpleDataStructure[] signingKeys = KeyGenerator.getInstance().generateSigningKeys(PREFERRED_SIGTYPE);
     272            SigningPublicKey signingPubKey = (SigningPublicKey) signingKeys[0];
     273            SigningPrivateKey signingPrivKey = (SigningPrivateKey) signingKeys[1];
     274            KeyCertificate cert = new KeyCertificate(signingPubKey);
     275            Destination d = new Destination();
     276            d.setPublicKey(pub);
     277            d.setSigningPublicKey(signingPubKey);
     278            d.setCertificate(cert);
     279            int len = signingPubKey.length();
     280            if (len < 128) {
     281                byte[] pad = new byte[128 - len];
     282                RandomSource.getInstance().nextBytes(pad);
     283                d.setPadding(pad);
     284            } else if (len > 128) {
     285                // copy of excess data handled in KeyCertificate constructor
     286            }
     287       
     288            out = new SecureFileOutputStream(altFile);
     289            d.writeBytes(out);
     290            priv.writeBytes(out);
     291            signingPrivKey.writeBytes(out);
     292            try { out.close(); } catch (IOException ioe) {}
     293
     294            String destStr = d.toBase64();
     295            log("Alternate private key created and saved in " + altFile.getAbsolutePath());
     296            log("You should backup this file in a secure place.");
     297            log("New destination: " + destStr);
     298            String b32 = d.toBase32();
     299            log("Base32: " + b32);
     300            File backupDir = new SecureFile(I2PAppContext.getGlobalContext().getConfigDir(), KEY_BACKUP_DIR);
     301            if (backupDir.isDirectory() || backupDir.mkdir()) {
     302                String name = b32 + '-' + I2PAppContext.getGlobalContext().clock().now() + ".dat";
     303                File backup = new File(backupDir, name);
     304                if (FileUtil.copy(altFile, backup, false, true)) {
     305                    SecureFileOutputStream.setPerms(backup);
     306                    log("Alternate private key backup saved to " + backup.getAbsolutePath());
     307                }
     308            }
     309            return true;
     310        } catch (GeneralSecurityException e) {
     311            log("Error creating keys " + e);
     312            return false;
     313        } catch (I2PSessionException e) {
     314            log("Error creating keys " + e);
     315            return false;
     316        } catch (I2PException e) {
     317            log("Error creating keys " + e);
     318            return false;
     319        } catch (IOException e) {
     320            log("Error creating keys " + e);
     321            return false;
     322        } catch (RuntimeException e) {
     323            log("Error creating keys " + e);
     324            return false;
     325        } finally {
     326            if (out != null) try { out.close(); } catch (IOException ioe) {}
     327        }
     328    }
     329   
    217330    public void startTunnelBackground() {
    218331        synchronized (this) {
     
    268381        // Config options may have changed since instantiation, so do this again.
    269382        // Or should we take it out of the constructor completely?
    270         if (type.endsWith("server") || getPersistentClientKey()) {
     383        if (!isClient() || getPersistentClientKey()) {
    271384            boolean ok = createPrivateKey();
    272385            if (!ok) {
     
    274387                log("Failed to start tunnel " + getName() + " as the private key file could not be created");
    275388                return;
     389            }
     390            if (!isClient() && !getType().equals(TYPE_STREAMR_SERVER)) {
     391                // check rv?
     392                createAltPrivateKey();
    276393            }
    277394        }
     
    642759            }
    643760        }
     761        Properties oldConfig = _config;
    644762        _config = props;
    645763
     
    686804            }
    687805        }
     806
     807        if (oldConfig != null) {
     808            if (configChanged(_config, oldConfig, PROP_FILE) ||
     809                configChanged(_config, oldConfig, OPT_ALT_PKF) ||
     810                configChanged(_config, oldConfig, OPT_SIG_TYPE)) {
     811                log("Tunnel must be stopped and restarted for private key file changes to take effect");
     812            }
     813        }
     814
    688815        // Running, so check sessions
    689816        Collection<I2PSession> sessions = getAllSessions();
     
    703830            }
    704831        }
     832    }
     833
     834    /**
     835     *  Is property p different in p1 and p2?
     836     *  @since 0.9.30
     837     */
     838    private static boolean configChanged(Properties p1, Properties p2, String p) {
     839        String s1 = p1.getProperty(p);
     840        String s2 = p2.getProperty(p);
     841        return (s1 != null && !s1.equals(s2)) ||
     842               (s1 == null && s2 != null);
    705843    }
    706844
     
    798936     */
    799937    public File getPrivateKeyFile() {
    800         String f = getPrivKeyFile();
     938        return filenameToFile(getPrivKeyFile());
     939    }
     940
     941    /**
     942     *  Does not necessarily exist.
     943     *  @return absolute path or null if unset
     944     *  @since 0.9.30
     945     */
     946    public File getAlternatePrivateKeyFile() {
     947        return filenameToFile(_config.getProperty(OPT_ALT_PKF));
     948    }
     949
     950    /**
     951     *  Does not necessarily exist.
     952     *  @param f relative or absolute path, may be null
     953     *  @return absolute path or null
     954     *  @since 0.9.30
     955     */
     956    static File filenameToFile(String f) {
    801957        if (f == null)
    802958            return null;
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/I2PTunnelDCCServer.java

    rfa6fc84 ra3e146a8  
    120120            } catch (SocketException ex) {
    121121                try {
    122                     socket.close();
     122                    socket.reset();
    123123                } catch (IOException ioe) {}
    124124                _log.error("Error relaying incoming DCC connection to IRC client at " + local.ia + ':' + local.port, ex);
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SocketWrapper.java

    rfa6fc84 ra3e146a8  
    8888    }
    8989
     90    /**
     91     * Just calls close()
     92     * @since 0.9.30
     93     */
     94    public void reset() throws IOException {
     95        close();
     96    }
     97
    9098    public boolean isClosed() {
    9199        return socket.isClosed();
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java

    rfa6fc84 ra3e146a8  
    265265    }
    266266
     267    /**
     268     *  @return path, non-null, non-empty
     269     */
    267270    public String getPrivateKeyFile(int tunnel) {
    268271        return getPrivateKeyFile(_group, tunnel);
    269272    }
    270273
     274    /**
     275     *  @return path, non-null, non-empty
     276     */
    271277    public String getPrivateKeyFile(TunnelControllerGroup tcg, int tunnel) {
    272278        TunnelController tun = getController(tcg, tunnel);
    273         if (tun != null && tun.getPrivKeyFile() != null)
    274             return tun.getPrivKeyFile();
     279        if (tun != null) {
     280            String rv = tun.getPrivKeyFile();
     281            if (rv != null)
     282                return rv;
     283        }
    275284        if (tunnel < 0)
    276285            tunnel = tcg == null ? 999 : tcg.getControllers().size();
     
    283292        }
    284293        return rv;
     294    }
     295
     296    /**
     297     *  @return path or ""
     298     *  @since 0.9.30
     299     */
     300    public String getAltPrivateKeyFile(int tunnel) {
     301        return getAltPrivateKeyFile(_group, tunnel);
     302    }
     303
     304    /**
     305     *  @return path or ""
     306     *  @since 0.9.30
     307     */
     308    public String getAltPrivateKeyFile(TunnelControllerGroup tcg, int tunnel) {
     309        TunnelController tun = getController(tcg, tunnel);
     310        if (tun != null) {
     311            File f = tun.getAlternatePrivateKeyFile();
     312            if (f != null)
     313                return f.getAbsolutePath();
     314        }
     315        return "";
    285316    }
    286317
     
    349380                try {
    350381                    rv = pkf.getDestination();
     382                    if (rv != null)
     383                        return rv;
     384                } catch (I2PException e) {
     385                } catch (IOException e) {}
     386            }
     387        }
     388        return null;
     389    }
     390
     391    /**
     392     *  Works even if tunnel is not running.
     393     *  @return Destination or null
     394     *  @since 0.9.30
     395     */
     396    public Destination getAltDestination(int tunnel) {
     397        TunnelController tun = getController(tunnel);
     398        if (tun != null) {
     399            // do this the hard way
     400            File keyFile = tun.getAlternatePrivateKeyFile();
     401            if (keyFile != null) {
     402                PrivateKeyFile pkf = new PrivateKeyFile(keyFile);
     403                try {
     404                    Destination rv = pkf.getDestination();
    351405                    if (rv != null)
    352406                        return rv;
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/TunnelConfig.java

    rfa6fc84 ra3e146a8  
    162162        return _privKeyFile;
    163163    }
     164
     165    /**
     166     *  What filename is this server tunnel's alternate private keys stored in
     167     *  @since 0.9.30
     168     */
     169    public void setAltPrivKeyFile(String file) {
     170        if (file != null)
     171            _otherOptions.put(I2PTunnelServer.PROP_ALT_PKF, file.trim());
     172    }
     173
    164174    /**
    165175     * If called with any value, we want this tunnel to start whenever it is
     
    726736         PROP_MAX_TOTAL_CONNS_MIN, PROP_MAX_TOTAL_CONNS_HOUR, PROP_MAX_TOTAL_CONNS_DAY,
    727737         PROP_MAX_STREAMS, I2PClient.PROP_SIGTYPE,
    728         "inbound.randomKey", "outbound.randomKey", "i2cp.leaseSetSigningPrivateKey", "i2cp.leaseSetPrivateKey"
     738        "inbound.randomKey", "outbound.randomKey", "i2cp.leaseSetSigningPrivateKey", "i2cp.leaseSetPrivateKey",
     739         I2PTunnelServer.PROP_ALT_PKF
    729740        };
    730741    private static final String _httpServerOpts[] = {
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java

    rfa6fc84 ra3e146a8  
    7070    public String getPrivateKeyFile(int tunnel) {
    7171        return _helper.getPrivateKeyFile(tunnel);
     72    }
     73
     74    /**
     75     *  @return path or ""
     76     *  @since 0.9.30
     77     */
     78    public String getAltPrivateKeyFile(int tunnel) {
     79        return _helper.getAltPrivateKeyFile(tunnel);
    7280    }
    7381   
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java

    rfa6fc84 ra3e146a8  
    489489        return "";
    490490    }
     491
     492    /**
     493     *  Works even if tunnel is not running.
     494     *  @return Destination or null
     495     *  @since 0.9.30
     496     */
     497    protected Destination getAltDestination(int tunnel) {
     498        return _helper.getAltDestination(tunnel);
     499    }
     500   
     501    /**
     502     *  Works even if tunnel is not running.
     503     *  @return Base64 or ""
     504     *  @since 0.9.30
     505     */
     506    public String getAltDestinationBase64(int tunnel) {
     507        Destination d = getAltDestination(tunnel);
     508        if (d != null)
     509            return d.toBase64();
     510        return "";
     511    }
     512   
     513    /**
     514     *  Works even if tunnel is not running.
     515     *  @return "{52 chars}.b32.i2p" or ""
     516     *  @since 0.9.30
     517     */
     518    public String getAltDestHashBase32(int tunnel) {
     519        Destination d = getAltDestination(tunnel);
     520        if (d != null)
     521            return d.toBase32();
     522        return "";
     523    }
    491524   
    492525    /**
     
    614647        _config.setSpoofedHost(host);
    615648    }
     649
    616650    /** What filename is this server tunnel's private keys stored in */
    617651    public void setPrivKeyFile(String file) {
    618652        _config.setPrivKeyFile(file);
    619653    }
     654
     655    /**
     656     *  What filename is this server tunnel's alternate private keys stored in
     657     *  @since 0.9.30
     658     */
     659    public void setAltPrivKeyFile(String file) {
     660        _config.setAltPrivKeyFile(file);
     661    }
     662
    620663    /**
    621664     * If called with any value (and the form submitted with action=Remove),
  • apps/i2ptunnel/jsp/editServer.jsp

    rfa6fc84 ra3e146a8  
    736736<% **********************/ %>
    737737
    738          <% if (true /* editBean.isAdvanced() */ ) {
    739                 int currentSigType = editBean.getSigType(curTunnel, tunnelType);
     738         <%
     739            int currentSigType = editBean.getSigType(curTunnel, tunnelType);
     740            if (true /* editBean.isAdvanced() */ ) {
    740741           %>
    741742        <tr>
     
    780781         <% } // isAdvanced %>
    781782
     783         <%
     784            /* alternate dest, only if current dest is set and is DSA_SHA1 */
     785
     786            if (currentSigType == 0 && !"".equals(b64) && !"streamrserver".equals(tunnelType)) {
     787          %><div id="privKeyField" class="rowItem">
     788                <label for="privKeyFile"><%=intl._t("Alternate private key file")%> (Ed25519-SHA-512):</label>
     789                <input type="text" size="30" id="privKeyFile" name="altPrivKeyFile" title="Path to Private Key File" value="<%=editBean.getAltPrivateKeyFile(curTunnel)%>" class="freetext" />               
     790            </div>
     791
     792         <%
     793              String ab64 = editBean.getAltDestinationBase64(curTunnel);
     794              if (!"".equals(ab64)) {
     795          %><div id="destinationField" class="rowItem">
     796                <label for="localDestination"><%=intl._t("Alternate local destination")%>:</label>
     797                <textarea rows="1" style="height: 3em;" cols="60" readonly="readonly" id="localDestination" title="Read Only: Alternate Local Destination" wrap="off" spellcheck="false"><%=ab64%></textarea>               
     798            </div>
     799            <div id="destinationField" class="rowItem">
     800                <label> </label>
     801                <span class="comment"><%=editBean.getAltDestHashBase32(curTunnel)%></span>
     802            </div>
     803            <div id="destinationField" class="rowItem">
     804        <%
     805                ab64 = ab64.replace("=", "%3d");
     806                String name = editBean.getSpoofedHost(curTunnel);
     807                if (name == null || name.equals(""))
     808                    name = editBean.getTunnelName(curTunnel);
     809                // mysite.i2p is set in the installed i2ptunnel.config
     810                if (name != null && !name.equals("") && !name.equals("mysite.i2p") && !name.contains(" ") && name.endsWith(".i2p")) {
     811           %><label>
     812              <a class="control" title="<%=intl._t("Generate QR Code")%>" href="/imagegen/qr?s=320&amp;t=<%=name%>&amp;c=http%3a%2f%2f<%=name%>%2f%3fi2paddresshelper%3d<%=ab64%>" target="_top"><%=intl._t("Generate QR Code")%></a>
     813              </label>
     814              <a class="control" href="/susidns/addressbook.jsp?book=private&amp;hostname=<%=name%>&amp;destination=<%=ab64%>#add"><%=intl._t("Add to local addressbook")%></a>
     815        <%
     816                } else {
     817            %><label> </label>
     818              <span class="comment"><%=intl._t("Set name with .i2p suffix to enable QR code generation")%></span>
     819        <%
     820                }  // name
     821          %></div>
     822        <%
     823              }  // ab64
     824          %><div class="subdivider"><hr /></div>
     825         <% } // currentSigType %>
     826
    782827        <tr>
    783828            <th colspan="2">
  • apps/i2ptunnel/jsp/register.jsp

    rfa6fc84 ra3e146a8  
    9292%>
    9393
     94<!--
    9495    <tr>
    9596        <th>
     
    102103        </td>
    103104    </tr>
     105-->
    104106
    105107<%
     
    308310<%
    309311               } else {
     312                   // If set, use the configured alternate destination as the new alias destination,
     313                   // and the configured primary destination as the inner signer.
     314                   // This is backwards from all the other ones, so we have to make a second HostTxtEntry just for this.
     315                   SigningPrivateKey spk3 = null;
     316                   String altdest = null;
     317                   String altdestfile = editBean.getAltPrivateKeyFile(curTunnel);
     318                   if (altdestfile.length() > 0) {
     319                       try {
     320                           PrivateKeyFile pkf3 = new PrivateKeyFile(altdestfile);
     321                           altdest = pkf3.getDestination().toBase64();
     322                           if (!b64.equals(altdest)) {
     323                               // disallow dup
     324                               spk3 = pkf3.getSigningPrivKey();
     325                           }
     326                       } catch (Exception e) {}
     327                   }
     328                   if (spk3 != null) {
     329                       OrderedProperties props2 = new OrderedProperties();
     330                       HostTxtEntry he2 = new HostTxtEntry(name, altdest, props2);
     331                       props2.setProperty(HostTxtEntry.PROP_ACTION, HostTxtEntry.ACTION_ADDDEST);
     332                       props2.setProperty(HostTxtEntry.PROP_OLDDEST, b64);
     333                       he2.signInner(spk);
     334                       he2.sign(spk3);
     335                %><tr><td><textarea rows="1" style="height: 3em;" cols="60" readonly="readonly" id="localDestination" title="Copy and paste this to the registration site" wrap="off" spellcheck="false"><% he2.write(out); %></textarea></td></tr>
     336                <tr><td class="infohelp"><%=intl._t("This will add an alternate destination for {0}", name)%></td></tr>
     337<%
     338                   } else {
    310339                %><tr><td class="infohelp"><%=intl._t("This tunnel must be configured with the new destination.")%>
    311340                  &nbsp;<%=intl._t("Enter old destination below.")%></td></tr>
    312341<%
    313                }
    314           %>
    315          
     342                   }  // spk3
     343               }  // spk2
     344          %>
     345
    316346<%
    317347
  • apps/jetty/build.xml

    rfa6fc84 ra3e146a8  
    44    <!-- This copies jars, with some modifications and renaming,
    55         from the jetty-distribution directory to the jettylib directory.
    6          This is disabled if the property with-libjetty8-java=true.
     6         This is disabled if the property with-libjetty9-java=true.
    77
    88         This copies jars, with some modifications and renaming,
     
    1515
    1616    <!-- Note: Please change all references in top-level build.xml if you update to a new Jetty! -->
    17     <property name="jetty.ver" value="8.1.21.v20160908" />
     17    <!-- unused until we go to 9.3 -->
     18    <property name="jetty.branch" value="stable-9" />
     19    <property name="jetty.ver" value="9.2.21.v20170120" />
    1820    <property name="jetty.base" value="jetty-distribution-${jetty.ver}" />
    19     <property name="jetty.sha1" value="9780e99e765fd7b9bb1aac8ba2bba374ac039764" />
     21    <property name="jetty.sha1" value="3dcd4f66cc3f72800a2ee53fecf7b3f9d3f23eb2" />
    2022    <property name="jetty.filename" value="${jetty.base}.zip" />
    21     <property name="jetty.url" value="http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/${jetty.ver}/${jetty.filename}" />
     23    <!-- change jetty.ver to jetty.branch for 9.3 -->
     24    <property name="jetty.url" value="http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/${jetty.ver}/${jetty.filename}" />
    2225    <property name="verified.filename" value="verified.txt" />
    2326    <property name="javac.compilerargs" value="" />
    2427    <property name="javac.version" value="1.7" />
    25     <property name="tomcat.lib" value="apache-tomcat-deployer/lib" />
    26     <property name="tomcat.ver" value="6.0.48" />
    27     <property name="tomcat2.lib" value="apache-tomcat-${tomcat.ver}/lib" />
    28     <property name="tomcat2.lib.small" value="apache-tomcat/lib" />
    2928
    3029    <target name="all" depends="build" />
     
    4241        <condition property="jetty.zip.extracted" >
    4342            <or>
    44                 <istrue value="${with-libjetty8-java}" />
     43                <istrue value="${with-libjetty9-java}" />
    4544                <available file="${jetty.base}" type="dir" />
    4645            </or>
     
    5453        <condition property="verified.already" >
    5554            <or>
    56                 <istrue value="${with-libjetty8-java}" />
     55                <istrue value="${with-libjetty9-java}" />
    5756                <istrue value="${jetty.zip.extracted}" />
    5857                <and>
     
    121120
    122121    <!-- Jetty and tomcat files -->
    123     <target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib" />
     122    <!--
     123         We support the following configurations:
     124           no system jars: Precise, Trusty
     125           with-libtomcat8-java: Jessie (without backports), Wheezy
     126           with-libtomcat8-java AND with-libjetty9-java: Xenial, Jessie (with backports), Stretch
     127           with-libjetty9-java (only): not supported
     128     -->
     129    <target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib1, copyJettylib2, copyTomcatLib" />
    124130
    125131    <!-- Jetty files only -->
    126     <target name="copyJettylib1" depends="extractJettylib" unless="${with-libjetty8-java}" >
     132    <target name="copyJettylib1" depends="extractJettylib" unless="${with-libjetty9-java}" >
    127133      <!-- We copy everything to names without the version numbers so we
    128134           can update them later. Where there was something similar in Jetty 5/6,
     
    167173            </manifest>
    168174        </jar>
     175    </target>
     176
     177    <!-- If with-libtomcat8-java but not with-libjetty9-java, we don't do this -->
     178    <target name="copyJettylib2" depends="extractJettylib" unless="${with-libtomcat8-java}" >
    169179        <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" >
    170             <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/servlet-api-3.0.jar" />
    171             <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jsp/javax.servlet.jsp-2.2.0.v201112011158.jar" />
     180            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/servlet-api-3.1.jar" />
     181          <!--
     182            Jetty version - see below for why we don't use this one
     183            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jsp/javax.servlet.jsp-api-2.3.1.jar" />
     184           -->
     185            <!-- Apache version -->
     186            <!-- Also includes org.apache.*, this is copied into jasper-runtime.jar below -->
     187            <zipfileset includes="javax/**/*" src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-jsp-8.0.33.jar"/>
     188            <!-- In Debian packages they are found in /usr/share/java/tomcat8-servlet-api.jar in the libtomcat8-java package -->
     189            <!-- javax/servlet/jsp/resources are dups of those in apache-jsp jar -->
     190            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties javax/servlet/jsp/resources/*" src="${jetty.base}/lib/jetty-schemas-3.1.jar" />
    172191        </jar>
    173192      <!--
     
    175194        <delete dir="${jetty.base}" />
    176195      -->
    177         <!-- commons-logging.jar not in Jetty 6 but we have it in launch4j so copy it over,
    178              needed for old plugins and things. We add tomcat-juli below.
    179           -->
    180       <!--
    181         * Removed in 0.9.24, see ticket #1679
    182         * Jetty now uses tomcat-juli (added below to commons-logging.jar), not commons-logging proper,
    183         * and no known plugins use it either.
    184         <jar destfile="jettylib/commons-logging.jar" filesetmanifest="mergewithoutmain" >
    185             <zipfileset excludes="META-INF/LICENSE.txt META-INF/NOTICE.txt" src="../../installer/lib/launch4j/lib/commons-logging.jar" />
    186         </jar>
    187       -->
    188     </target>
    189 
    190     <!-- Tomcat util jar.
    191          As of Tomcat 6.0.39, the deployer does not contain some classes that are required
    192          to precompile jsps with tags (SusiDNS and i2p-bote).
    193          These classes are in the main Tomcat package, in lib/tomcat-coyote.jar.
    194          As the jar is 800 KB and we only need 12 KB of that, we extract the required classes
    195          to a new jar, created and checked in using this target.
    196          Apparently this is only required for precompilation of jsps, so this is put in
    197          with the JspC compiler jasper-runtime.jar below.
    198      -->
    199     <target name="buildTomcatUtilJar" unless="${with-libservlet2.5-java}" >
    200         <!-- take only what we need from the tomcat-coyote jar -->
    201         <jar destfile="${tomcat2.lib.small}/tomcat-coyote-util.jar" >
    202             <zipfileset src="${tomcat2.lib}/tomcat-coyote.jar"
    203              includes="org/apache/tomcat/util/descriptor/* org/apache/tomcat/util/res/*" />
    204         </jar>
    205     </target>
     196    </target>
     197
    206198
    207199    <!-- Tomcat.
     
    222214    <target name="copyTomcatLib" depends="mkJettylibdir, copyTomcatLib1, copyTomcatLib2, copyTomcatLib3" />
    223215
    224     <target name="copyTomcatLib1" unless="${with-libservlet2.5-java}" >
     216    <target name="copyTomcatLib1" >
    225217        <condition property="with-libtomcat-java" >
    226218            <or>
     
    234226
    235227    <target name="copyTomcatLib2" unless="${with-libtomcat-java}" >
    236         <!-- EL libs.
     228        <!-- EL API and compiler libs.
    237229             Tomcat 6 has EL 2.1.
    238230             Tomcat 7 / libservlet3.0 has EL 2.2.
     231             Jetty 9 / Tomcat 8 / libservlet3.1 has EL 3.0.
    239232             According to http://stackoverflow.com/questions/7202686/differences-between-el-2-1-and-2-2
    240233             2.2 is backwards-compatible with 2.1.
    241234         -->
    242         <jar destfile="jettylib/commons-el.jar" duplicate="preserve" filesetmanifest="merge" >
    243             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar" />
    244             <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/el-api.jar" />
    245         </jar>
    246 
    247         <jar destfile="jettylib/jasper-runtime.jar" filesetmanifest="merge" >
    248             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper.jar" />
    249             <zipfileset src="${tomcat2.lib.small}/tomcat-coyote-util.jar" />
    250         </jar>
    251 <!--
    252         <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" >
    253             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/servlet-api.jar" />
    254             <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/jsp-api.jar" />
    255             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-api.jar" />
    256             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-util.jar" />
    257         </jar>
    258 -->
    259         <!-- Ant bug, don't set update and filesetmanifest or the update doesn't happen,
    260              Their bug tracker claims fixed in 1.8.0 but broken for me in 1.8.1
    261           -->
     235        <!-- the javax.el API, AND the com.sun.el parser -->
     236        <!-- actually from jetty9, not tomcat8... this will fail unless we have the jetty files also -->
     237        <jar destfile="jettylib/commons-el.jar" >
     238          <!--
     239            Jetty version
     240            <zipfileset src="${jetty.base}/lib/jsp/javax.el-3.0.0.jar"/>
     241           -->
     242            <!-- Apache version -->
     243            <zipfileset src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-el-8.0.33.jar"/>
     244        </jar>
     245
     246        <!-- actually from jetty9, not tomcat8... this will fail unless we have the jetty files also -->
     247        <jar destfile="jettylib/jasper-runtime.jar" >
     248          <!--
     249            Jetty version
     250            <zipfileset src="${jetty.base}/lib/jsp/javax.servlet.jsp-2.3.2.jar"/>
     251            To be included in jasper-runtime.jar?
     252            Server complains "NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet" even with this included (but it still works).
     253            The following file has the class, but /usr/share/java/jetty8-jsp.jar is empty
     254            We don't use this one, because we want to be consistent with Debian builds that
     255            must use Apache (aka libtomcat8).
     256            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jsp/jetty-jsp-${jetty.ver}.jar" />
     257           -->
     258            <!-- Apache version -->
     259            <!-- Also includes javax.servlet.jsp.*, this is copied into javax.servlet.jar above -->
     260            <zipfileset includes="org/**/*" src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-jsp-8.0.33.jar"/>
     261            <!-- required Jetty initializer (see RouterConsoleRunner) -->
     262            <zipfileset src="${jetty.base}/lib/apache-jsp/org.eclipse.jetty.apache-jsp-${jetty.ver}.jar"/>
     263        </jar>
     264
    262265        <jar destfile="jettylib/commons-logging.jar" update="true" >
    263             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-juli.jar" />
     266            <manifest>
     267                <attribute name="Note" value="Intentionally empty" />
     268            </manifest>
    264269        </jar>
    265270    </target>
  • apps/jetty/java/src/net/i2p/jetty/I2PLogger.java

    rfa6fc84 ra3e146a8  
    264264        return "net.i2p.jetty.I2PLogger";
    265265    }
     266
     267    /**
     268     *  @since Jetty 9
     269     */
     270    public void debug(String msg, long arg) {
     271        debug(msg, Long.valueOf(arg), null);
     272    }
    266273}
  • apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java

    rfa6fc84 ra3e146a8  
    2525import javax.servlet.http.Cookie;
    2626
    27 import org.eclipse.jetty.http.HttpHeaders;
    2827import org.eclipse.jetty.http.PathMap;
    2928import org.eclipse.jetty.server.Request;
     
    8281    private transient OutputStream _fileOut;
    8382    private transient DateCache _logDateCache;
    84     private transient PathMap _ignorePathMap;
     83    private transient PathMap<String> _ignorePathMap;
    8584    private transient Writer _writer;
    8685    private transient ArrayList<Utf8StringBuilder> _buffers;
     
    287286                if (_preferProxiedForAddress)
    288287                {
    289                     addr = request.getHeader(HttpHeaders.X_FORWARDED_FOR);
     288                    addr = request.getHeader("X-Forwarded-For");
    290289                }
    291290
     
    311310                    buf.append(_logDateCache.format(request.getTimeStamp()));
    312311                else
    313                     buf.append(request.getTimeStampBuffer().toString());
     312                    //buf.append(request.getTimeStampBuffer().toString());
     313                    // TODO SimpleDateFormat or something
     314                    buf.append(request.getTimeStamp());
    314315                   
    315316                buf.append("] \"");
     
    359360                synchronized(_writer)
    360361                {
    361                     buf.append(StringUtil.__LINE_SEPARATOR);
     362                    buf.append(System.getProperty("line.separator", "\n"));
    362363                    int l=buf.length();
    363364                    if (l>_copy.length)
     
    413414                    }
    414415
    415                     _writer.write(StringUtil.__LINE_SEPARATOR);
     416                    _writer.write(System.getProperty("line.separator", "\n"));
    416417                    _writer.flush();
    417418                }
     
    430431                               Writer writer) throws IOException
    431432    {
    432         String referer = request.getHeader(HttpHeaders.REFERER);
     433        String referer = request.getHeader("Referer");
    433434        if (referer == null)
    434435            writer.write("\"-\" ");
     
    440441        }
    441442       
    442         String agent = request.getHeader(HttpHeaders.USER_AGENT);
     443        String agent = request.getHeader("User-Agent");
    443444        if (agent == null)
    444445            writer.write("\"-\" ");
     
    456457        if (_logDateFormat!=null)
    457458        {       
    458             _logDateCache = new DateCache(_logDateFormat, _logLocale);
    459             _logDateCache.setTimeZoneID(_logTimeZone);
     459            _logDateCache = new DateCache(_logDateFormat, _logLocale, _logTimeZone);
    460460        }
    461461       
     
    473473        if (_ignorePaths != null && _ignorePaths.length > 0)
    474474        {
    475             _ignorePathMap = new PathMap();
     475            _ignorePathMap = new PathMap<String>();
    476476            for (int i = 0; i < _ignorePaths.length; i++)
    477477                _ignorePathMap.put(_ignorePaths[i], _ignorePaths[i]);
  • apps/jetty/java/src/net/i2p/jetty/JettyStart.java

    rfa6fc84 ra3e146a8  
    3131
    3232import org.eclipse.jetty.server.Connector;
     33import org.eclipse.jetty.server.NetworkConnector;
    3334import org.eclipse.jetty.server.Server;
    3435import org.eclipse.jetty.util.component.LifeCycle;
     
    131132                                Connector[] connectors = server.getConnectors();
    132133                                if (connectors.length > 0) {
    133                                     int port = connectors[0].getPort();
    134                                     if (port > 0) {
    135                                         _port = port;
    136                                         String host = connectors[0].getHost();
    137                                         if (host.equals("0.0.0.0") || host.equals("::"))
    138                                             host = "127.0.0.1";
    139                                         _context.portMapper().register(PortMapper.SVC_EEPSITE, host, port);
     134                                    Connector conn = connectors[0];
     135                                    if (conn instanceof NetworkConnector) {
     136                                        NetworkConnector nconn = (NetworkConnector) conn;
     137                                        int port = nconn.getPort();
     138                                        if (port > 0) {
     139                                            _port = port;
     140                                            String host = nconn.getHost();
     141                                            if (host.equals("0.0.0.0") || host.equals("::"))
     142                                                host = "127.0.0.1";
     143                                            _context.portMapper().register(PortMapper.SVC_EEPSITE, host, port);
     144                                        }
    140145                                    }
    141146                                }
  • apps/jetty/java/src/org/mortbay/servlet/MultiPartRequest.java

    rfa6fc84 ra3e146a8  
    5050 *
    5151 * Modded to compile with Jetty 6 for I2P
     52 * Modded to make fields private and final
    5253 *
    5354 * @version $Id: MultiPartRequest.java,v 1.16 2005/12/02 20:13:52 gregwilkins Exp $
     
    6061
    6162    /* ------------------------------------------------------------ */
    62     HttpServletRequest _request;
    63     LineInput _in;
    64     String _boundary;
    65     String _encoding;
    66     byte[] _byteBoundary;
    67     MultiMap<String> _partMap = new MultiMap<String>(10);
    68     int _char=-2;
    69     boolean _lastPart=false;
     63    private final HttpServletRequest _request;
     64    private final LineInput _in;
     65    private final String _boundary;
     66    private final String _encoding;
     67    private final byte[] _byteBoundary;
     68    private final MultiMap<String> _partMap = new MultiMap<String>(10);
     69    private int _char=-2;
     70    private boolean _lastPart=false;
    7071   
    7172    /* ------------------------------------------------------------ */
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocket.java

    rfa6fc84 ra3e146a8  
    113113     */
    114114    public int getLocalPort();
     115   
     116    /**
     117     *  Resets and closes this socket. Sends a RESET indication to the far-end.
     118     *  This is the equivalent of setSoLinger(true, 0) followed by close() on a Java Socket.
     119     *
     120     *  Nonblocking.
     121     *  Any thread currently blocked in an I/O operation upon this socket will throw an IOException.
     122     *  Once a socket has been reset, it is not available for further networking use
     123     *  (i.e. can't be reconnected or rebound). A new socket needs to be created.
     124     *  Resetting this socket will also close the socket's InputStream and OutputStream.
     125     *
     126     *  @since 0.9.30
     127     */
     128    public void reset() throws IOException;
    115129
    116130    /**
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManager.java

    rfa6fc84 ra3e146a8  
    3939   
    4040    /**
     41     *  For a server, you must call connect() on the returned object.
     42     *  Connecting the primary session does NOT connect any subsessions.
     43     *  If the primary session is not connected, connecting a subsession will connect the primary session first.
     44     *
    4145     *  @return a new subsession, non-null
    4246     *  @param privateKeyStream null for transient, if non-null must have same encryption keys as primary session
  • apps/routerconsole/java/build.xml

    rfa6fc84 ra3e146a8  
    7171                <pathelement location="../../jetty/jettylib/jetty-webapp.jar" />
    7272                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
     73                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
    7374                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
    7475                <pathelement location="../../systray/java/build/systray.jar" />
     
    7677                <pathelement location="../../../installer/lib/wrapper/all/wrapper.jar" />
    7778                <pathelement location="../../jrobin/java/build/jrobin.jar" />
     79
     80                <!-- following jars only present for debian builds -->
     81                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
    7882            </classpath>
    7983        </javac>
     
    363367        -->
    364368        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
     369            <!-- this prevents tomcat from complaining in debian builds -->
     370            <jvmarg value="-Dtomcat.util.scan.StandardJarScanFilter.jarsToSkip=commons-collections.jar,junit.jar,junit4.jar" />
    365371            <classpath>
    366372                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
    367373                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
    368                 <!-- jsp-api.jar only present for debian builds -->
     374
     375                <!-- following jars only present for debian builds -->
    369376                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    370                 <!-- tomcat-api.jar only present for debian builds -->
    371377                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
    372                 <!-- jasper-el.jar only present for debian builds -->
    373378                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
     379                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
     380                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
     381
    374382                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
    375383                <pathelement location="../../jetty/jettylib/commons-el.jar" />
     384                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
    376385                <pathelement location="${ant.home}/lib/ant.jar" />
    377386                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
     
    404413                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
    405414                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
    406                 <!-- jsp-api.jar only present for debian builds -->
     415
     416                <!-- following jars only present for debian builds -->
    407417                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    408                 <!-- tomcat-api.jar only present for debian builds -->
    409418                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
     419                <pathelement location="../../jetty/jettylib/tomcat-util.jar" />
     420                <pathelement location="../../jetty/jettylib/tomcat-util-scan.jar" />
     421
    410422                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
    411423                <pathelement location="../../jetty/jettylib/commons-el.jar" />
  • apps/routerconsole/java/src/net/i2p/router/update/PluginUpdateRunner.java

    rfa6fc84 ra3e146a8  
    458458                    return;
    459459                }
     460                String blacklistVersion = PluginStarter.jetty9Blacklist.get(appName);
     461                if (blacklistVersion != null &&
     462                    VersionComparator.comp(version, blacklistVersion) <= 0) {
     463                    to.delete();
     464                    statusDone("<b>" + _t("Plugin requires Jetty version {0} or lower", "8.9999") + "</b>");
     465                    return;
     466                }
    460467                maxVersion = ConfigClientsHelper.stripHTML(props, "max-jetty-version");
    461468                if (maxVersion != null &&
     
    481488                    // we don't need the original file anymore.
    482489                    to.delete();
    483                     statusDone("<b>" + _t("Plugin will be installed on next restart.") + "</b>");
     490                    statusDone("<b>" + _t("Plugin will be installed on next restart.") + ' ' + appName + ' ' + version + "</b>");
    484491                    return;
    485492                }
     
    499506                if (Boolean.valueOf(props.getProperty("update-only")).booleanValue()) {
    500507                    to.delete();
    501                     statusDone("<b>" + _t("Plugin is for upgrades only, but the plugin is not installed") + "</b>");
     508                    statusDone("<b>" + _t("Plugin is for upgrades only, but the plugin is not installed") + ". " + appName + ' ' + version + "</b>");
    502509                    return;
    503510                }
     
    519526            // install != update. Changing the user's settings like this is probabbly a bad idea.
    520527            if (Boolean.valueOf( props.getProperty("dont-start-at-install")).booleanValue()) {
    521                 statusDone("<b>" + _t("Plugin {0} installed", appName) + "</b>");
     528                statusDone("<b>" + _t("Plugin {0} installed", appName + ' ' + version) + "</b>");
    522529                if(!update) {
    523530                    Properties pluginProps = PluginStarter.pluginProperties();
     
    535542                        String link;
    536543                        if (linkName != null && linkURL != null)
    537                             link = "<a target=\"_blank\" href=\"" + linkURL + "\"/>" + linkName + "</a>";
     544                            link = "<a target=\"_blank\" href=\"" + linkURL + "\"/>" + linkName + ' ' + version + "</a>";
    538545                        else
    539                             link = appName;
     546                            link = appName + ' ' + version;
    540547                        statusDone("<b>" + _t("Plugin {0} installed and started", link) + "</b>");
    541548                    }
    542549                    else
    543                         statusDone("<b>" + _t("Plugin {0} installed but failed to start, check logs", appName) + "</b>");
     550                        statusDone("<b>" + _t("Plugin {0} installed but failed to start, check logs", appName + ' ' + version) + "</b>");
    544551                } catch (Throwable e) {
    545                     statusDone("<b>" + _t("Plugin {0} installed but failed to start", appName) + ": " + e + "</b>");
    546                     _log.error("Error starting plugin " + appName, e);
     552                    statusDone("<b>" + _t("Plugin {0} installed but failed to start", appName + ' ' + version) + ": " + e + "</b>");
     553                    _log.error("Error starting plugin " + appName + ' ' + version, e);
    547554                }
    548555            } else {
    549                 statusDone("<b>" + _t("Plugin {0} installed", appName) + "</b>");
     556                statusDone("<b>" + _t("Plugin {0} installed", appName + ' ' + version) + "</b>");
    550557            }
    551558        }
  • apps/routerconsole/java/src/net/i2p/router/web/CodedIconRendererServlet.java

    rfa6fc84 ra3e146a8  
    3434
    3535     @Override
    36      protected void service(HttpServletRequest srq, HttpServletResponse srs) throws ServletException, IOException {
     36     protected void doGet(HttpServletRequest srq, HttpServletResponse srs) throws ServletException, IOException {
    3737         byte[] data;
    3838         String name = srq.getParameter("plugin");
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java

    rfa6fc84 ra3e146a8  
    574574        try {
    575575            PluginStarter.startPlugin(_context, app);
    576             addFormNotice(_t("Started plugin {0}", app));
     576            // linkify the app name for the message if available
     577            Properties props = PluginStarter.pluginProperties(_context, app);
     578            String name = ConfigClientsHelper.stripHTML(props, "consoleLinkName_" + Messages.getLanguage(_context));
     579            if (name == null)
     580                name = ConfigClientsHelper.stripHTML(props, "consoleLinkName");
     581            String url = ConfigClientsHelper.stripHTML(props, "consoleLinkURL");
     582            if (name != null && url != null && name.length() > 0 && url.length() > 0) {
     583                app = "<a href=\"" + url + "\">" + name + "</a>";
     584                addFormNoticeNoEscape(_t("Started plugin {0}", app));
     585            } else {
     586                addFormNotice(_t("Started plugin {0}", app));
     587            }
    577588        } catch (Throwable e) {
    578589            addFormError(_t("Error starting plugin {0}", app) + ": " + e);
  • apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java

    rfa6fc84 ra3e146a8  
    6868    private static Map<String, Collection<String>> pluginWars = new ConcurrentHashMap<String, Collection<String>>();
    6969
     70    /**
     71     *  Plugin name to plugin version of plugins that do not work
     72     *  with Jetty 9, but do not have a max-jetty-version=8.9999 set.
     73     *  Unmodifiable.
     74     *
     75     *  @since 0.9.30
     76     */
     77    public static final Map<String, String> jetty9Blacklist;
     78
     79    static {
     80        Map<String, String> map = new HashMap<String, String>(4);
     81        map.put("i2pbote", "0.4.5");
     82        map.put("BwSchedule", "0.0.36");
     83        jetty9Blacklist = Collections.unmodifiableMap(map);
     84    }
     85
    7086    public PluginStarter(RouterContext ctx) {
    7187        _context = ctx;
     
    298314        Properties props = pluginProperties(ctx, appName);
    299315
    300 
    301 
     316        // For the following, we use the exact same translated strings as in PluginUpdateRunner
     317        // to avoid duplication
    302318
    303319        String minVersion = ConfigClientsHelper.stripHTML(props, "min-i2p-version");
     
    307323            log.error(foo);
    308324            disablePlugin(appName);
     325            foo = gettext("This plugin requires I2P version {0} or higher", minVersion, ctx);
    309326            throw new Exception(foo);
    310327        }
     
    316333            log.error(foo);
    317334            disablePlugin(appName);
     335            foo = gettext("This plugin requires Java version {0} or higher", minVersion, ctx);
    318336            throw new Exception(foo);
    319337        }
     
    326344            log.error(foo);
    327345            disablePlugin(appName);
     346            foo = gettext("Plugin requires Jetty version {0} or higher", minVersion, ctx);
     347            throw new Exception(foo);
     348        }
     349
     350        String blacklistVersion = jetty9Blacklist.get(appName);
     351        String curVersion = ConfigClientsHelper.stripHTML(props, "version");
     352        if (blacklistVersion != null &&
     353            VersionComparator.comp(curVersion, blacklistVersion) <= 0) {
     354            String foo = "Plugin " + appName + " requires Jetty version 8.9999 or lower";
     355            log.error(foo);
     356            disablePlugin(appName);
     357            foo = gettext("Plugin requires Jetty version {0} or lower", "8.9999", ctx);
    328358            throw new Exception(foo);
    329359        }
     
    335365            log.error(foo);
    336366            disablePlugin(appName);
     367            foo = gettext("Plugin requires Jetty version {0} or lower", maxVersion, ctx);
    337368            throw new Exception(foo);
    338369        }
     
    10031034    }
    10041035
     1036    /**
     1037     * translate a string
     1038     * @since 0.9.30
     1039     */
     1040    private static String gettext(String s, Object o, I2PAppContext ctx) {
     1041        return Messages.getString(s, o, ctx);
     1042    }
     1043
    10051044    /** translate a string */
    10061045    private static String ngettext(String s, String p, int n, I2PAppContext ctx) {
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    rfa6fc84 ra3e146a8  
    1818import java.util.Map;
    1919import java.util.Properties;
     20import java.util.Set;
    2021import java.util.SortedSet;
    2122import java.util.StringTokenizer;
    22 import java.util.Timer;
    2323import java.util.concurrent.LinkedBlockingQueue;
    2424
     
    4747import org.eclipse.jetty.security.authentication.DigestAuthenticator;
    4848import org.eclipse.jetty.server.AbstractConnector;
     49import org.eclipse.jetty.server.ConnectionFactory;
    4950import org.eclipse.jetty.server.Connector;
     51import org.eclipse.jetty.server.HttpConfiguration;
     52import org.eclipse.jetty.server.HttpConnectionFactory;
    5053import org.eclipse.jetty.server.NCSARequestLog;
     54import org.eclipse.jetty.server.SecureRequestCustomizer;
    5155import org.eclipse.jetty.server.Server;
    5256import org.eclipse.jetty.server.UserIdentity;
    53 import org.eclipse.jetty.server.bio.SocketConnector;
     57import org.eclipse.jetty.server.ServerConnector;
     58import org.eclipse.jetty.server.SslConnectionFactory;
    5459import org.eclipse.jetty.server.handler.ContextHandlerCollection;
    5560import org.eclipse.jetty.server.handler.DefaultHandler;
     
    5762import org.eclipse.jetty.server.handler.HandlerWrapper;
    5863import org.eclipse.jetty.server.handler.RequestLogHandler;
    59 import org.eclipse.jetty.server.nio.SelectChannelConnector;
    60 import org.eclipse.jetty.server.ssl.SslSocketConnector;
    61 import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
    6264import org.eclipse.jetty.servlet.ServletHandler;
    6365import org.eclipse.jetty.servlet.ServletHolder;
     
    7173import org.eclipse.jetty.util.thread.ExecutorThreadPool;
    7274import org.eclipse.jetty.util.thread.QueuedThreadPool;
     75import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
    7376import org.eclipse.jetty.util.thread.ThreadPool;
    7477
     
    97100    private volatile ClientAppState _state = UNINITIALIZED;
    98101    private static Server _server;
    99     private static Timer _jettyTimer;
     102    private static ScheduledExecutorScheduler _jettyTimer;
    100103    private String _listenPort;
    101104    private String _listenHost;
     
    232235        if (PluginStarter.pluginsEnabled(_context))
    233236            (new I2PAppThread(new PluginStopper(_context), "PluginStopper")).start();
     237        stopAllWebApps();
    234238        try {
    235239            _server.stop();
     
    240244        synchronized(RouterConsoleRunner.class) {
    241245            if (_jettyTimer != null) {
    242                 _jettyTimer.cancel();
     246                try {
     247                    _jettyTimer.stop();
     248                } catch (Exception e) {}
    243249                _jettyTimer = null;
    244250            }
     
    364370     *                  RequestLogHandler (opt)
    365371     *</pre>
     372     *
     373     *  Porting to Jetty 9:
     374     *
     375     *  http://dev.eclipse.org/mhonarc/lists/jetty-dev/msg01952.html
     376     *  You are missing a few facts about Jetty 9.1 ...
     377     *  First, there are no longer any blocking connectors.
     378     *  Its all async / nio connectors now. (mainly because that's the direction that the servlet api 3.1 is taking)
     379     *
     380     *  Next, there is only 1 connector.   The ServerConnector.
     381     *  However, it takes 1 or more ConnectionFactory implementations to know how to handle the incoming connection.
     382     *  We have factories for HTTP (0.9 thru 1.1), SPDY, SSL-http, and SSL-npn so far.
     383     *  This list of factories will expand as the future of connectivity to web servers is ever growing (think HTTP/2)
     384     *
     385     *  Use the embedded examples for help understanding this.
     386     *  http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ManyConnectors.java?id=jetty-9.1.0.RC0
     387     *
    366388     */
    367389    public void startConsole() {
     
    376398        // so Jetty can find WebAppConfiguration
    377399        System.setProperty("jetty.class.path", _context.getBaseDir() + "/lib/routerconsole.jar");
    378         _server = new Server();
    379         _server.setGracefulShutdown(1000);
     400        // FIXME
     401        // http://dev.eclipse.org/mhonarc/lists/jetty-users/msg03487.html
     402        //_server.setGracefulShutdown(1000);
    380403
    381404        // In Jetty 6, QTP was not concurrent, so we switched to
     
    409432            //System.out.println("INFO: Jetty concurrent ThreadPool unavailable, using QueuedThreadPool");
    410433            LinkedBlockingQueue<Runnable> lbq = new LinkedBlockingQueue<Runnable>(4*MAX_THREADS);
    411             QueuedThreadPool qtp = new QueuedThreadPool(lbq);
    412             // min and max threads will be set below
    413             //qtp.setMinThreads(MIN_THREADS);
    414             //qtp.setMaxThreads(MAX_THREADS);
    415             qtp.setMaxIdleTimeMs(MAX_IDLE_TIME);
     434            // min and max threads will be reset below
     435            QueuedThreadPool qtp = new QueuedThreadPool(MAX_THREADS, MIN_THREADS, MAX_IDLE_TIME, lbq);
    416436            qtp.setName(THREAD_NAME);
    417437            qtp.setDaemon(true);
    418             _server.setThreadPool(qtp);
     438            _server = new Server(qtp);
    419439        //}
    420440
     
    503523                            if (testSock != null) try { testSock.close(); } catch (IOException ioe) {}
    504524                        }
    505                         //if (host.indexOf(":") >= 0) // IPV6 - requires patched Jetty 5
    506                         //    _server.addListener('[' + host + "]:" + _listenPort);
    507                         //else
    508                         //    _server.addListener(host + ':' + _listenPort);
    509                         AbstractConnector lsnr;
    510                         if (SystemVersion.isJava6() && !SystemVersion.isGNU()) {
    511                             SelectChannelConnector slsnr = new SelectChannelConnector();
    512                             slsnr.setUseDirectBuffers(false);  // default true seems to be leaky
    513                             lsnr = slsnr;
    514                         } else {
    515                             // Jetty 6 and NIO on Java 5 don't get along that well
    516                             // Also: http://jira.codehaus.org/browse/JETTY-1238
    517                             // "Do not use GCJ with Jetty, it will not work."
    518                             // Actually it does if you don't use NIO
    519                             lsnr = new SocketConnector();
    520                         }
     525                        HttpConfiguration httpConfig = new HttpConfiguration();
     526                        // number of acceptors, (default) number of selectors
     527                        ServerConnector lsnr = new ServerConnector(_server, 1, 0,
     528                                                                   new HttpConnectionFactory(httpConfig));
     529                        //lsnr.setUseDirectBuffers(false);  // default true seems to be leaky
    521530                        lsnr.setHost(host);
    522531                        lsnr.setPort(lport);
    523                         lsnr.setMaxIdleTime(90*1000);  // default 10 sec
     532                        lsnr.setIdleTimeout(90*1000);  // default 10 sec
    524533                        lsnr.setName("ConsoleSocket");   // all with same name will use the same thread pool
    525                         lsnr.setAcceptors(1);          // default changed to 2 somewhere in Jetty 7?
    526534                        //_server.addConnector(lsnr);
    527535                        connectors.add(lsnr);
     
    587595                                if (testSock != null) try { testSock.close(); } catch (IOException ioe) {}
    588596                            }
    589                             // TODO if class not found use SslChannelConnector
    590                             AbstractConnector ssll;
    591                             if (SystemVersion.isJava6() && !SystemVersion.isGNU()) {
    592                                 SslSelectChannelConnector sssll = new SslSelectChannelConnector(sslFactory);
    593                                 sssll.setUseDirectBuffers(false);  // default true seems to be leaky
    594                                 ssll = sssll;
    595                             } else {
    596                                 // Jetty 6 and NIO on Java 5 don't get along that well
    597                                 SslSocketConnector sssll = new SslSocketConnector(sslFactory);
    598                                 ssll = sssll;
    599                             }
     597                            HttpConfiguration httpConfig = new HttpConfiguration();
     598                            httpConfig.setSecureScheme("https");
     599                            httpConfig.setSecurePort(sslPort);
     600                            httpConfig.addCustomizer(new SecureRequestCustomizer());
     601                            // number of acceptors, (default) number of selectors
     602                            ServerConnector ssll = new ServerConnector(_server, 1, 0,
     603                                                                       new SslConnectionFactory(sslFactory, "http/1.1"),
     604                                                                       new HttpConnectionFactory(httpConfig));
     605                            //sssll.setUseDirectBuffers(false);  // default true seems to be leaky
    600606                            ssll.setHost(host);
    601607                            ssll.setPort(sslPort);
    602                             ssll.setMaxIdleTime(90*1000);  // default 10 sec
     608                            ssll.setIdleTimeout(90*1000);  // default 10 sec
    603609                            ssll.setName("ConsoleSocket");   // all with same name will use the same thread pool
    604                             ssll.setAcceptors(1);          // default changed to 2 somewhere in Jetty 7?
    605610                            //_server.addConnector(ssll);
    606611                            connectors.add(ssll);
     
    639644                                                       (_listenPort != null ? _listenPort : _sslListenPort));
    640645            tmpdir.mkdir();
    641             if (!SystemVersion.isWindows() && !SystemVersion.isMac() &&
    642                 _context.getBaseDir().getAbsolutePath().equals("/usr/share/i2p")) {
    643                // We are using Tomcat 6, so the Debian patch doesn't apply.
    644                // Remove when we switch to Tomcat 8
    645                _context.logManager().getLog(Server.class).logAlways(net.i2p.util.Log.INFO, "Please ignore any InstanceManager warnings");
    646             }
    647646            rootServletHandler = new ServletHandler();
    648647            rootWebApp = new LocaleWebAppHandler(_context,
    649648                                                  "/", _webAppsDir + ROUTERCONSOLE + ".war",
    650649                                                 tmpdir, rootServletHandler);
    651             initialize(_context, (WebAppContext)(rootWebApp.getHandler()));
     650            try {
     651                // Not sure who is supposed to call this, but unless we do,
     652                // all the jsps die NPE, because JspFactory.getDefaultContext() returns null.
     653                // We probably have to do this because we don't bundle the Jetty annotations jar and scanner.
     654                // This is only with Tomcat 8, not with the Jetty (Eclipse) jsp impl.
     655                // Got a clue from this ancient post for Tomcat 6:
     656                // https://bz.apache.org/bugzilla/show_bug.cgi?id=39804
     657                // see also apps/jetty/build.xml
     658                Class.forName("org.eclipse.jetty.apache.jsp.JettyJasperInitializer");
     659            } catch (ClassNotFoundException cnfe) {
     660                System.err.println("Warning: JettyJasperInitializer not found");
     661            }
     662            WebAppContext wac = (WebAppContext)(rootWebApp.getHandler());
     663            initialize(_context, wac);
     664            WebAppStarter.setWebAppConfiguration(wac);
    652665            chColl.addHandler(rootWebApp);
    653666
     
    710723                    String appName = fileNames[i].substring(0, fileNames[i].lastIndexOf(".war"));
    711724                    String enabled = props.getProperty(PREFIX + appName + ENABLED);
    712                     if (! "false".equals(enabled)) {
     725                    if (appName.equals("addressbook")) {
     726                        // addressbook.war is now empty, thread is started by SusiDNS
     727                        if (enabled != null) {
     728                            props.remove(PREFIX + "addressbook" + ENABLED);
     729                            rewrite = true;
     730                        }
     731                    } else if (! "false".equals(enabled)) {
    713732                        try {
    714733                            String path = new File(dir, fileNames[i]).getCanonicalPath();
     
    946965        synchronized(RouterConsoleRunner.class) {
    947966            if (_jettyTimer == null) {
    948                 _jettyTimer = new Timer("Console HashSessionScavenger", true);
     967                _jettyTimer = new ScheduledExecutorScheduler("Console HashSessionScavenger", true);
     968                try {
     969                    _jettyTimer.start();
     970                } catch (Exception e) {
     971                    System.err.println("Warning: ScheduledExecutorScheduler start failed: " + e);
     972                }
    949973            }
    950974            context.getServletContext().setAttribute("org.eclipse.jetty.server.session.timer", _jettyTimer);
     
    10171041            // _log.warn("Error loading the client app properties from " + cfgFile.getName(), ioe);
    10181042        }
     1043    }
     1044
     1045    /**
     1046     *  Stops all but the root webapp (routerconsole.war)
     1047     *  In Jetty 9, stopping the server doesn't stop the non-root webapps,
     1048     *  so we must do it here.
     1049     *  There should be a better way to do this, possibly by
     1050     *  making the webapps "managed".
     1051     *  @since 0.9.30
     1052     */
     1053    private void stopAllWebApps() {
     1054        Properties props = webAppProperties(_context);
     1055        Set<String> keys = props.stringPropertyNames();
     1056        for (String name : keys) {
     1057            if (name.startsWith(PREFIX) && name.endsWith(ENABLED)) {
     1058                String app = name.substring(PREFIX.length(), name.lastIndexOf(ENABLED));
     1059                if (ROUTERCONSOLE.equals(app))
     1060                    continue;
     1061                if (WebAppStarter.isWebAppRunning(app)) {
     1062                    try {
     1063                        WebAppStarter.stopWebApp(app);
     1064                    } catch (Throwable t) { t.printStackTrace(); }
     1065                }
     1066            }
     1067        }
     1068
    10191069    }
    10201070
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppConfiguration.java

    rfa6fc84 ra3e146a8  
    1616import net.i2p.I2PAppContext;
    1717
     18import org.apache.tomcat.SimpleInstanceManager;
    1819import org.eclipse.jetty.webapp.Configuration;
    1920import org.eclipse.jetty.webapp.WebAppClassLoader;
     
    9899            // Only really required if started manually, but we don't know that from here
    99100            cp = "jetty-util.jar";
    100         } else ****/ if (pluginDir.exists()) {
     101****/
     102        if (ctxPath.equals("/susidns")) {
     103            // Old installs don't have this in their wrapper.config classpath
     104            cp = "addressbook.jar";
     105        } else if (pluginDir.exists()) {
    101106            File consoleDir = new File(pluginDir, "console");
    102107            Properties props = RouterConsoleRunner.webAppProperties(consoleDir.getAbsolutePath());
     
    174179        } else {
    175180            // Java 9 - assume everything in lib/ is in the classpath
     181            // except addressbook.jar
    176182            File libDir = new File(ctx.getBaseDir(), "lib");
    177183            File[] files = libDir.listFiles();
    178184            if (files != null) {
    179185                for (int i = 0; i < files.length; i++) {
    180                     if (files[i].getName().endsWith(".jar"))
     186                    String name = files[i].getName();
     187                    if (name.endsWith(".jar") && !name.equals("addressbook.jar"))
    181188                        rv.add(files[i].toURI());
    182189                }
     
    192199    public void configure(WebAppContext context) throws Exception {
    193200        configureClassPath(context);
     201        // do we just need one, in the ContextHandlerCollection, or one for each?
     202        // http://stackoverflow.com/questions/17529936/issues-while-using-jetty-embedded-to-handle-jsp-jasperexception-unable-to-com
     203        // https://github.com/jetty-project/embedded-jetty-jsp/blob/master/src/main/java/org/eclipse/jetty/demo/Main.java
     204        context.getServletContext().setAttribute("org.apache.tomcat.InstanceManager", new SimpleInstanceManager());
    194205    }
    195206
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppStarter.java

    rfa6fc84 ra3e146a8  
    110110        // this does the passwords...
    111111        RouterConsoleRunner.initialize(ctx, wac);
     112        setWebAppConfiguration(wac);
     113        server.addHandler(wac);
     114        server.mapContexts();
     115        return wac;
     116    }
    112117
     118    /**
     119     *  @since Jetty 9
     120     */
     121    static void setWebAppConfiguration(WebAppContext wac) {
    113122        // see WebAppConfiguration for info
    114123        String[] classNames = wac.getConfigurationClasses();
     124        // In Jetty 9, it doesn't set the defaults if we've already added one, but the
     125        // defaults aren't set yet when we call the above. So we have to get the defaults.
     126        // Without the default configuration, the web.xml isn't read, and the webapp
     127        // won't respond to any requests, even though it appears to be running.
     128        // See WebAppContext.loadConfigurations() in source
     129        if (classNames.length == 0)
     130            classNames = wac.getDefaultConfigurationClasses();
    115131        String[] newClassNames = new String[classNames.length + 1];
    116132        for (int j = 0; j < classNames.length; j++)
     
    118134        newClassNames[classNames.length] = WebAppConfiguration.class.getName();
    119135        wac.setConfigurationClasses(newClassNames);
    120         server.addHandler(wac);
    121         server.mapContexts();
    122         return wac;
    123136    }
    124137
  • apps/routerconsole/jsp/viewstat.jsp

    rfa6fc84 ra3e146a8  
    6262        str = request.getParameter("end");
    6363        if (str != null) try { end = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
    64         boolean hideLegend = Boolean.parseBoolean((String) request.getParameter("hideLegend"));
    65         boolean hideGrid = Boolean.parseBoolean((String) request.getParameter("hideGrid"));
    66         boolean hideTitle = Boolean.parseBoolean((String) request.getParameter("hideTitle"));
    67         boolean showEvents = Boolean.parseBoolean((String) request.getParameter("showEvents"));
     64        boolean hideLegend = Boolean.parseBoolean(request.getParameter("hideLegend"));
     65        boolean hideGrid = Boolean.parseBoolean(request.getParameter("hideGrid"));
     66        boolean hideTitle = Boolean.parseBoolean(request.getParameter("hideTitle"));
     67        boolean showEvents = Boolean.parseBoolean(request.getParameter("showEvents"));
    6868        boolean showCredit = false;
    6969        if (request.getParameter("showCredit") != null)
    70           showCredit = Boolean.parseBoolean((String) request.getParameter("showCredit"));
     70          showCredit = Boolean.parseBoolean(request.getParameter("showCredit"));
    7171        if (fakeBw)
    7272            rendered = net.i2p.router.web.StatSummarizer.instance().renderRatePng(cout, width, height, hideLegend, hideGrid, hideTitle, showEvents, periodCount, end, showCredit);
  • apps/sam/java/src/net/i2p/sam/MasterSession.java

    rfa6fc84 ra3e146a8  
    390390                                        if (!ok) {
    391391                                                _log.logAlways(Log.WARN, "Accept queue overflow for " + ssess);
    392                                                 try { i2ps.close(); } catch (IOException ioe) {}
     392                                                try { i2ps.reset(); } catch (IOException ioe) {}
    393393                                        }
    394394                                } else {
  • apps/sam/java/src/net/i2p/sam/SAMStreamSession.java

    rfa6fc84 ra3e146a8  
    565565                    if (id == 0) {
    566566                        _log.error("SAM STREAM session handler not created!");
    567                         i2ps.close();
     567                        i2ps.reset();
    568568                        continue;
    569569                    }
  • apps/sam/java/src/net/i2p/sam/SAMv3StreamSession.java

    rfa6fc84 ra3e146a8  
    384384                                                                        log.error("SSL error", gse);
    385385                                                                        try {
    386                                                                                 i2ps.close();
     386                                                                                i2ps.reset();
    387387                                                                        } catch (IOException ee) {}
    388388                                                                        throw new RuntimeException("SSL error", gse);
     
    402402                                                log.warn("Error forwarding", ioe);
    403403                                        try {
    404                                                 i2ps.close();
     404                                                i2ps.reset();
    405405                                        } catch (IOException ee) {}
    406406                                        continue;
     
    434434                                        } catch (IOException ee) {}
    435435                                        try {
    436                                                 i2ps.close();
     436                                                i2ps.reset();
    437437                                        } catch (IOException ee) {}
    438438                                        continue ;
  • apps/streaming/java/src/net/i2p/client/streaming/impl/I2PSocketFull.java

    rfa6fc84 ra3e146a8  
    6868    }
    6969   
     70    /**
     71     *  Resets and closes this socket. Sends a RESET indication to the far-end.
     72     *  This is the equivalent of setSoLinger(true, 0) followed by close() on a Java Socket.
     73     *
     74     *  Nonblocking.
     75     *  Any thread currently blocked in an I/O operation upon this socket will throw an IOException.
     76     *  Once a socket has been reset, it is not available for further networking use
     77     *  (i.e. can't be reconnected or rebound). A new socket needs to be created.
     78     *  Resetting this socket will also close the socket's InputStream and OutputStream.
     79     *
     80     *  @since 0.9.30
     81     */
     82    public void reset() throws IOException {
     83        Connection c = _connection;
     84        if (c == null) return;
     85        if (log.shouldLog(Log.INFO))
     86            log.info("reset() called, connected? " + c.getIsConnected() + " : " + c, new Exception());
     87        if (c.getIsConnected()) {
     88            c.disconnect(false);
     89            // this will cause any thread waiting in Connection.packetSendChoke()
     90            // to throw an IOE
     91            c.windowAdjusted();
     92        }
     93        destroy();
     94    }
     95   
    7096    Connection getConnection() { return _connection; }
    7197   
  • apps/streaming/java/src/net/i2p/client/streaming/impl/I2PSocketManagerFull.java

    rfa6fc84 ra3e146a8  
    237237   
    238238    /**
     239     *  For a server, you must call connect() on the returned object.
     240     *  Connecting the primary session does NOT connect any subsessions.
     241     *  If the primary session is not connected, connecting a subsession will connect the primary session first.
     242     *
    239243     *  @return a new subsession, non-null
    240244     *  @param privateKeyStream null for transient, if non-null must have same encryption keys as primary session
  • apps/streaming/java/src/net/i2p/client/streaming/impl/MessageOutputStream.java

    rfa6fc84 ra3e146a8  
    3131    private long _written;
    3232    private int _writeTimeout;
    33     private ByteCache _dataCache;
     33    private final ByteCache _dataCache;
     34    private final int _originalBufferSize;
     35    private int _currentBufferSize;
    3436    private final Flusher _flusher;
    3537    private volatile long _lastBuffered;
     
    6971        super();
    7072        _dataCache = ByteCache.getInstance(128, bufSize);
     73        _originalBufferSize = bufSize;
     74        _currentBufferSize = bufSize;
    7175        _context = ctx;
    7276        _log = ctx.logManager().getLog(MessageOutputStream.class);
     
    7680        _writeTimeout = -1;
    7781        _passiveFlushDelay = passiveFlushDelay;
    78         _nextBufferSize = -1;
     82        _nextBufferSize = 0;
    7983        //_sendPeriodBeginTime = ctx.clock().now();
    8084        //_context.statManager().createRateStat("stream.sendBps", "How fast we pump data through the stream", "Stream", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
     
    9397    public int getWriteTimeout() { return _writeTimeout; }
    9498
    95     public void setBufferSize(int size) { _nextBufferSize = size; }
     99    /**
     100     *  Caller should enforce a sane minimum.
     101     *
     102     *  @param size must be greater than 0, and smaller than or equal to bufSize in constructor
     103     */
     104    public void setBufferSize(int size) {
     105        if (size <= 0 || size > _originalBufferSize)
     106            return;
     107        _nextBufferSize = size;
     108    }
    96109   
    97110    @Override
     
    116129            // code that reads from it is synchronized
    117130            synchronized (_dataLock) {
     131                // To simplify the code, and avoid losing data from shrinking the max size,
     132                // we only update max size when current buffer is empty
     133                final int maxBuffer = (_valid == 0) ? locked_updateBufferSize() : _currentBufferSize;
    118134                if (_buf == null) throw new IOException("closed (buffer went away)");
    119                 if (_valid + remaining < _buf.length) {
     135                if (_valid + remaining < maxBuffer) {
    120136                    // simply buffer the data, no flush
    121137                    System.arraycopy(b, cur, _buf, _valid, remaining);
     
    132148                    // repeating until we've pushed all of the
    133149                    // data through
    134                     int toWrite = _buf.length - _valid;
     150                    int toWrite = maxBuffer - _valid;
    135151                    System.arraycopy(b, cur, _buf, _valid, toWrite);
    136152                    remaining -= toWrite;
    137153                    cur += toWrite;
    138                     _valid = _buf.length;
     154                    _valid = maxBuffer;
    139155                    if (_log.shouldLog(Log.INFO))
    140156                        _log.info("write() direct valid = " + _valid);
     
    143159                    _valid = 0;                       
    144160                    throwAnyError();
    145                    
    146                     locked_updateBufferSize();
    147161                }
    148162            }
     
    208222     * If the other side requested we shrink our buffer, do so.
    209223     *
    210      */
    211     private final void locked_updateBufferSize() {
     224     * @return the current buffer size
     225     */
     226    private final int locked_updateBufferSize() {
    212227        int size = _nextBufferSize;
    213228        if (size > 0) {
    214229            // update the buffer size to the requested amount
    215             _dataCache.release(new ByteArray(_buf));
    216             _dataCache = ByteCache.getInstance(128, size);
    217             ByteArray ba = _dataCache.acquire();
    218             _buf = ba.getData();
    219             _nextBufferSize = -1;
    220         }
     230            // No, never do this, to avoid ByteCache churn.
     231            //_dataCache.release(new ByteArray(_buf));
     232            //_dataCache = ByteCache.getInstance(128, size);
     233            //ByteArray ba = _dataCache.acquire();
     234            //_buf = ba.getData();
     235            _currentBufferSize = size;
     236            _nextBufferSize = 0;
     237        }
     238        return _currentBufferSize;
    221239    }
    222240   
     
    274292                        _written += _valid;
    275293                        _valid = 0;
    276                         locked_updateBufferSize();
    277294                        _dataLock.notifyAll();
    278295                        sent = true;
     
    337354                _written += _valid;
    338355                _valid = 0;
    339                 locked_updateBufferSize();
    340356                _dataLock.notifyAll();
    341357            }
     
    410426                _buf = null;
    411427                _valid = 0;
    412                 locked_updateBufferSize();
    413428            }
    414429            _dataLock.notifyAll();
     
    495510            _written += _valid;
    496511            _valid = 0;
    497             locked_updateBufferSize();
    498512            _dataLock.notifyAll();
    499513        }
  • apps/susidns/src/WEB-INF/web-template.xml

    rfa6fc84 ra3e146a8  
    1414
    1515  <display-name>susidns</display-name>
     16
     17    <servlet>
     18        <servlet-name>addressbook-runner</servlet-name>
     19        <servlet-class>net.i2p.addressbook.servlet.Servlet</servlet-class>
     20        <init-param>
     21            <param-name>home</param-name>
     22            <param-value>./addressbook</param-value>
     23        </init-param>
     24        <load-on-startup>1</load-on-startup>
     25    </servlet>
     26
     27    <servlet-mapping>
     28      <servlet-name>addressbook-runner</servlet-name>
     29      <url-pattern>/addressbook-runner</url-pattern>
     30    </servlet-mapping>
     31
    1632    <!-- precompiled servlets -->
    1733
  • apps/susidns/src/build.xml

    rfa6fc84 ra3e146a8  
    1717                <pathelement location="${lib}/commons-el.jar" />
    1818                <pathelement location="${lib}/javax.servlet.jar"/>
    19                 <!-- jsp-api.jar only present for debian builds -->
     19
     20                <!-- following jars only present for debian builds -->
    2021                <pathelement location="${lib}/jsp-api.jar" />
    21                 <!-- tomcat-api.jar only present for debian builds -->
    2222                <pathelement location="${lib}/tomcat-api.jar" />
    23                 <!-- tomcat-util.jar only present for debian builds -->
    2423                <pathelement location="${lib}/tomcat-util.jar" />
     24                <pathelement location="${lib}/tomcat-util-scan.jar" />
     25                <pathelement location="${lib}/jasper-el.jar" />
     26
    2527                <pathelement location="lib/jstl.jar" />
    2628                <pathelement location="lib/standard.jar" />
    2729                <pathelement location="${lib}/jasper-runtime.jar" />
    2830                <pathelement location="${lib}/commons-logging.jar" />
    29                 <!-- jasper-el.jar only present for debian builds -->
    30                 <pathelement location="${lib}/jasper-el.jar" />
     31                <pathelement location="${lib}/jetty-util.jar" />
    3132                <pathelement location="${ant.home}/lib/ant.jar" />
    3233                <pathelement location="../../../core/java/build/i2p.jar" />
     34                <pathelement location="../../addressbook/dist/addressbook.jar" />
    3335        </path>
    3436
  • apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java

    rfa6fc84 ra3e146a8  
    315315                                        if (action.equals(_t("Delete Entry")))
    316316                                                search = null;
     317                                } else if (action.equals(_t("Add Alternate"))) {
     318                                        // button won't be in UI
     319                                        message = "Unsupported";
    317320                                }
    318321                                if( changed ) {
  • apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java

    rfa6fc84 ra3e146a8  
    232232                            (serial != null && serial.equals(lastSerial))) {
    233233                                boolean changed = false;
    234                                 if (action.equals(_t("Add")) || action.equals(_t("Replace"))) {
     234                                if (action.equals(_t("Add")) || action.equals(_t("Replace")) || action.equals(_t("Add Alternate"))) {
    235235                                        if(hostname != null && destination != null) {
    236236                                                try {
     
    244244                                                        if (oldDest != null && destination.equals(oldDest.toBase64())) {
    245245                                                                message = _t("Host name {0} is already in address book, unchanged.", displayHost);
    246                                                         } else if (oldDest != null && !action.equals(_t("Replace"))) {
     246                                                        } else if (oldDest == null && action.equals(_t("Add Alternate"))) {
     247                                                                message = _t("Host name {0} is not in  the address book.", displayHost);
     248                                                        } else if (oldDest != null && action.equals(_t("Add"))) {
    247249                                                                message = _t("Host name {0} is already in address book with a different destination. Click \"Replace\" to overwrite.", displayHost);
    248250                                                        } else {
     
    251253                                                                        if (oldDest != null) {
    252254                                                                                nsOptions.putAll(outProperties);
    253                                                                                 nsOptions.setProperty("m", Long.toString(_context.clock().now()));
     255                                                                                String now = Long.toString(_context.clock().now());
     256                                                                                if (action.equals(_t("Add Alternate")))
     257                                                                                        nsOptions.setProperty("a", now);
     258                                                                                else
     259                                                                                        nsOptions.setProperty("m", now);
    254260                                                                        }
    255261                                                                        nsOptions.setProperty("s", _t("Manually added via SusiDNS"));
    256                                                                         boolean success = getNamingService().put(host, dest, nsOptions);
     262                                                                        boolean success;
     263                                                                        if (action.equals(_t("Add Alternate"))) {
     264                                                                                // check all for dups
     265                                                                                List<Destination> all = getNamingService().lookupAll(host);
     266                                                                                if (all == null || !all.contains(dest)) {
     267                                                                                        success = getNamingService().addDestination(host, dest, nsOptions);
     268                                                                                } else {
     269                                                                                        // will get generic message below
     270                                                                                        success = false;
     271                                                                                }
     272                                                                        } else {
     273                                                                                success = getNamingService().put(host, dest, nsOptions);
     274                                                                        }
    257275                                                                        if (success) {
    258276                                                                                changed = true;
    259                                                                                 if (oldDest == null)
     277                                                                                if (oldDest == null || action.equals(_t("Add Alternate")))
    260278                                                                                        message = _t("Destination added for {0}.", displayHost);
    261279                                                                                else
     
    286304                                        String name = null;
    287305                                        int deleted = 0;
     306                                        Destination matchDest = null;
     307                                        if (action.equals(_t("Delete Entry"))) {
     308                                                // remove specified dest only in case there is more than one
     309                                                if (destination != null) {
     310                                                        try {
     311                                                                matchDest = new Destination(destination);
     312                                                        } catch (DataFormatException dfe) {}
     313                                                }
     314                                        }
    288315                                        for (String n : deletionMarks) {
    289                                                 boolean success = getNamingService().remove(n, nsOptions);
     316                                                boolean success;
     317                                                if (matchDest != null)
     318                                                        success = getNamingService().remove(n, matchDest, nsOptions);
     319                                                else
     320                                                        success = getNamingService().remove(n, nsOptions);
    290321                                                String uni = AddressBean.toUnicode(n);
    291322                                                String displayHost = uni.equals(n) ? n :  uni + " (" + n + ')';
  • apps/susidns/src/java/src/net/i2p/addressbook/servlet/Servlet.java

    rfa6fc84 ra3e146a8  
    2020 */
    2121
    22 package net.i2p.addressbook;
     22package net.i2p.addressbook.servlet;
    2323
    2424import java.io.IOException;
    2525import java.io.PrintWriter;
    26 import java.util.Random;
    2726
    2827import javax.servlet.ServletConfig;
     
    3231import javax.servlet.http.HttpServletResponse;
    3332
     33import net.i2p.I2PAppContext;
     34//import net.i2p.addressbook.DaemonThread;
     35import net.i2p.util.Log;
     36
    3437/**
    3538 * A wrapper for addressbook to allow it to be started as a web application.
    3639 *
    37  * This was a GenericServlet, we make it an HttpServlet solely to provide a hook
    38  * for SusiDNS to wake us up when the subscription list changes.
     40 * This was a GenericServlet, we make it an HttpServlet solely to provide a
     41 * simple page to display status.
    3942 *
     43 * @since 0.9.30 moved from addressbook to SusiDNS
    4044 * @author Ragnarok
    4145 *
     
    4448
    4549    private static final long serialVersionUID = 1L;
    46     private transient DaemonThread thread;
     50    private transient Thread thread;
    4751    //private String nonce;
    4852    //private static final String PROP_NONCE = "addressbook.nonce";
    4953
    5054    /**
    51      * Hack to allow susidns to kick the daemon when the subscription list changes.
    52      * URL must be /addressbook/ with wakeup param set, and nonce param set from system property.
     55     * Simple output to verify that the addressbook servlet is running.
    5356     *
    5457     * (non-Javadoc)
     
    7174     * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
    7275     */
     76    @SuppressWarnings("unchecked")
    7377    @Override
    7478    public void init(ServletConfig config) {
     
    8387        String[] args = new String[1];
    8488        args[0] = config.getInitParameter("home");
    85         this.thread = new DaemonThread(args);
    86         this.thread.setDaemon(true);
    87         this.thread.setName("Addressbook");
    88         this.thread.start();
    89         //System.out.println("INFO: Starting Addressbook " + Daemon.VERSION);
    90         //System.out.println("INFO: config root under " + args[0]);
     89        try {
     90            ClassLoader cl = getServletContext().getClassLoader();
     91            Class cls = Class.forName("net.i2p.addressbook.DaemonThread", true, cl);
     92            // We do it this way so that if we can't find addressbook,
     93            // the whole thing doesn't die.
     94            // We do add addressbook.jar in WebAppConfiguration,
     95            // so this is just in case.
     96            //Thread t = new DaemonThread(args);
     97            Thread t = (Thread) cls.getConstructor(String[].class).newInstance((Object)args);
     98            t.setDaemon(true);
     99            t.setName("Addressbook");
     100            t.start();
     101            this.thread = t;
     102            //System.out.println("INFO: Starting Addressbook " + Daemon.VERSION);
     103            //System.out.println("INFO: config root under " + args[0]);
     104        } catch (Throwable t) {
     105            // addressbook.jar may not be in the classpath
     106            I2PAppContext.getGlobalContext().logManager().getLog(Servlet.class).logAlways(Log.WARN, "Addressbook thread not started: " + t);
     107        }
    91108    }
    92109
     110    @SuppressWarnings("unchecked")
    93111    @Override
    94112    public void destroy() {
    95         this.thread.halt();
     113        if (this.thread != null) {
     114            //((DaemonThread)this.thread).halt();
     115            try {
     116                ClassLoader cl = getServletContext().getClassLoader();
     117                Class<?> cls = Class.forName("net.i2p.addressbook.DaemonThread", true, cl);
     118                Object t = cls.cast(this.thread);
     119                cls.getDeclaredMethod("halt").invoke(t);
     120            } catch (Throwable t) {}
     121        }
    96122        super.destroy();
    97123    }
  • apps/susidns/src/jsp/addressbook.jsp

    rfa6fc84 ra3e146a8  
    137137<div id="search">
    138138<form method="POST" action="addressbook">
     139<input type="hidden" name="book" value="${book.book}">
    139140<input type="hidden" name="begin" value="0">
    140141<input type="hidden" name="end" value="49">
     
    155156<c:if test="${book.notEmpty}">
    156157<form method="POST" action="addressbook">
     158<input type="hidden" name="book" value="${book.book}">
    157159<input type="hidden" name="serial" value="<%=susiNonce%>">
    158160<input type="hidden" name="begin" value="0">
     
    182184<td class="names"><span class="addrhlpr"><a href="http://${addr.b32}/" target="_blank" title="<%=intl._t("Base 32 address")%>">b32</a></span></td>
    183185<td class="helper"><a href="http://${addr.name}/?i2paddresshelper=${addr.destination}" target="_blank" title="<%=intl._t("Helper link to share host address with option to add to addressbook")%>">link</a></td>
    184 <td class="names"><span class="addrhlpr"><a href="details?h=${addr.name}" title="<%=intl._t("More information on this entry")%>"><%=intl._t("details")%></a></span></td>
     186<td class="names"><span class="addrhlpr"><a href="details?h=${addr.name}&amp;book=${book.book}" title="<%=intl._t("More information on this entry")%>"><%=intl._t("details")%></a></span></td>
    185187<td class="destinations"><div class="destaddress" name="dest_${addr.name}" width="200px">${addr.destination}</div></td>
    186188
     
    216218
    217219<form method="POST" action="addressbook">
     220<input type="hidden" name="book" value="${book.book}">
    218221<input type="hidden" name="serial" value="<%=susiNonce%>">
    219222<input type="hidden" name="begin" value="0">
     
    234237<input class="cancel" type="reset" value="<%=intl._t("Cancel")%>" >
    235238<input class="accept" type="submit" name="action" value="<%=intl._t("Replace")%>" >
     239<% if (!book.getBook().equals("published")) { %>
     240  <input class="add" type="submit" name="action" value="<%=intl._t("Add Alternate")%>" >
     241<% } %>
    236242<input class="add" type="submit" name="action" value="<%=intl._t("Add")%>" >
    237243</p>
  • apps/susidns/src/jsp/details.jsp

    rfa6fc84 ra3e146a8  
    7878            %><p>Not found: <%=detail%></p><%
    7979        } else {
     80            // use one nonce for all
     81            String nonce = book.getSerial();
    8082            for (i2p.susi.dns.AddressBean addr : addrs) {
    8183                String b32 = addr.getB32();
     
    150152<form method="POST" action="addressbook">
    151153<p class="buttons">
    152 <input type="hidden" name="serial" value="${book.serial}">
     154<input type="hidden" name="book" value="${book.book}">
     155<input type="hidden" name="serial" value="<%=nonce%>">
    153156<input type="hidden" name="begin" value="0">
    154157<input type="hidden" name="end" value="49">
    155158<input type="hidden" name="checked" value="<%=detail%>">
     159<input type="hidden" name="destination" value="<%=addr.getDestination()%>">
    156160<input class="delete" type="submit" name="action" value="<%=intl._t("Delete Entry")%>" >
    157161</p>
  • build.properties

    rfa6fc84 ra3e146a8  
    1515# perhaps not, as they move 7 and 8 to unsupported status.
    1616#jettydocs.url=http://download.eclipse.org/jetty/stable-8/apidocs/
    17 jettydocs.url=http://download.eclipse.org/jetty/8.1.17.v20150415/apidocs/
     17jettydocs.url=http://download.eclipse.org/jetty/9.2.21.v20170120/apidocs/
    1818wrapperdocs.url=http://wrapper.tanukisoftware.com/jdoc/
    1919# these are only for unit test javadocs
     
    132132# Don't include geoip files, we will use geoip-database package
    133133#with-geoip-database=true
    134 # Don't include jetty files, we will use libjetty8-java package
    135 #with-libjetty8-java=true
    136 # Don't include tomcat files, we will use libtomcat6-java package
    137 #with-libtomcat6-java=true
    138 # Don't include tomcat files, we will use libtomcat7-java package
    139 #with-libtomcat7-java=true
     134# Don't include jetty files, we will use libjetty9-java package. Requires with-libtomcat8-java=true.
     135#with-libjetty9-java=true
    140136# Don't include tomcat files, we will use libtomcat8-java package
    141137#with-libtomcat8-java=true
  • build.xml

    rfa6fc84 ra3e146a8  
    7171            <echo message=" " />
    7272            <echo message="sudo apt-get install debhelper ant debconf default-jdk gettext libgmp-dev po-debconf fakeroot \" />
    73             <echo message="  build-essential quilt libcommons-logging-java dh-apparmor dh-systemd libservice-wrapper-java \"  />
    74             <echo message="  devscripts libjetty8-java glassfish-javaee"  />
     73            <echo message="  build-essential quilt dh-apparmor dh-systemd libservice-wrapper-java \"  />
     74            <echo message="  devscripts libjetty9-java libtomcat8-java glassfish-javaee libgetopt-java"  />
    7575            <echo message=" " />
    7676            <echo message="The following command will install the additional runtime dependencies:" />
     
    311311    </target>
    312312
    313     <target name="buildSusiDNS" depends="buildCore, buildJetty, buildImagegen" >
     313    <target name="buildSusiDNS" depends="buildCore, buildJetty, buildImagegen, buildAddressbook" >
    314314        <ant dir="apps/susidns/src" target="all" />
    315315        <copy file="apps/susidns/src/susidns.war" todir="build/" />
     
    333333    </target>
    334334
    335     <target name="buildAddressbook" depends="buildCore, buildJetty" >
    336         <ant dir="apps/addressbook/" target="war" />
     335    <target name="buildAddressbook" depends="buildCore" >
     336        <ant dir="apps/addressbook/" target="all" />
     337        <copy file="apps/addressbook/dist/addressbook.jar" todir="build/" />
     338        <!-- war is empty, only for updates -->
    337339        <copy file="apps/addressbook/dist/addressbook.war" todir="build/" />
    338340    </target>
     
    735737            <group title="SAM Bridge" packages="net.i2p.sam" />
    736738            <group title="SAM Demos" packages="net.i2p.sam.client" />
    737             <group title="SusiDNS Application" packages="i2p.susi.dns" />
     739            <group title="SusiDNS Application" packages="i2p.susi.dns:net.i2p.addressbook.servlet" />
    738740            <group title="SusiMail Application" packages="i2p.susi.webmail:i2p.susi.webmail.*:i2p.susi.debug:i2p.susi.util" />
    739741            <group title="Systray Application" packages="net.i2p.apps.systray" />
     
    765767            <classpath>
    766768                <pathelement location="apps/jetty/jettylib/org.mortbay.jetty.jar" />
     769                <pathelement location="apps/jetty/jettylib/jasper-runtime.jar" />
    767770                <pathelement location="apps/jetty/jettylib/javax.servlet.jar" />
    768771                <pathelement location="apps/jetty/jettylib/jetty-http.jar" />
     
    12051208        <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
    12061209        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
    1207         <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
     1210        <copy file="build/addressbook.jar" todir="pkg-temp/lib/" />
    12081211        <copy file="build/susimail.war" todir="pkg-temp/webapps/" />
    12091212        <copy file="build/susidns.war" todir="pkg-temp/webapps/" />
     
    12431246    </target>
    12441247
    1245     <target name="copyjetty-unlesspkg" unless="${with-libjetty8-java}" >
     1248    <target name="copyjetty-unlesspkg" unless="${with-libjetty9-java}" >
    12461249        <copy todir="pkg-temp/lib" >
    12471250            <fileset dir="build" includes="javax.servlet.jar jetty*.jar org.mortbay.*.jar" excludes="jetty-i2p.jar" />
     
    12901293
    12911294    <target name="preplicenses-unlesspkg" depends="settomcatprop" unless="${with-libtomcat-java}" >
     1295<!--  replacement?
    12921296        <copy file="apps/jetty/apache-tomcat-deployer/NOTICE" tofile="pkg-temp/licenses/NOTICE-Tomcat.txt" />
     1297-->
    12931298    </target>
    12941299
     
    14631468        <exec executable="sh" osfamily="unix" failonerror="true">
    14641469            <arg value="-c" />
    1465             <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar -o $i = pkg-temp/lib/jetty-java5-threadpool.jar -o $i = pkg-temp/lib/jetty-sslengine.jar ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
     1470            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/commons-logging.jar -o $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar -o $i = pkg-temp/lib/jetty-java5-threadpool.jar -o $i = pkg-temp/lib/jetty-sslengine.jar -o $i = pkg-temp/webapps/addressbook.war ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
    14661471        </exec>
    14671472        <exec executable="sh" osfamily="mac" failonerror="true">
    14681473            <arg value="-c" />
    1469             <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar -o $i = pkg-temp/lib/jetty-java5-threadpool.jar -o $i = pkg-temp/lib/jetty-sslengine.jar ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
     1474            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/commons-logging.jar -o $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar -o $i = pkg-temp/lib/jetty-java5-threadpool.jar -o $i = pkg-temp/lib/jetty-sslengine.jar -o $i = pkg-temp/webapps/addressbook.war ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
    14701475        </exec>
    14711476        <!-- windoz here : i admit, i hate escaped symbols in xml, indeed = =! -->
     
    15491554        <copy file="build/i2ptunnel.war" todir="pkg-temp/webapps/" />
    15501555        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
     1556        <copy file="build/addressbook.jar" todir="pkg-temp/lib/" />
    15511557        <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
    15521558        <!-- decapitalized the file in 0.7.8 -->
     
    15961602              can't overwrite an existing eepsite dir in a non-split configuration.
    15971603          -->
    1598         <copy todir="pkg-temp/eepsite-jetty7" >
     1604        <copy todir="pkg-temp/eepsite-jetty9" >
    15991605            <fileset dir="installer/resources/eepsite" includes="*.xml contexts/* etc/*" />
    16001606        </copy>
     
    16021608
    16031609    <target name="delete-j6-update">
    1604         <delete dir="pkg-temp/eepsite-jetty7" />
     1610        <delete dir="pkg-temp/eepsite-jetty9" />
    16051611    </target>
    16061612
     
    18961902            <arg value="build/BOB.jar"/>
    18971903            <arg value="build/addressbook.jar"/>
    1898             <arg value="build/addressbook.war"/>
    18991904            <arg value="build/i2p.jar"/>
    19001905            <arg value="build/i2psnark.jar"/>
     
    22052210            <arg value="../i2p-${Extended.Version}" />
    22062211        </exec>
    2207         <delete includeemptydirs="true" quiet="false">
     2212        <delete includeemptydirs="true" quiet="false" failonerror="false">
    22082213            <fileset dir="../i2p-${Extended.Version}/debian-alt/" />
    22092214            <fileset dir="../i2p-${Extended.Version}/installer/lib/" />
     
    22212226            <file name="../i2p-${Extended.Version}/installer/resources/geoip.txt" />
    22222227            <file name="../i2p-${Extended.Version}/installer/resources/geoipv6.dat.gz" />
    2223             <!-- libjetty8-java -->
    2224             <fileset dir="../i2p-${Extended.Version}/apps/jetty/jetty-distribution-8.1.21.v20160908" />
     2228            <!-- libjetty9-java -->
     2229            <fileset dir="../i2p-${Extended.Version}/apps/jetty/jetty-distribution-9.2.21.v20170120" />
    22252230            <!-- libjstl1.1-java or glassfish-javaee -->
    22262231          <!--
     
    22292234            <!-- libjakarta-taglibs-standard-java or glassfish-javaee -->
    22302235            <file name="../i2p-${Extended.Version}/apps/susidns/src/lib/standard.jar" />
    2231             <!-- libtomcat6-java or libtomcat7-java -->
    2232           <!--
    2233             <fileset dir="../i2p-${Extended.Version}/apps/jetty/apache-tomcat" />
    2234             <fileset dir="../i2p-${Extended.Version}/apps/jetty/apache-tomcat-deployer/" />
    2235            -->
    22362236            <!-- anything added above, add in debian-release-tarball also -->
    22372237        </delete>
     
    22492249           -->
    22502250                <exclude name="apps/susidns/src/lib/standard.jar" />
    2251           <!--
    2252                 <exclude name="apps/jetty/apache-tomcat/**"/>
    2253                 <exclude name="apps/jetty/apache-tomcat-deployer/**"/>
    2254            -->
    22552251                <!-- anything added above, add in debian-release-tarball also -->
    22562252            </tarfileset>
     
    22872283            <arg value="../i2p-${Extended.Version}" />
    22882284        </exec>
    2289         <delete includeemptydirs="true" quiet="false">
     2285        <delete includeemptydirs="true" quiet="false" failonerror="false">
    22902286            <fileset dir="../i2p-${Extended.Version}/debian-alt/" />
    22912287            <fileset dir="../i2p-${Extended.Version}/installer/lib/" />
     
    23032299            <file name="../i2p-${Extended.Version}/installer/resources/geoip.txt" />
    23042300            <file name="../i2p-${Extended.Version}/installer/resources/geoipv6.dat.gz" />
    2305             <!-- libjetty8-java -->
     2301            <!-- libjetty9-java -->
    23062302          <!--
    2307             <fileset dir="../i2p-${Extended.Version}/apps/jetty/jetty-distribution-8.1.21.v20160908" />
     2303            <fileset dir="../i2p-${Extended.Version}/apps/jetty/jetty-distribution-9.2.21.v20170120" />
    23082304           -->
    23092305            <!-- libjstl1.1-java or glassfish-javaee -->
     
    23132309            <!-- libjakarta-taglibs-standard-java or glassfish-javaee -->
    23142310            <file name="../i2p-${Extended.Version}/apps/susidns/src/lib/standard.jar" />
    2315             <!-- libtomcat6-java or libtomcat7-java -->
    2316           <!--
    2317             <fileset dir="../i2p-${Extended.Version}/apps/jetty/apache-tomcat" />
    2318             <fileset dir="../i2p-${Extended.Version}/apps/jetty/apache-tomcat-deployer/" />
    2319            -->
    23202311            <!-- anything added above, add in debian-release-tarball also -->
    23212312        </delete>
     
    23352326           -->
    23362327                <exclude name="apps/susidns/src/lib/standard.jar" />
    2337           <!--
    2338                 <exclude name="apps/jetty/apache-tomcat/**"/>
    2339                 <exclude name="apps/jetty/apache-tomcat-deployer/**"/>
    2340            -->
    23412328                <!-- anything added above, add in debian-release-tarball also -->
    23422329            </tarfileset>
     
    23702357            <arg value="../i2p-${Extended.Version}" />
    23712358        </exec>
    2372         <delete includeemptydirs="true" quiet="false">
     2359        <delete includeemptydirs="true" quiet="false" failonerror="false">ilonerror="false">
    23732360            <fileset dir="../i2p-${Extended.Version}/debian-alt/" />
    23742361            <fileset dir="../i2p-${Extended.Version}/installer/lib/" />
     
    23822369            <file name="../i2p-${Extended.Version}/installer/resources/geoip.txt" />
    23832370            <file name="../i2p-${Extended.Version}/installer/resources/geoipv6.dat.gz" />
    2384             <fileset dir="../i2p-${Extended.Version}/apps/jetty/jetty-distribution-8.1.21.v20160908" />
     2371            <fileset dir="../i2p-${Extended.Version}/apps/jetty/jetty-distribution-9.2.21.v20170120" />
    23852372          <!--
    23862373            <file name="../i2p-${Extended.Version}/apps/susidns/src/lib/jstl.jar" />
    23872374           -->
    23882375            <file name="../i2p-${Extended.Version}/apps/susidns/src/lib/standard.jar" />
    2389           <!--
    2390             <fileset dir="../i2p-${Extended.Version}/apps/jetty/apache-tomcat" />
    2391             <fileset dir="../i2p-${Extended.Version}/apps/jetty/apache-tomcat-deployer/" />
    2392            -->
    23932376            <!-- anything added above, add in debian-tarball also -->
    23942377        </delete>
     
    24062389           -->
    24072390                <exclude name="apps/susidns/src/lib/standard.jar" />
    2408           <!--
    2409                 <exclude name="apps/jetty/apache-tomcat/**"/>
    2410                 <exclude name="apps/jetty/apache-tomcat-deployer/**"/>
    2411            -->
    24122391                <!-- anything added above, add in debian-tarball also -->
    24132392            </tarfileset>
  • core/java/src/freenet/support/CPUInformation/AMDInfoImpl.java

    rfa6fc84 ra3e146a8  
    454454          }
    455455          break;
     456
     457        //Ryzen 7 (model 1), Ryzen 5 TBD
     458        // untested
     459          case 23: {
     460            // Quote wikipedia:
     461            // Zen is a clean sheet design that differs from the long-standing Bulldozer architecture.
     462            // All models support: x87, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AES, CLMUL,
     463            // AVX, AVX2, FMA, CVT16/F16C, ABM, BMI1, BMI2, SHA.
     464            isK6Compatible = true;
     465            isK6_2_Compatible = true;
     466            isK6_3_Compatible = true;
     467            isAthlonCompatible = true;
     468            isAthlon64Compatible = true;
     469            // Pending testing of the bulldozer jbigi
     470            //isPiledriverCompatible = true;
     471            //isSteamrollerCompatible = true;
     472            //isExcavatorCompatible = true;
     473            //isBulldozerCompatible = true;
     474            if (model == 1)
     475               modelString = "Ryzen 7";
     476            else
     477               modelString = "Ryzen model " + model;
     478          }
     479          break;
    456480        }
    457481        return modelString;
  • core/java/src/freenet/support/CPUInformation/CPUID.java

    rfa6fc84 ra3e146a8  
    5252                                    I2PAppContext.getGlobalContext().isRouterContext();
    5353
    54     private static final boolean isX86 = System.getProperty("os.arch").contains("86") ||
    55                                          System.getProperty("os.arch").equals("amd64");
     54    private static final boolean isX86 = SystemVersion.isX86();
    5655    private static final boolean isWindows = SystemVersion.isWindows();
    57     private static final String libPrefix = isWindows ? "" : "lib";
    58     private static final String libSuffix = isWindows ? ".dll" : ".so";
    5956    private static final boolean isLinux = System.getProperty("os.name").toLowerCase(Locale.US).contains("linux");
    6057    private static final boolean isKFreebsd = System.getProperty("os.name").toLowerCase(Locale.US).contains("kfreebsd");
     
    305302    public static CPUInfo getInfo() throws UnknownCPUException
    306303    {
    307         if(!_nativeOk)
    308             throw new UnknownCPUException("Failed to read CPU information from the system. Please verify the existence of the jcpuid dll/so.");
     304        if(!_nativeOk) {
     305            throw new UnknownCPUException("Failed to read CPU information from the system. Please verify the existence of the " +
     306                                          getLibraryPrefix() + "jcpuid " + getLibrarySuffix() + " file.");
     307        }
    309308        String id = getCPUVendorID();
    310309        if(id.equals("CentaurHauls"))
    311310            return new VIAInfoImpl();
    312311        if(!isX86)
    313             throw new UnknownCPUException("Failed to read CPU information from the system. The CPUID instruction exists on x86 CPU's only");
     312            throw new UnknownCPUException("Failed to read CPU information from the system. The CPUID instruction exists on x86 CPUs only.");
    314313        if(id.equals("AuthenticAMD"))
    315314            return new AMDInfoImpl();
     
    322321    public static void main(String args[])
    323322    {
    324         _doLog = true;
    325         if(!_nativeOk){
    326             System.out.println("**Failed to retrieve CPUInfo. Please verify the existence of jcpuid dll/so**");
     323        _doLog = true; // this is too late to log anything from above
     324        String path = System.getProperty("java.library.path");
     325        String name = getLibraryPrefix() + "jcpuid" + getLibrarySuffix();
     326        System.out.println("Native library search path: " + path);
     327        if (_nativeOk) {
     328            String sep = System.getProperty("path.separator");
     329            String[] paths = DataHelper.split(path, sep);
     330            for (String p : paths) {
     331                File f = new File(p, name);
     332                if (f.exists()) {
     333                    System.out.println("Found native library: " + f);
     334                    break;
     335                }
     336            }
     337        } else {
     338            System.out.println("Failed to retrieve CPUInfo. Please verify the existence of the " +
     339                               name + " file in the library path, or set -Djava.library.path=. in the command line");
    327340        }
    328341        System.out.println("JCPUID Version: " + _jcpuidVersion);
     
    499512     */
    500513    private static final boolean loadFromResource() {
     514        // Mac info:
     515        // Through 0.9.25, we had a libjcpuid-x86_64-osx.jnilib and a libjcpuid-x86-osx.jnilib file.
     516        // As of 0.9.26, we have a single libjcpuid-x86_64-osx.jnilib fat binary that has both 64- and 32-bit support.
     517        // For updates, the 0.9.27 update contained the new jbigi.jar.
     518        // However, in rare cases, a user may have skipped that update, going straight
     519        // from 0.9.26 to 0.9.28. Since we can't be sure, always try both for Mac.
     520        // getResourceName64() returns non-null for 64-bit OR for 32-bit Mac.
     521
    501522        // try 64 bit first, if getResourceName64() returns non-null
    502523        String resourceName = getResourceName64();
     
    505526            if (success)
    506527                return true;
     528            if (_doLog)
     529                System.err.println("WARNING: Resource name [" + resourceName + "] was not found");
    507530        }
    508531
     
    512535        if (success)
    513536            return true;
    514 
    515537        if (_doLog)
    516538            System.err.println("WARNING: Resource name [" + resourceName + "] was not found");
     
    532554        File outFile = null;
    533555        FileOutputStream fos = null;
    534         String filename = libPrefix + "jcpuid" + libSuffix;
     556        String filename = getLibraryPrefix() + "jcpuid" + getLibrarySuffix();
    535557        try {
    536558            InputStream libStream = resource.openStream();
     
    572594    private static final String getResourceName()
    573595    {
    574         return getLibraryPrefix()+getLibraryMiddlePart()+"."+getLibrarySuffix();
    575     }
    576 
    577     /**
    578      * @return null if not on a 64 bit platform
     596        return getLibraryPrefix() + getLibraryMiddlePart() + getLibrarySuffix();
     597    }
     598
     599    /**
     600     * @return null if not on a 64 bit platform (except Mac)
    579601     * @since 0.8.7
    580602     */
    581603    private static final String getResourceName64() {
    582         if (!is64)
     604        // As of GMP 6,
     605        // libjcpuid-x86_64-osx.jnilib file is a fat binary that contains both 64- and 32-bit binaries
     606        // See loadFromResource() for more info.
     607        if (!is64 && !isMac)
    583608            return null;
    584         return getLibraryPrefix() + get64LibraryMiddlePart() + "." + getLibrarySuffix();
     609        return getLibraryPrefix() + get64LibraryMiddlePart() + getLibrarySuffix();
    585610    }
    586611
     
    598623        if(isMac) {
    599624            if(isX86) {
    600                 return "jcpuid-x86-osx";  // The convention on Intel Macs
     625                // As of GMP6,
     626                // our libjcpuid-x86_64.osx.jnilib is a fat binary,
     627                // with the 32-bit lib in it also.
     628                // Not sure if that was on purpose...
     629                return "jcpuid-x86_64-osx";  // The convention on Intel Macs
    601630            }
     631            // this will fail, we don't have any ppc libs, but we can't return null here.
     632            return "jcpuid-ppc-osx";
    602633        }
    603634        if(isKFreebsd)
     
    632663                return "jcpuid-x86_64-osx";
    633664            }
     665            // this will fail, we don't have any ppc libs, but we can't return null here.
     666            return "jcpuid-ppc_64-osx";
    634667        }
    635668        if(isSunos)
     
    642675    {
    643676        if(isWindows)
    644             return "dll";
     677            return ".dll";
    645678        if(isMac)
    646             return "jnilib";
     679            return ".jnilib";
    647680        else
    648             return "so";
     681            return ".so";
    649682    }
    650683}
  • core/java/src/net/i2p/I2PAppContext.java

    rfa6fc84 ra3e146a8  
    99
    1010import net.i2p.app.ClientAppManager;
     11import net.i2p.app.ClientAppManagerImpl;
    1112import net.i2p.client.naming.NamingService;
    1213import net.i2p.crypto.AESEngine;
     
    117118    private volatile File _tmpDir;
    118119    private final Random _tmpDirRand = new Random();
     120    private final ClientAppManager _appManager;
    119121    // split up big lock on this to avoid deadlocks
    120122    private final Object _lock1 = new Object(), _lock2 = new Object(), _lock3 = new Object(), _lock4 = new Object(),
     
    199201        _shutdownTasks = new ConcurrentHashSet<Runnable>(32);
    200202        _portMapper = new PortMapper(this);
     203        _appManager = isRouterContext() ? null : new ClientAppManagerImpl(this);
    201204   
    202205   /*
     
    10081011
    10091012    /**
    1010      *  The RouterAppManager in RouterContext, null always in I2PAppContext
    1011      *  @return null always
     1013     *  As of 0.9.30, returns non-null in I2PAppContext, null in RouterContext.
     1014     *  Prior to that, returned null always.
     1015     *  Overridden in RouterContext to return the RouterAppManager.
     1016     *
     1017     *  @return As of 0.9.30, returns non-null in I2PAppContext, null in RouterContext
    10121018     *  @since 0.9.11, in RouterContext since 0.9.4
    10131019     */
    10141020    public ClientAppManager clientAppManager() {
    1015         return null;
     1021        return _appManager;
    10161022    }
    10171023}
  • core/java/src/net/i2p/client/I2PSession.java

    rfa6fc84 ra3e146a8  
    273273
    274274    /**
    275      * Actually connect the session and start receiving/sending messages
    276      *
     275     * Actually connect the session and start receiving/sending messages.
     276     * Connecting a primary session will not automatically connect subsessions.
     277     * Connecting a subsession will automatically connect the primary session
     278     * if not previously connected.
    277279     */
    278280    public void connect() throws I2PSessionException;
  • core/java/src/net/i2p/client/impl/I2PSessionImpl.java

    rfa6fc84 ra3e146a8  
    548548     * Disconnect / destroy from another thread may be called simultaneously and
    549549     * will (should?) interrupt the connect.
     550     *
     551     * Connecting a primary session will not automatically connect subsessions.
     552     * Connecting a subsession will automatically connect the primary session
     553     * if not previously connected.
    550554     *
    551555     * @throws I2PSessionException if there is a configuration error or the router is
  • core/java/src/net/i2p/client/impl/SubSession.java

    rfa6fc84 ra3e146a8  
    9393     * Disconnect / destroy from another thread may be called simultaneously and
    9494     * will (should?) interrupt the connect.
     95     *
     96     * Connecting a subsession will automatically connect the primary session
     97     * if not previously connected.
    9598     *
    9699     * @throws I2PSessionException if there is a configuration error or the router is
  • core/java/src/net/i2p/client/naming/BlockfileNamingService.java

    rfa6fc84 ra3e146a8  
    1616import java.io.InputStreamReader;
    1717import java.io.IOException;
     18import java.io.Writer;
    1819import java.util.ArrayList;
    1920import java.util.Collections;
     
    419420            // support multiple destinations per hostname
    420421            if (VersionComparator.comp(_version, "4") < 0) {
    421                 // Upgrade of 4K entry DB on RPi 2 is over 2 1/2 minutes, disable for now
    422                 if (SystemVersion.isAndroid() || SystemVersion.isARM()) {
     422                // Upgrade of 4K entry DB on RPi 2 is over 2 1/2 minutes, probably worse on Android, disable for now
     423                if (SystemVersion.isAndroid()) {
    423424                    if (_log.shouldWarn())
    424                         _log.warn("Deferring upgrade to version 4 on Android/ARM");
     425                        _log.warn("Deferring upgrade to version 4 on Android");
    425426                    return true;
    426427                }
     
    12861287                _log.error("DB lookup error", re);
    12871288                return Collections.emptyMap();
     1289            } finally {
     1290                deleteInvalid();
     1291            }
     1292        }
     1293    }
     1294
     1295    /**
     1296     *  Export in a hosts.txt format.
     1297     *  Output is sorted.
     1298     *  Caller must close writer.
     1299     *
     1300     *  @param options If non-null and contains the key "list", get
     1301     *                from that list (default "hosts.txt", NOT all lists)
     1302     *                Key "search": return only those matching substring
     1303     *                Key "startsWith": return only those starting with
     1304     *                                  ("[0-9]" allowed)
     1305     *                Key "beginWith": start here in the iteration
     1306     *  @since 0.9.30 override NamingService to add stored authentication strings
     1307     */
     1308    @Override
     1309    public void export(Writer out, Properties options) throws IOException {
     1310        String listname = FALLBACK_LIST;
     1311        String search = null;
     1312        String startsWith = null;
     1313        String beginWith = null;
     1314        if (options != null) {
     1315            String ln = options.getProperty("list");
     1316            if (ln != null)
     1317                listname = ln;
     1318            search = options.getProperty("search");
     1319            startsWith = options.getProperty("startsWith");
     1320            beginWith = options.getProperty("beginWith");
     1321            if (beginWith == null && startsWith != null) {
     1322                if (startsWith.equals("[0-9]"))
     1323                    beginWith = "0";
     1324                else
     1325                    beginWith = startsWith;
     1326            }
     1327        }
     1328        out.write("# Address book: ");
     1329        out.write(getName());
     1330        out.write(" (" + listname + ')');
     1331        final String nl = System.getProperty("line.separator", "\n");
     1332        out.write(nl);
     1333        out.write("# Exported: ");
     1334        out.write((new Date()).toString());
     1335        out.write(nl);
     1336        synchronized(_bf) {
     1337            if (_isClosed)
     1338                return;
     1339            try {
     1340                SkipList<String, DestEntry> sl = _bf.getIndex(listname, _stringSerializer, _destSerializer);
     1341                if (sl == null) {
     1342                    if (_log.shouldLog(Log.WARN))
     1343                        _log.warn("No skiplist found for lookup in " + listname);
     1344                    return;
     1345                }
     1346                if (beginWith == null && search == null) {
     1347                    int sz = sl.size();
     1348                    if (sz <= 0) {
     1349                        out.write("# No entries");
     1350                        out.write(nl);
     1351                        return;
     1352                    }
     1353                    if (sz > 1) {
     1354                        // actually not right due to multidest
     1355                        out.write("# " + sz + " entries");
     1356                        out.write(nl);
     1357                    }
     1358                }
     1359                SkipIterator<String, DestEntry> iter;
     1360                if (beginWith != null)
     1361                    iter = sl.find(beginWith);
     1362                else
     1363                    iter = sl.iterator();
     1364                int cnt = 0;
     1365                while (iter.hasNext()) {
     1366                    String key = iter.nextKey();
     1367                    if (startsWith != null) {
     1368                        if (startsWith.equals("[0-9]")) {
     1369                            if (key.charAt(0) > '9')
     1370                                break;
     1371                        } else if (!key.startsWith(startsWith)) {
     1372                            break;
     1373                        }
     1374                    }
     1375                    DestEntry de = iter.next();
     1376                    if (!validate(key, de, listname))
     1377                        continue;
     1378                    if (search != null && key.indexOf(search) < 0)
     1379                        continue;
     1380                    int dsz = de.destList != null ? de.destList.size() : 1;
     1381                    // new non-DSA dest is put first, so put in reverse
     1382                    // order so importers will see the older dest first
     1383                    for (int i = dsz - 1; i >= 0; i--) {
     1384                        Properties p;
     1385                        Destination d;
     1386                        if (i == 0) {
     1387                            p = de.props;
     1388                            d = de.dest;
     1389                        } else {
     1390                            p = de.propsList.get(i);
     1391                            d = de.destList.get(i);
     1392                        }
     1393                        out.write(key);
     1394                        out.write('=');
     1395                        out.write(d.toBase64());
     1396                        if (p != null)
     1397                            SingleFileNamingService.writeOptions(p, out);
     1398                        out.write(nl);
     1399                        cnt++;
     1400                    }
     1401                }
     1402                if (beginWith != null || search != null) {
     1403                    if (cnt <= 0) {
     1404                        out.write("# No entries");
     1405                        out.write(nl);
     1406                        return;
     1407                    }
     1408                    if (cnt > 1) {
     1409                        out.write("# " + cnt + " entries");
     1410                        out.write(nl);
     1411                    }
     1412                }
     1413            } catch (RuntimeException re) {
     1414                throw new IOException("DB lookup error", re);
    12881415            } finally {
    12891416                deleteInvalid();
     
    15791706                    storedOptions.remove(i);
    15801707                    removeReverseEntry(hostname, d);
     1708                    if (options != null) {
     1709                        String list = options.getProperty("list");
     1710                        if (list != null)
     1711                            storedOptions.get(0).setProperty("list", list);
     1712                    }
    15811713                    return put(hostname, newDests, storedOptions, false);
    15821714                }
  • core/java/src/net/i2p/client/naming/SingleFileNamingService.java

    rfa6fc84 ra3e146a8  
    269269     *
    270270     *  @param options non-null
    271      *  @since 0.9.26
    272      */
    273     private static void writeOptions(Properties options, Writer out) throws IOException {
     271     *  @since 0.9.26, package private since 0.9.30
     272     */
     273    static void writeOptions(Properties options, Writer out) throws IOException {
    274274        boolean started = false;
    275275        for (Map.Entry<Object, Object> e : options.entrySet()) {
  • core/java/src/net/i2p/crypto/KeyGenerator.java

    rfa6fc84 ra3e146a8  
    117117    /** @since 0.9.8 */
    118118    private static final boolean DEFAULT_USE_LONG_EXPONENT =
    119                                                    NativeBigInteger.isNative() &&
    120                                                    SystemVersion.is64Bit() &&
    121                                                    !SystemVersion.isGNU() &&
    122                                                    !SystemVersion.isApache() &&
    123                                                    !SystemVersion.isARM();
     119                                                   !SystemVersion.isSlow();
    124120
    125121    /**
  • core/java/src/net/i2p/crypto/KeyStoreUtil.java

    rfa6fc84 ra3e146a8  
    423423            String s = "Rejecting expired X509 Certificate: " + file.getAbsolutePath();
    424424            // Android often has old system certs
    425             if (SystemVersion.isAndroid())
     425            // our SSL certs may be old also
     426            //if (SystemVersion.isAndroid())
    426427                warn(s, cee);
    427             else
    428                 error(s, cee);
     428            //else
     429            //    error(s, cee);
    429430            return false;
    430431        } catch (CertificateNotYetValidException cnyve) {
  • core/java/src/net/i2p/crypto/TrustedUpdate.java

    rfa6fc84 ra3e146a8  
    2424import net.i2p.util.SecureFileOutputStream;
    2525import net.i2p.util.VersionComparator;
    26 import net.i2p.util.ZipFileComment;
     26//import net.i2p.util.ZipFileComment;
    2727
    2828/**
     
    612612     * @since 0.8.8
    613613     */
     614    @SuppressWarnings("deprecation")
    614615    private boolean verifyVersionMatch(File signedFile) {
    615616        try {
    616              String zipComment = ZipFileComment.getComment(signedFile, VERSION_BYTES, HEADER_BYTES);
     617             String zipComment = net.i2p.util.ZipFileComment.getComment(signedFile, VERSION_BYTES, HEADER_BYTES);
    617618             return zipComment.equals(_newVersion);
    618619        } catch (IOException ioe) {}
  • core/java/src/net/i2p/data/DataHelper.java

    rfa6fc84 ra3e146a8  
    4747import net.i2p.util.ReusableGZIPOutputStream;
    4848import net.i2p.util.SecureFileOutputStream;
     49import net.i2p.util.SystemVersion;
    4950import net.i2p.util.Translate;
    5051
     
    5556 */
    5657public class DataHelper {
     58
     59    /** See storeProps(). 600-750 ms on RPi. */
     60    private static final boolean SHOULD_SYNC = !(SystemVersion.isAndroid() || SystemVersion.isARM());
    5761
    5862    /**
     
    6973            // SSU RouterAddress options
    7074            "key", "mtu",
    71             "ihost0", "iport0", "ikey0", "itag0",
    72             "ihost1", "iport1", "ikey1", "itag1",
    73             "ihost2", "iport2", "ikey2", "itag2",
     75            "ihost0", "iport0", "ikey0", "itag0", "iexp0",
     76            "ihost1", "iport1", "ikey1", "itag1", "iexp1",
     77            "ihost2", "iport2", "ikey2", "itag2", "iexp2",
    7478            // RouterInfo options
    7579            "caps", "coreVersion", "netId", "router.version",
     
    515519                out.println(name + "=" + val);
    516520            }
    517             out.flush();
    518             fos.getFD().sync();
     521            if (SHOULD_SYNC) {
     522                out.flush();
     523                fos.getFD().sync();
     524            }
    519525            out.close();
    520526            if (out.checkError()) {
  • core/java/src/net/i2p/time/BuildTime.java

    rfa6fc84 ra3e146a8  
    3535    private static final long YEARS_25 = 25L*365*24*60*60*1000;
    3636    /** update this periodically */
    37     private static final String EARLIEST = "2016-02-19 12:00:00 UTC";
     37    private static final String EARLIEST = "2017-03-27 12:00:00 UTC";
     38    // fallback if parse fails ticket #1976
     39    // date -d 201x-xx-xx +%s
     40    private static final long EARLIEST_LONG = 1490587200 * 1000L;
    3841
    3942    static {
     
    4649            Date date = fmt.parse(EARLIEST);
    4750            if (date == null)
    48                 throw new RuntimeException("BuildTime FAIL");
    49             min = date.getTime();
     51                min = EARLIEST_LONG;
     52            else
     53                min = date.getTime();
    5054        } catch (ParseException pe) {
    5155            System.out.println("BuildTime FAIL");
    52             pe.printStackTrace();
    53             throw new RuntimeException("BuildTime FAIL", pe);
     56            // Old Android, ticket #1976
     57            //pe.printStackTrace();
     58            //throw new RuntimeException("BuildTime FAIL", pe);
     59            min = EARLIEST_LONG;
    5460        }
    5561        long max = min + YEARS_25;
  • core/java/src/net/i2p/util/ByteCache.java

    rfa6fc84 ra3e146a8  
    8888            cache = new ByteCache(cacheSize, size);
    8989            _caches.put(sz, cache);
    90 ;       }
     90        }
    9191        cache.resize(cacheSize);
    9292        //I2PAppContext.getGlobalContext().logManager().getLog(ByteCache.class).error("ByteCache size: " + size + " max: " + cacheSize, new Exception("from"));
  • core/java/src/net/i2p/util/FortunaRandomSource.java

    rfa6fc84 ra3e146a8  
    109109        // get at least 4 extra bits if possible for better
    110110        // distribution after the %
     111        // No extra needed if power of two.
    111112        int numBits;
    112         if (n > 0xfffff)
     113        if (n > 0x100000)
    113114            numBits = 31;
    114         else if (n > 0xfff)
     115        else if (n > 0x1000)
    115116            numBits = 24;
    116         else if (n > 0xf)
     117        else if (n > 0x10)
    117118            numBits = 16;
    118119        else
  • core/java/src/net/i2p/util/NativeBigInteger.java

    rfa6fc84 ra3e146a8  
    210210     * outweigh the implementation time.
    211211     */
     212
     213    // none -> {"none"), since 0.9.30
     214    private final static String[] JBIGI_COMPAT_LIST_NONE          = {JBIGI_OPTIMIZATION_X86};
    212215    private final static String[] JBIGI_COMPAT_LIST_PPC           = {JBIGI_OPTIMIZATION_PPC};
    213216    private final static String[] JBIGI_COMPAT_LIST_ARM           = {JBIGI_OPTIMIZATION_ARM_CORTEX_A15, JBIGI_OPTIMIZATION_ARM_CORTEX_A9, JBIGI_OPTIMIZATION_ARM_CORTEX_A8,
     
    232235                                                                     JBIGI_OPTIMIZATION_COREI, JBIGI_OPTIMIZATION_CORE2, JBIGI_OPTIMIZATION_PENTIUMM,
    233236                                                                     JBIGI_OPTIMIZATION_PENTIUM3, JBIGI_OPTIMIZATION_X86};
     237
    234238    /**
    235239     * The mapping between CPU architecture and its compatibility list.
     
    237241    @SuppressWarnings("serial")
    238242    private final static HashMap<String, String[]> JBIGI_COMPAT_MAP = new HashMap<String, String[]>() {{
     243        // none -> {"none"), since 0.9.30
     244        put(JBIGI_OPTIMIZATION_X86, JBIGI_COMPAT_LIST_NONE);
    239245        put(JBIGI_OPTIMIZATION_PPC, JBIGI_COMPAT_LIST_PPC);
    240246
     
    407413                        return JBIGI_OPTIMIZATION_PENTIUM;
    408414                }
    409                 return null;
    410415            } catch (UnknownCPUException e) {
    411                 return null;
    412             }
     416            }
     417            // always try "none" if we don't know the x86 type,
     418            // in case of CPUID fail or not finding compatibility above
     419            return JBIGI_OPTIMIZATION_X86;
    413420        } else if (_isArm) {
    414421            if (_isWin)
     
    740747    public static void main(String args[]) {
    741748        _doLog = true;
     749        String path = System.getProperty("java.library.path");
     750        String name = _libPrefix + "jbigi" + _libSuffix;
     751        System.out.println("Native library search path: " + path);
     752        if (_nativeOk) {
     753            String sep = System.getProperty("path.separator");
     754            String[] paths = DataHelper.split(path, sep);
     755            for (String p : paths) {
     756                File f = new File(p, name);
     757                if (f.exists()) {
     758                    System.out.println("Found native library: " + f);
     759                    break;
     760                }
     761            }
     762        } else {
     763            System.out.println("Failed to load native library. Please verify the existence of the " +
     764                               name + " file in the library path, or set -Djava.library.path=. in the command line");
     765        }
    742766        boolean nativeOnly = args.length > 0 && args[0].equals("-n");
    743767        if (nativeOnly && !_nativeOk) {
    744             System.out.println("Failed to load native library");
    745768            System.exit(1);
    746769        }
     
    960983                    debug("loadResource list to try is: " + toTry);
    961984                    for (String s : toTry) {
    962                         System.out.println("trying to load resource: " + s);
     985                        debug("Trying to load resource " + s);
    963986                        if (loadFromResource(s)) {
    964987                            _nativeOk = true;
     
    10931116        URL resource = ClassLoader.getSystemResource(resourceName);
    10941117        if (resource == null) {
    1095             System.out.println("Resource name [" + resourceName + "] was not found");
     1118            info("Resource name [" + resourceName + "] was not found");
    10961119            return false;
    10971120        }
     
    11081131            fos = null;
    11091132            System.load(outFile.getAbsolutePath()); //System.load requires an absolute path to the lib
    1110             System.out.println("Loaded library: " + resource);
     1133            info("Loaded library: " + resource);
    11111134        } catch (UnsatisfiedLinkError ule) {
    11121135            // don't include the exception in the message - too much
    1113             System.out.println("Failed to load the resource " + resourceName + " - not a valid library for this platform");
     1136            warn("Failed to load the resource " + resourceName + " - not a valid library for this platform");
    11141137            if (outFile != null)
    11151138                outFile.delete();
    11161139            return false;
    11171140        } catch (IOException ioe) {
    1118             System.out.println("Problem writing out the temporary native library data: " + ioe.toString());
     1141            warn("Problem writing out the temporary native library data: " + ioe);
    11191142            if (outFile != null)
    11201143                outFile.delete();
     
    11421165        List<String> rv = new ArrayList<String>(20);
    11431166        String primary = getMiddleName2(true);
     1167        // primary may be null
    11441168        String[] compatList = JBIGI_COMPAT_MAP.get(primary);
    11451169
     
    12231247     *  @return may be null if optimized is true; returns jbigi-xxx-none if optimize is false
    12241248     */
     1249/****
    12251250    private static final String getMiddleName(boolean optimized) {
    12261251        String m2 = getMiddleName2(optimized);
     
    12291254        return getMiddleName1() + m2;
    12301255    }
     1256****/
    12311257
    12321258    /**
  • core/java/src/net/i2p/util/SystemVersion.java

    rfa6fc84 ra3e146a8  
    4040    private static final boolean _hasWrapper = System.getProperty("wrapper.version") != null;
    4141    private static final boolean _isLinuxService;
     42    private static final boolean _isSlow;
    4243
    4344    private static final boolean _oneDotSix;
     
    7071                          (DAEMON_USER.equals(System.getProperty("user.name")) ||
    7172                           (_isGentoo && GENTOO_USER.equals(System.getProperty("user.name"))));
     73        _isSlow = _isAndroid || _isApache || _isArm || _isGNU || getMaxMemory() < 48*1024*1024L;
    7274
    7375        int sdk = 0;
     
    155157
    156158    /**
     159     *  Our best guess on whether this is a slow architecture / OS / JVM,
     160     *  using some simple heuristics.
     161     *
     162     *  @since 0.9.30
     163     */
     164    public static boolean isSlow() {
     165        // we don't put the NBI call in the static field,
     166        // to prevent a circular initialization with NBI.
     167        return _isSlow || !NativeBigInteger.isNative();
     168    }
     169
     170    /**
    157171     *  Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.6") &gt;= 0
    158172     *  as it handles Android also, where java.version = "0".
     
    291305        System.out.println("Mac      : " + isMac());
    292306        System.out.println("OpenJDK  : " + isOpenJDK());
     307        System.out.println("Slow     : " + isSlow());
    293308        System.out.println("Windows  : " + isWindows());
    294309        System.out.println("Wrapper  : " + hasWrapper());
  • core/java/src/net/i2p/util/ZipFileComment.java

    rfa6fc84 ra3e146a8  
    2020 * Beerware.
    2121 *
    22  * since 0.8.8
     22 * @deprecated scheduled for removal late 2017, not for external use
     23 * @since 0.8.8
    2324 */
     25@Deprecated
    2426public abstract class ZipFileComment {
    2527
  • debian-alt/README.txt

    rfa6fc84 ra3e146a8  
    1 The files in ../debian/ are for jessie/stable.
     1The files in ../debian/ are for stretch.
     2You may also use them for jessie if you have libjetty9-java from jessie-backports.
     3
    24Alternates are in the subdirectories here.
     5To use them, copy them over the files in ../debian/  .
    36
    4 trusty may be copied to utopic, vivid, wily, xenial.
     7Built file compatibility:
     8trusty may be copied to vivid.
     9trusty may be used for jessie without libjetty9-java from backports.
     10xenial may be copied to yakkety, zesty.
    511
    612tails-jessie and tails-wheezy are currently the same as
  • debian-alt/doc/debian-build.txt

    rfa6fc84 ra3e146a8  
    9898reprepro -v copysrc sid jessie i2p
    9999
     100# install in the architectures not copied from ubuntu
     101# 'flood' should do this but forgot how, can't make it work any more
     102reprepro -v -A 'armel|armhf|powerpc' includedeb wheezy i2p_0.9.xxp-1ubuntu1_all.deb
     103reprepro -v -A 'armel|armhf|powerpc' includedeb wheezy i2p-doc_0.9.xxp-1ubuntu1_all.deb
     104reprepro -v -A 'armel|armhf|powerpc' includedeb wheezy i2p-router_0.9.xxp-1ubuntu1_all.deb
     105reprepro -v -A 'armel|armhf|powerpc' includedeb jessie i2p_0.9.xx-1ubuntu1_all.deb
     106reprepro -v -A 'armel|armhf|powerpc' includedeb jessie i2p-doc_0.9.xx-1ubuntu1_all.deb
     107reprepro -v -A 'armel|armhf|powerpc' includedeb jessie i2p-router_0.9.xx-1ubuntu1_all.deb
     108reprepro -v -A 'armel|armhf' includedeb sid i2p_0.9.xx-1ubuntu1_all.deb
     109reprepro -v -A 'armel|armhf' includedeb sid i2p-doc_0.9.xx-1ubuntu1_all.deb
     110reprepro -v -A 'armel|armhf' includedeb sid i2p-router_0.9.xx-1ubuntu1_all.deb
     111
     112
    100113
    101114# check status
    102115reprepro ls i2p
     116reprepro ls i2p-doc
     117reprepro ls i2p-router
    103118reprepro ls libjbigi-jni
  • debian-alt/doc/dependencies.txt

    rfa6fc84 ra3e146a8  
    4242  In non-Debian builds we bundle the source code; it's removed in the Debian source package.
    4343
    44 * libjetty8-java
    45   For /usr/share/java/jetty8-*.jar.
     44* libjetty9-java
     45  For /usr/share/java/jetty9-*.jar.
    4646  In non-Debian builds we bundle the jars; it's removed in the Debian source package.
    4747  For some Debian and Ubuntu releases, these seem to be much older than what we're bundling,
     
    5353  Jetty 9 ticket is https://trac.i2p2.de/ticket/1512
    5454  Updating Jetty may break external plugins. Extensive testing is required.
    55   Note that the libjetty8-java dependency brings in libservlet3.0-java which we require.
     55  Note that the libjetty9-java dependency brings in libservlet3.0-java which we require.
    5656
    5757* glassfish-javaee
  • debian-alt/precise/control

    rfa6fc84 ra3e146a8  
    88Build-Depends: debhelper (>= 7.0.50~)
    99 ,ant (>= 1.8)
    10  ,ant-optional
    1110 ,debconf
    1211 ,openjdk-7-jdk
     
    7776Depends: ${misc:Depends}, ${java:Depends}, ${shlibs:Depends},
    7877 openjdk-8-jre-headless | openjdk-7-jre-headless | java8-runtime-headless | java7-runtime-headless,
    79  libecj-java,
    8078 geoip-database,
    8179 gettext-base,
  • debian-alt/precise/i2p-router.install

    rfa6fc84 ra3e146a8  
    2020
    2121
     22pkg-temp/lib/addressbook.jar usr/share/i2p/lib
    2223pkg-temp/lib/BOB.jar usr/share/i2p/lib
    2324pkg-temp/lib/desktopgui.jar usr/share/i2p/lib
     
    3536
    3637
    37 # uncomment if not building with libjetty8-java
     38# uncomment if not building with libjetty9-java
    3839# ubuntu: in trusty vivid wily xenial
    3940# debian: in wheezy jessie stretch sid
     
    5253pkg-temp/lib/org.mortbay.jetty.jar usr/share/i2p/lib
    5354pkg-temp/lib/org.mortbay.jmx.jar usr/share/i2p/lib
    54 # following two are from libservlet3.0-java which is a dependency of libjetty8-java
    55 pkg-temp/lib/javax.servlet.jar usr/share/i2p/lib
    5655
    5756
    58 # uncomment if not building with either libtomcat6-java or libtomcat7-java
     57# uncomment if not building with libtomcat8-java
    5958pkg-temp/lib/commons-el.jar usr/share/i2p/lib
    6059# legacy name, contains only tomcat-juli, not commons-logging
    6160pkg-temp/lib/commons-logging.jar usr/share/i2p/lib
    6261pkg-temp/lib/jasper-runtime.jar usr/share/i2p/lib
     62pkg-temp/lib/javax.servlet.jar usr/share/i2p/lib
    6363
    6464
  • debian-alt/precise/i2p-router.links

    rfa6fc84 ra3e146a8  
    44usr/share/common-licenses/BSD usr/share/doc/i2p-router/licenses/LICENSE-BSD.txt
    55
    6 usr/share/java/eclipse-ecj.jar usr/share/i2p/lib/eclipse-ecj.jar
     6
     7# comment out if not building with libjetty9-java
     8# ubuntu: in trusty vivid wily xenial
     9# debian: in wheezy jessie stretch sid
     10#usr/share/java/jetty9-continuation.jar usr/share/i2p/lib/jetty-continuation.jar
     11#usr/share/java/jetty9-deploy.jar usr/share/i2p/lib/jetty-deploy.jar
     12#usr/share/java/jetty9-http.jar usr/share/i2p/lib/jetty-http.jar
     13#usr/share/java/jetty9-io.jar usr/share/i2p/lib/jetty-io.jar
     14# legacy name in lib/
     15#usr/share/java/jetty9-rewrite.jar usr/share/i2p/lib/jetty-rewrite-handler.jar
     16#usr/share/java/jetty9-security.jar usr/share/i2p/lib/jetty-security.jar
     17#usr/share/java/jetty9-servlet.jar usr/share/i2p/lib/jetty-servlet.jar
     18#usr/share/java/jetty9-servlets.jar usr/share/i2p/lib/jetty-servlets.jar
     19#usr/share/java/jetty9-start.jar usr/share/i2p/lib/jetty-start.jar
     20#usr/share/java/jetty9-util.jar usr/share/i2p/lib/jetty-util.jar
     21#usr/share/java/jetty9-webapp.jar usr/share/i2p/lib/jetty-webapp.jar
     22#usr/share/java/jetty9-xml.jar usr/share/i2p/lib/jetty-xml.jar
     23# legacy name in lib/
     24#usr/share/java/jetty9-server.jar usr/share/i2p/lib/org.mortbay.jetty.jar
     25# legacy name in lib/
     26#usr/share/java/jetty9-jmx.jar usr/share/i2p/lib/org.mortbay.jmx.jar
     27# following two are from libservlet3.1-java which is a dependency of libjetty9-java
     28# legacy name in lib/
     29#usr/share/java/servlet-api-3.1.jar usr/share/i2p/lib/javax.servlet.jar
     30# combined into javax.servlet.jar in non-package builds
     31#usr/share/java/jsp-api-2.3.jar usr/share/i2p/lib/jsp-api.jar
    732
    833
    9 # comment out if not building with libjetty8-java
    10 # ubuntu: in trusty vivid wily xenial
    11 # debian: in wheezy jessie stretch sid
    12 #usr/share/java/jetty8-continuation.jar usr/share/i2p/lib/jetty-continuation.jar
    13 #usr/share/java/jetty8-deploy.jar usr/share/i2p/lib/jetty-deploy.jar
    14 #usr/share/java/jetty8-http.jar usr/share/i2p/lib/jetty-http.jar
    15 #usr/share/java/jetty8-io.jar usr/share/i2p/lib/jetty-io.jar
     34# comment out if not building with libtomcat8-java
     35# ubuntu: only in xenial+
     36# debian: wheezy-backports, jessie+
     37# legacy name, contains only tomcat-juli, not commons-logging
     38#usr/share/java/tomcat8-juli.jar usr/share/i2p/lib/commons-logging.jar
     39#usr/share/java/tomcat8-jasper.jar usr/share/i2p/lib/jasper-runtime.jar
     40# combined into jasper-runtime.jar in non-package builds
     41#usr/share/java/tomcat8-coyote.jar usr/share/i2p/lib/tomcat-coyote.jar
     42#usr/share/java/tomcat8-api.jar usr/share/i2p/lib/tomcat-api.jar
     43#usr/share/java/tomcat8-util.jar usr/share/i2p/lib/tomcat-util.jar
     44#usr/share/java/tomcat8-util-scan.jar usr/share/i2p/lib/tomcat-util-scan.jar
     45# combined into commons-el.jar in non-package builds
     46#usr/share/java/tomcat8-jasper-el.jar usr/share/i2p/lib/jasper-el.jar
    1647# legacy name in lib/
    17 #usr/share/java/jetty8-rewrite.jar usr/share/i2p/lib/jetty-rewrite-handler.jar
    18 #usr/share/java/jetty8-security.jar usr/share/i2p/lib/jetty-security.jar
    19 #usr/share/java/jetty8-servlet.jar usr/share/i2p/lib/jetty-servlet.jar
    20 #usr/share/java/jetty8-servlets.jar usr/share/i2p/lib/jetty-servlets.jar
    21 #usr/share/java/jetty8-start.jar usr/share/i2p/lib/jetty-start.jar
    22 #usr/share/java/jetty8-util.jar usr/share/i2p/lib/jetty-util.jar
    23 #usr/share/java/jetty8-webapp.jar usr/share/i2p/lib/jetty-webapp.jar
    24 #usr/share/java/jetty8-xml.jar usr/share/i2p/lib/jetty-xml.jar
    25 # legacy name in lib/
    26 #usr/share/java/jetty8-server.jar usr/share/i2p/lib/org.mortbay.jetty.jar
    27 # legacy name in lib/
    28 #usr/share/java/jetty8-jmx.jar usr/share/i2p/lib/org.mortbay.jmx.jar
    29 # following two are from libservlet3.0-java which is a dependency of libjetty8-java
    30 # legacy name in lib/
    31 #usr/share/java/servlet-api-3.0.jar usr/share/i2p/lib/javax.servlet.jar
    32 # combined into javax.servlet.jar in non-package builds
    33 #usr/share/java/jsp-api-2.2.jar usr/share/i2p/lib/jsp-api.jar
    34 
    35 
    36 # comment out if not building with libtomcat6-java
    37 # ubuntu: only in precise trusty vivid
    38 # debian: only in wheezy
    39 # legacy name, contains only tomcat-juli, not commons-logging
    40 #usr/share/java/tomcat-juli.jar usr/share/i2p/lib/commons-logging.jar
    41 #usr/share/java/jasper.jar usr/share/i2p/lib/jasper-runtime.jar
    42 # combined into jasper-runtime.jar in non-package builds
    43 #usr/share/java/tomcat-coyote.jar usr/share/i2p/lib/tomcat-coyote.jar
    44 # combined into commons-el.jar in non-package builds
    45 #usr/share/java/jasper-el.jar usr/share/i2p/lib/jasper-el.jar
    46 # following is from libservlet2.5-java which is a dependency of libtomcat6-java
    47 # legacy name in lib/
    48 #usr/share/java/el-api-2.1.jar usr/share/i2p/lib/commons-el.jar
    49 
    50 
    51 # comment out if not building with libtomcat7-java
    52 # ubuntu: only in precise trusty vivid
    53 # debian: only in wheezy
    54 # legacy name, contains only tomcat-juli, not commons-logging
    55 #usr/share/java/tomcat-juli.jar usr/share/i2p/lib/commons-logging.jar
    56 #usr/share/java/tomcat-jasper.jar usr/share/i2p/lib/jasper-runtime.jar
    57 # combined into jasper-runtime.jar in non-package builds
    58 #usr/share/java/tomcat-coyote.jar usr/share/i2p/lib/tomcat-coyote.jar
    59 # tomcat 7 only
    60 #usr/share/java/tomcat-api.jar usr/share/i2p/lib/tomcat-api.jar
    61 #usr/share/java/tomcat-util.jar usr/share/i2p/lib/tomcat-util.jar
    62 # combined into commons-el.jar in non-package builds
    63 #usr/share/java/tomcat-jasper-el.jar usr/share/i2p/lib/jasper-el.jar
    64 # following is from libservlet3.0-java which is a dependency of libtomcat7-java
    65 # legacy name in lib/
    66 #usr/share/java/el-api-2.2.jar usr/share/i2p/lib/commons-el.jar
     48#usr/share/java/tomcat8-el-api.jar usr/share/i2p/lib/commons-el.jar
     49#usr/share/java/tomcat8-servlet-api.jar usr/share/i2p/lib/javax.servlet.jar
     50#usr/share/java/tomcat8-jsp-api.jar usr/share/i2p/lib/jsp-api.jar
    6751
    6852
  • debian-alt/precise/rules

    rfa6fc84 ra3e146a8  
    4040
    4141%:
    42         dh $@
     42        dh $@ --with bash-completion
    4343
    4444clean: createcopyright
     
    8585        @/bin/echo -e "with-geoip-database=true" >> $(CURDIR)/override.properties
    8686
    87         @# ubuntu: not in precise
    88         @# debian: in wheezy jessie stretch sid
    89         @#/bin/echo -e "with-libjetty8-java=true" >> $(CURDIR)/override.properties
     87        @# ubuntu: in xenial
     88        @# debian: in jessie-backports stretch sid
     89        @#/bin/echo -e "with-libjetty9-java=true" >> $(CURDIR)/override.properties
    9090        @#mkdir -p $(CURDIR)/apps/jetty/jettylib
    91         @#ln -sf /usr/share/java/jetty8-continuation.jar $(CURDIR)/apps/jetty/jettylib/jetty-continuation.jar
    92         @#ln -sf /usr/share/java/jetty8-deploy.jar $(CURDIR)/apps/jetty/jettylib/jetty-deploy.jar
    93         @#ln -sf /usr/share/java/jetty8-http.jar $(CURDIR)/apps/jetty/jettylib/jetty-http.jar
    94         @#ln -sf /usr/share/java/jetty8-io.jar $(CURDIR)/apps/jetty/jettylib/jetty-io.jar
    95         @#ln -sf /usr/share/java/jetty8-rewrite.jar $(CURDIR)/apps/jetty/jettylib/jetty-rewrite-handler.jar
    96         @#ln -sf /usr/share/java/jetty8-security.jar $(CURDIR)/apps/jetty/jettylib/jetty-security.jar
    97         @#ln -sf /usr/share/java/jetty8-servlet.jar $(CURDIR)/apps/jetty/jettylib/jetty-servlet.jar
    98         @#ln -sf /usr/share/java/jetty8-servlets.jar $(CURDIR)/apps/jetty/jettylib/jetty-servlets.jar
    99         @#ln -sf /usr/share/java/jetty8-start.jar $(CURDIR)/apps/jetty/jettylib/jetty-start.jar
    100         @#ln -sf /usr/share/java/jetty8-util.jar $(CURDIR)/apps/jetty/jettylib/jetty-util.jar
    101         @#ln -sf /usr/share/java/jetty8-webapp.jar $(CURDIR)/apps/jetty/jettylib/jetty-webapp.jar
    102         @#ln -sf /usr/share/java/jetty8-xml.jar $(CURDIR)/apps/jetty/jettylib/jetty-xml.jar
    103         @#ln -sf /usr/share/java/jetty8-server.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jetty.jar
    104         @#ln -sf /usr/share/java/jetty8-jmx.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jmx.jar
    105         @# following two are from libservlet3.0-java which is a dependency of libjetty8-java
    106         @#ln -sf /usr/share/java/servlet-api-3.0.jar $(CURDIR)/apps/jetty/jettylib/javax.servlet.jar
    107         @#ln -sf /usr/share/java/jsp-api-2.2.jar $(CURDIR)/apps/jetty/jettylib/jsp-api.jar
    108 
    109         @# ubuntu: only in precise trusty vivid
    110         @# debian: only in wheezy
    111         @#@/bin/echo -e "with-libtomcat6-java=true" >> $(CURDIR)/override.properties
     91        @#ln -sf /usr/share/java/jetty9-continuation.jar $(CURDIR)/apps/jetty/jettylib/jetty-continuation.jar
     92        @#ln -sf /usr/share/java/jetty9-deploy.jar $(CURDIR)/apps/jetty/jettylib/jetty-deploy.jar
     93        @#ln -sf /usr/share/java/jetty9-http.jar $(CURDIR)/apps/jetty/jettylib/jetty-http.jar
     94        @#ln -sf /usr/share/java/jetty9-io.jar $(CURDIR)/apps/jetty/jettylib/jetty-io.jar
     95        @#ln -sf /usr/share/java/jetty9-rewrite.jar $(CURDIR)/apps/jetty/jettylib/jetty-rewrite-handler.jar
     96        @#ln -sf /usr/share/java/jetty9-security.jar $(CURDIR)/apps/jetty/jettylib/jetty-security.jar
     97        @#ln -sf /usr/share/java/jetty9-servlet.jar $(CURDIR)/apps/jetty/jettylib/jetty-servlet.jar
     98        @#ln -sf /usr/share/java/jetty9-servlets.jar $(CURDIR)/apps/jetty/jettylib/jetty-servlets.jar
     99        @#ln -sf /usr/share/java/jetty9-start.jar $(CURDIR)/apps/jetty/jettylib/jetty-start.jar
     100        @#ln -sf /usr/share/java/jetty9-util.jar $(CURDIR)/apps/jetty/jettylib/jetty-util.jar
     101        @#ln -sf /usr/share/java/jetty9-webapp.jar $(CURDIR)/apps/jetty/jettylib/jetty-webapp.jar
     102        @#ln -sf /usr/share/java/jetty9-xml.jar $(CURDIR)/apps/jetty/jettylib/jetty-xml.jar
     103        @#ln -sf /usr/share/java/jetty9-server.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jetty.jar
     104        @#ln -sf /usr/share/java/jetty9-jmx.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jmx.jar
     105        @# following two are from libservlet3.1-java which is a dependency of libjetty9-java
     106        @#ln -sf /usr/share/java/servlet-api-3.1.jar $(CURDIR)/apps/jetty/jettylib/javax.servlet.jar
     107        @#ln -sf /usr/share/java/jsp-api-2.3.jar $(CURDIR)/apps/jetty/jettylib/jsp-api.jar
     108
     109        @# debian and ubuntu: wheezy-backports, jessie+, xenial+
     110        @#/bin/echo -e "with-libtomcat8-java=true" >> $(CURDIR)/override.properties
    112111        @#mkdir -p $(CURDIR)/apps/jetty/jettylib
    113         @#ln -sf /usr/share/java/jasper.jar $(CURDIR)/apps/jetty/jettylib/jasper-runtime.jar
    114         @#ln -sf /usr/share/java/tomcat-coyote.jar $(CURDIR)/apps/jetty/jettylib/tomcat-coyote.jar
    115         @#ln -sf /usr/share/java/tomcat-juli.jar $(CURDIR)/apps/jetty/jettylib/commons-logging.jar
    116         @#ln -sf /usr/share/java/jasper-el.jar $(CURDIR)/apps/jetty/jettylib/jasper-el.jar
    117         @# following is from libservlet2.5-java which is a dependency of libtomcat6-java
    118         @#ln -sf /usr/share/java/el-api-2.1.jar $(CURDIR)/apps/jetty/jettylib/commons-el.jar
    119 
    120         @# debian and ubuntu: everywhere
    121         @#/bin/echo -e "with-libtomcat7-java=true" >> $(CURDIR)/override.properties
    122         @#mkdir -p $(CURDIR)/apps/jetty/jettylib
    123         @#ln -sf /usr/share/java/tomcat-jasper.jar $(CURDIR)/apps/jetty/jettylib/jasper-runtime.jar
    124         @#ln -sf /usr/share/java/tomcat-api.jar $(CURDIR)/apps/jetty/jettylib/tomcat-api.jar
    125         @#ln -sf /usr/share/java/tomcat-util.jar $(CURDIR)/apps/jetty/jettylib/tomcat-util.jar
    126         @#ln -sf /usr/share/java/tomcat-coyote.jar $(CURDIR)/apps/jetty/jettylib/tomcat-coyote.jar
    127         @#ln -sf /usr/share/java/tomcat-juli.jar $(CURDIR)/apps/jetty/jettylib/commons-logging.jar
    128         @#ln -sf /usr/share/java/tomcat-jasper-el.jar $(CURDIR)/apps/jetty/jettylib/jasper-el.jar
    129         @# following is from libservlet3.0-java which is a dependency of libtomcat7-java
    130         @#ln -sf /usr/share/java/el-api-2.2.jar $(CURDIR)/apps/jetty/jettylib/commons-el.jar
     112        @#ln -sf /usr/share/java/tomcat8-api.jar $(CURDIR)/apps/jetty/jettylib/tomcat-api.jar
     113        @#ln -sf /usr/share/java/tomcat8-coyote.jar $(CURDIR)/apps/jetty/jettylib/tomcat-coyote.jar
     114        @#ln -sf /usr/share/java/tomcat8-el-api.jar $(CURDIR)/apps/jetty/jettylib/commons-el.jar
     115        @#ln -sf /usr/share/java/tomcat8-jasper.jar $(CURDIR)/apps/jetty/jettylib/jasper-runtime.jar
     116        @#ln -sf /usr/share/java/tomcat8-jasper-el.jar $(CURDIR)/apps/jetty/jettylib/jasper-el.jar
     117        @#ln -sf /usr/share/java/tomcat8-jsp-api.jar $(CURDIR)/apps/jetty/jettylib/jsp-api.jar
     118        @#ln -sf /usr/share/java/tomcat8-juli.jar $(CURDIR)/apps/jetty/jettylib/commons-logging.jar
     119        @#ln -sf /usr/share/java/tomcat8-servlet-api.jar $(CURDIR)/apps/jetty/jettylib/javax.servlet.jar
     120        @#ln -sf /usr/share/java/tomcat8-util.jar $(CURDIR)/apps/jetty/jettylib/tomcat-util.jar
     121        @#ln -sf /usr/share/java/tomcat8-util-scan.jar $(CURDIR)/apps/jetty/jettylib/tomcat-util-scan.jar
    131122
    132123        @# debian and ubuntu: everywhere
  • debian-alt/trusty/rules

    rfa6fc84 ra3e146a8  
    3939
    4040%:
    41         dh $@ --with systemd
     41        dh $@ --with systemd,bash-completion
    4242
    4343clean: createcopyright