Compare commits

...

19 Commits

Author SHA1 Message Date
zzz
ab2f9b9a74 Debian: Increase min ant version
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-06-03 13:21:53 -04:00
zzz
d0d7d1775f Enforce min java version in build.xml
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-06-03 13:19:53 -04:00
zzz
fa9f1fd07c Bump Java version in docs and installer configs 2025-06-03 13:10:43 -04:00
zzz
f2d2652ba6 Add custom error pages
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
Adapted from I2PPlus with permission, same license.
2025-06-03 11:21:14 -04:00
zzz
b8121336d8 Custom error pages
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-06-03 10:39:23 -04:00
zzz
bf5792f2ea Prep for custom error pages
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-06-03 10:04:25 -04:00
zzz
9c2cf83dfa Add custom error handler for base context
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
Disable showing context and stack trace
2025-06-03 08:25:09 -04:00
zzz
ec0a285f97 Replace deprecated method
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-06-02 13:00:56 -04:00
zzz
162888e885 Fix XI2PLocationFilter for Jetty 12
- Fix IPv6 address comparison
- Add port to header
- Log tweaks
- Cleanups
2025-06-02 12:59:43 -04:00
zzz
141d60046f Convert CGI context to FCGI
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-06-01 16:04:47 -04:00
zzz
32a9a840b3 Update license for Jetty 12
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-05-30 08:36:37 -04:00
zzz
aa95568121 Use non-versioned file for slf4j2 jar
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-05-28 17:19:14 -04:00
zzz
f560d2cb2a Debian updates for Trixie
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
untested
remove tomcat8 references
debian-alt TODO
2025-05-28 10:41:50 -04:00
zzz
63ccbfe43d Logging Javadoc
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-05-28 09:12:47 -04:00
zzz
7e443decbc Eepsite: Fix config class names, fix webapp environment
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-05-27 18:17:23 -04:00
zzz
26ae478f48 Snark standalone
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-05-27 16:18:28 -04:00
zzz
c9fe52e7f4 Remove test log message
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
2025-05-27 14:36:50 -04:00
zzz
01d391a071 Eepsite on Jetty 12
TODO:

- FCGI
- Migration
- Stop/restart
- Webapp deployer
2025-05-27 13:11:33 -04:00
zzz
c4155008db Conversion to Jetty 12 / Java 17
Some checks failed
Java CI / build (push) Has been cancelled
Java CI / javadoc-latest (push) Has been cancelled
Java CI / build-java7 (push) Has been cancelled
Java with IzPack Snapshot Setup / setup (push) Has been cancelled
Sync Primary Repository to GitHub Mirror / sync (push) Has been cancelled
- Basic console (tested)
- SSL console (tested)
- Auth (tested)
- Debug logging (tested)
- Console request log (tested)

- I2PControl separate port (untested)
- Eepsite request log (untested)

TODO:

- Eepsites + migration
- Debian with or without Jetty 12
- Snark standalone
- Tomcat upgrade
- Checkin jetty jars
- Cleanups
2025-05-26 10:06:06 -04:00
67 changed files with 2275 additions and 1642 deletions

View File

@@ -40,7 +40,7 @@ To uninstall I2P:
rm -rf $I2PInstallDir ~/.i2p
Supported JVMs:
All platforms: Java 1.8 or higher required
All platforms: Java 17 or higher required
Windows: OpenJDK or Oracle from http://java.com/download
Linux: OpenJDK or Oracle from http://java.com/download
FreeBSD: OpenJDK or Oracle from http://java.com/download

View File

@@ -1,7 +1,7 @@
I2P source installation instructions
Prerequisites to build from source:
Java SDK (preferably Oracle or OpenJDK) 8 or higher
Java SDK (preferably Oracle or OpenJDK) 17 or higher
Non-linux operating systems and JVMs: See https://trac.i2p2.de/wiki/java
Certain subsystems for embedded (core, router, mstreaming, streaming, i2ptunnel) require only Java 1.6
Apache Ant 1.9.8 or higher
@@ -65,7 +65,7 @@ To uninstall I2P:
rm -rf $I2PInstallDir ~/.i2p
Supported JVMs:
All platforms: Java 1.8 or higher required
All platforms: Java 17 or higher required
Windows: Latest available from http://java.com/download
Linux: Latest available from http://java.com/download
Other operating systems and JVMs: See https://geti2p.net/download

View File

@@ -256,12 +256,10 @@ Applications:
Zxing 3.4.1:
See licenses/LICENSE-Apache2.0.txt
Jetty 9.3.30.v20211001 (jetty-*.jar, org.mortbay.*.jar):
Jetty 12.0.21 (jetty-*.jar, org.mortbay.*.jar):
(not included in most distribution packages, except for jetty-i2p.jar)
See licenses/ABOUT-Jetty.html
See licenses/NOTICE-Jetty.html
See licenses/LICENSE-Apache2.0.txt
See licenses/LICENSE-ECLIPSE-1.0.html
See licenses/NOTICE-Jetty.txt
See licenses/LICENSE-Jetty.txt
RRD4J 3.10 (jrobin.jar):
Copyright (c) 2001-2005 Sasa Markovic and Ciaran Treanor.

View File

@@ -27,7 +27,7 @@ To get development branch from source control: [https://geti2p.net/newdevelopers
### Prerequisites
- Java SDK (preferably Oracle or OpenJDK) 8 or higher
- Java SDK (preferably Oracle or OpenJDK) 17 or higher
- Non-linux operating systems and JVMs: See [https://trac.i2p2.de/wiki/java](https://trac.i2p2.de/wiki/java)
- Certain subsystems for embedded (core, router, mstreaming, streaming, i2ptunnel)
require only Java 6

View File

@@ -1,5 +1,5 @@
Prerequisites to build from source:
Java SDK (preferably Oracle or OpenJDK) 8 or higher
Java SDK (preferably Oracle or OpenJDK) 17 or higher
Non-linux operating systems and JVMs: See https://trac.i2p2.de/wiki/java
Certain subsystems for embedded (core, router, mstreaming, streaming, i2ptunnel) require only Java 6
Apache Ant 1.9.8 or higher

View File

@@ -21,6 +21,9 @@
<pathelement location="${jettylib}/org.mortbay.jetty.jar" />
<pathelement location="${jettylib}/javax.servlet.jar" />
<pathelement location="${jettylib}/jetty-servlet.jar" />
<pathelement location="${jettylib}/jetty-http.jar" />
<pathelement location="${jettylib}/jetty-io.jar" />
<pathelement location="${jettylib}/jetty-webapp.jar" />
<pathelement location="${wrapperlib}/wrapper.jar" />
<!-- following jar only present for debian builds -->
<pathelement location="../../core/java/build/json-simple.jar" />

View File

@@ -14,8 +14,10 @@ import net.i2p.util.Log;
import net.i2p.apache.http.conn.util.InetAddressUtils;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Callback;
/**
* Block certain Host headers to prevent DNS rebinding attacks.
@@ -28,7 +30,7 @@ import org.eclipse.jetty.server.handler.HandlerWrapper;
*
* @since 0.12 copied from routerconsole
*/
public class HostCheckHandler extends HandlerWrapper
public class HostCheckHandler extends Handler.Wrapper
{
private final I2PAppContext _context;
private final Set<String> _listenHosts;
@@ -57,14 +59,13 @@ public class HostCheckHandler extends HandlerWrapper
/**
* Block by Host header, pass everything else to the delegate.
*/
public void handle(String pathInContext,
Request baseRequest,
HttpServletRequest httpRequest,
HttpServletResponse httpResponse)
throws IOException, ServletException
@Override
public boolean handle(Request request,
Response response,
Callback callback)
throws Exception
{
String host = httpRequest.getHeader("Host");
String host = request.getHeaders().get("Host");
if (!allowHost(host)) {
Log log = _context.logManager().getLog(HostCheckHandler.class);
host = DataHelper.stripHTML(getHost(host));
@@ -73,11 +74,12 @@ public class HostCheckHandler extends HandlerWrapper
I2PControlController.PROP_ALLOWED_HOSTS + '=' + host +
"\" to I2PControl.conf and restart.";
log.logAlways(Log.WARN, s);
httpResponse.sendError(403, s);
return;
Response.writeError(request, response, callback, 403, s);
callback.succeeded();
return true;
}
super.handle(pathInContext, baseRequest, httpRequest, httpResponse);
return super.handle(request, response, callback);
}
/**

View File

@@ -31,6 +31,8 @@ import net.i2p.i2pcontrol.security.SecurityManager;
import net.i2p.i2pcontrol.servlets.JSONRPC2Servlet;
import net.i2p.i2pcontrol.servlets.configuration.ConfigurationManager;
import org.eclipse.jetty.ee8.servlet.ServletContextHandler;
import org.eclipse.jetty.ee8.servlet.ServletHolder;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
@@ -38,8 +40,6 @@ import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import java.io.File;
@@ -238,8 +238,8 @@ public class I2PControlController implements RouterApp {
Connector ssl = buildDefaultListener(server);
server.addConnector(ssl);
ServletHandler sh = new ServletHandler();
sh.addServletWithMapping(new ServletHolder(new JSONRPC2Servlet(_context, _secMan)), "/");
ServletContextHandler sch = new ServletContextHandler();
sch.addServlet(new ServletHolder(new JSONRPC2Servlet(_context, _secMan)), "/");
HostCheckHandler hch = new HostCheckHandler(_appContext);
Set<String> listenHosts = new HashSet<String>(8);
// fix up the allowed hosts set (see HostCheckHandler)
@@ -261,8 +261,8 @@ public class I2PControlController implements RouterApp {
}
}
hch.setListenHosts(listenHosts);
hch.setHandler(sh);
server.getServer().setHandler(hch);
hch.setHandler(sch);
server.setHandler(hch);
_conf.writeConfFile();
return server;
@@ -282,7 +282,8 @@ public class I2PControlController implements RouterApp {
}
// the keystore path and password
SslContextFactory sslFactory = new SslContextFactory(_ksp.getKeyStoreLocation());
SslContextFactory.Server sslFactory = new SslContextFactory.Server();
sslFactory.setKeyStorePath(_ksp.getKeyStoreLocation());
sslFactory.setKeyStorePassword(KeyStoreProvider.DEFAULT_KEYSTORE_PASSWORD);
// the X.509 cert password (if not present, verifyKeyStore() returned false)
sslFactory.setKeyManagerPassword(KeyStoreProvider.DEFAULT_CERTIFICATE_PASSWORD);

View File

@@ -62,6 +62,8 @@
<pathelement location="../../systray/java/build/systray.jar" />
<pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
<pathelement location="../../jetty/jettylib/jetty-util.jar" />
<pathelement location="../../jetty/jettylib/jetty-http.jar" />
<pathelement location="../../jetty/jettylib/jetty-io.jar" />
<pathelement location="../../desktopgui/dist/desktopgui.jar" />
</classpath>
</javac>

View File

@@ -13,8 +13,10 @@ import net.i2p.I2PAppContext;
import net.i2p.util.Addresses;
import net.i2p.util.Log;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Callback;
/**
* Block certain Host headers to prevent DNS rebinding attacks.
@@ -23,7 +25,7 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
*
* @since 0.9.34 adapted from router console
*/
public class HostCheckHandler extends AbstractHandler {
public class HostCheckHandler extends Handler.Abstract {
private final I2PAppContext _context;
private final Set<String> _listenHosts;
private static final String PROP_ALLOWED_HOSTS = "i2psnark.allowedHosts";
@@ -63,14 +65,13 @@ public class HostCheckHandler extends AbstractHandler {
* redirect HTTP to HTTPS,
* pass everything else to the delegate.
*/
public void handle(String pathInContext,
Request baseRequest,
HttpServletRequest httpRequest,
HttpServletResponse httpResponse)
throws IOException, ServletException
@Override
public boolean handle(Request request,
Response response,
Callback callback)
throws Exception
{
String host = httpRequest.getHeader("Host");
String host = request.getHeaders().get("Host");
if (!allowHost(host)) {
Log log = _context.logManager().getLog(HostCheckHandler.class);
host = getHost(host);
@@ -79,10 +80,11 @@ public class HostCheckHandler extends AbstractHandler {
PROP_ALLOWED_HOSTS + '=' + host +
"\" in the file " + RunStandalone.APP_CONFIG_FILE.getAbsolutePath() + " and restart.";
log.logAlways(Log.WARN, s);
httpResponse.sendError(403, s);
baseRequest.setHandled(true);
return;
Response.writeError(request, response, callback, 403, s);
callback.succeeded();
return true;
}
return false;
}
/**

View File

@@ -5,8 +5,6 @@ import java.io.File;
import java.io.IOException;
import java.util.Properties;
import org.eclipse.jetty.util.log.Log;
import net.i2p.I2PAppContext;
import net.i2p.app.MenuCallback;
import net.i2p.app.MenuHandle;
@@ -44,11 +42,8 @@ public class RunStandalone {
_context = new I2PAppContext(p);
// Do this after we have a context
// To take effect, must be set before any Jetty classes are loaded
try {
Log.setLog(new I2PLogger(_context));
} catch (Throwable t) {
System.err.println("INFO: I2P Jetty logging class not found, logging to stdout");
}
// https://slf4j.org/faq.html
System.setProperty("slf4j.provider", "net.i2p.jetty.I2PLoggingServiceProvider");
File base = _context.getBaseDir();
File xml = new File(base, "jetty-i2psnark.xml");
_jettyStart = new JettyStart(_context, null, new String[] { xml.getAbsolutePath() } );

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- =============================================================== -->
<!-- This is the configuration for a standalone i2psnark and -->
@@ -51,22 +51,11 @@
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="defaultHandler">
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Set>
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="HostChecker" class="org.klomp.snark.standalone.HostCheckHandler"/>
</Item>
<Item>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
</Array>
</Set>
</New>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Set>
<!-- =============================================================== -->
@@ -86,14 +75,33 @@
<Set name="contexts">
<Ref refid="Contexts" />
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/.*jsp-api-[^/]*\.jar$|.*/.*jsp-[^/]*\.jar$|.*/.*taglibs[^/]*\.jar$</Arg>
</Call>
</New>
</Arg>
</Call>
<!-- Setup ee8 environment -->
<!-- First call needed to initialize the class and prevent NPE -->
<Call class="org.eclipse.jetty.util.component.Environment" name="get" >
<Arg>foo</Arg>
</Call>
<New id="EBuilder" class="org.eclipse.jetty.xml.EnvironmentBuilder" >
<Arg>ee8</Arg>
</New>
<Ref refid="EBuilder">
<Call id="Environment" name="build" />
</Ref>
<Ref refid="Environment">
<Call class="org.eclipse.jetty.util.Attributes" name="setAttribute">
<Arg>contextHandlerClass</Arg>
<Arg>org.eclipse.jetty.ee8.webapp.WebAppContext</Arg>
</Call>
</Ref>
<Call class="org.eclipse.jetty.util.component.Environment" name="set" >
<Arg>
<Ref refid="Environment"/>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure the context deployer -->
<!-- A context deployer will deploy contexts described in -->
@@ -108,7 +116,10 @@
<Ref refid="DeploymentManager">
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<New class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="EnvironmentName">ee8</Set>
<Set name="parentLoaderPriority">true</Set>
<Set name="defaultsDescriptor">/home/zzz/.i2p/eepsite/etc/webdefault.xml</Set>
<Set name="monitoredDirName">./contexts</Set>
<Set name="scanInterval">0</Set>
</New>
@@ -132,9 +143,10 @@
<Ref refid="DeploymentManager">
<Call id="webappprovider" name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<New id="WebAppProvider" class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="EnvironmentName">ee8</Set>
<Set name="monitoredDirName">./webapps</Set>
<Set name="parentLoaderPriority">false</Set>
<Set name="parentLoaderPriority">true</Set>
<Set name="extractWars">false</Set>
<Set name="scanInterval">0</Set>
</New>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<!--
Configure a custom context for the site.
@@ -8,7 +8,7 @@ This context contains only a ServletContextHandler with a default servlet
to serve static html files and images.
-->
<Configure class="org.eclipse.jetty.servlet.ServletContextHandler">
<Configure class="org.eclipse.jetty.ee8.servlet.ServletContextHandler">
<Set name="contextPath">/</Set>
<Set name="resourceBase">./docroot/</Set>
<Call name="setInitParameter">
@@ -16,7 +16,7 @@ to serve static html files and images.
<Arg>max-age=3600,public</Arg>
</Call>
<Call name="addServlet">
<Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
<Arg>org.eclipse.jetty.ee8.servlet.DefaultServlet</Arg>
<Arg>/</Arg>
</Call>
</Configure>

View File

@@ -348,7 +348,6 @@
<java classname="net.i2p.servlet.util.JspC" fork="true" failonerror="true">
<!-- these are to detect tomcat version and reproducible build setting -->
<jvmarg value="-Dbuild.reproducible=${build.reproducible}" />
<jvmarg value="-Dwith-libtomcat8-java=${with-libtomcat8-java}" />
<jvmarg value="-Dwith-libtomcat9-java=${with-libtomcat9-java}" />
<jvmarg value="-Djasper.jar=../../jetty/jettylib/jasper-runtime.jar" />
<classpath>

View File

@@ -3,7 +3,7 @@
<!-- This copies jars, with some modifications and renaming,
from the jetty-distribution directory to the jettylib directory.
This is disabled if the property with-libjetty9-java=true.
This is disabled if the property with-libjetty12-java=true.
This copies jars, with some modifications and renaming,
from the apache-tomcat-deployer and apache-tomcat directories to the jettylib directory.
@@ -16,10 +16,10 @@
<!-- Note: Change version numbers in top-level build.xml if you update to a new Tomcat or Jetty! -->
<property name="jetty.branch" value="stable-9" />
<property name="jetty.base" value="jetty-distribution-${jetty.ver}" />
<property name="jetty.sha1" value="e9f176730aea36a69c24eeba77dd0880a30492dc" />
<property name="jetty.base" value="jetty-home-${jetty.ver}" />
<property name="jetty.sha1" value="6c8b834d313bcac2e6a2e42ebaf34a249887162a" />
<property name="jetty.filename" value="${jetty.base}.zip" />
<property name="jetty.url" value="https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/${jetty.ver}/${jetty.filename}" />
<property name="jetty.url" value="https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/${jetty.ver}/${jetty.filename}" />
<property name="verified.filename" value="verified.txt" />
<property name="javac.compilerargs" value="" />
<property name="javac.version" value="1.8" />
@@ -47,7 +47,7 @@
<target name="ensureJettylib1" >
<condition property="jetty.zip.extracted" >
<or>
<istrue value="${with-libjetty9-java}" />
<istrue value="${with-libjetty12-java}" />
<available file="${jetty.base}" type="dir" />
</or>
</condition>
@@ -59,7 +59,7 @@
</condition>
<condition property="verified.already" >
<or>
<istrue value="${with-libjetty9-java}" />
<istrue value="${with-libjetty12-java}" />
<istrue value="${jetty.zip.extracted}" />
<and>
<available file="${jetty.filename}" />
@@ -135,17 +135,15 @@
<!-- Jetty and tomcat files -->
<!--
We support the following configurations:
no system jars: Precise, Trusty
with-libtomcat8-java: Jessie (without backports), Wheezy
with-libtomcat8-java AND with-libjetty9-java: Xenial, Jessie (with backports), Stretch
with-libtomcat9-java: Buster
with-libtomcat9-java AND with-libjetty9-java: Buster
with-libjetty9-java (only): not supported
no system jars: All
with-libtomcat9-java: Buster+
with-libtomcat9-java AND with-libjetty12-java: Trixie
with-libjetty12-java (only): not supported
-->
<target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib1, copyJettylib2, copyJettylib3, copyTomcatLib" />
<target name="copyJettylib" depends="mkJettylibdir, copyJettylib1A, copyJettylib1B, copyTomcatLib1, copyJettylib2, copyJettylib3, copyTomcatLib" />
<!-- Jetty files only -->
<target name="copyJettylib1" depends="extractJettylib, buildPatches" unless="${with-libjetty9-java}" >
<!-- Jetty files only, files that ARE in the libjetty12-java Debian package -->
<target name="copyJettylib1A" depends="extractJettylib, buildPatches" unless="${with-libjetty12-java}" >
<!-- We copy everything to names without the version numbers so we
can update them later. Where there was something similar in Jetty 5/6,
we use the same names so they will overwrite the Jetty 5/6 jar on upgrade.
@@ -154,44 +152,31 @@
start.jar: Needed for clients.config startup of eepsites
jetty-util-xxx.jar: LifeCycle (base class for stuff), URIUtil (used in i2psnark)
jetty-deploy, -http, -io, -security, -servlet, -webapp: All split out from main server jar in Jetty 7
jetty-continuation-xxx.jar: Needed? Useful?
jetty-continuation-xxx.jar: Old Jetty 9, now a dummy
jetty-servlets-xxx.jar: Needed for CGI for eepsite
jetty-sslengine-xxx.jar: Old Jetty 6, now a dummy
jetty-java5-threadpool-xxx.jar: Old Jetty 6, now a dummy
jetty-rewrite-handler: Not used by I2P, but only 20KB and could be useful for eepsites
jetty-management: Not used by I2P, but only 34KB and could be useful for eepsites, and we bundled it with Jetty 5
javax.servlet.jsp-2.2.0.v201112011158.jar: Required API
servlet-api-3.0.jar: Required API
jetty-management: No longer included
All of these are available in the Ubuntu packages libjetty-java and libjetty-extra-java
-->
<copy preservelastmodified="true" file="${jetty.base}/start.jar" tofile="jettylib/jetty-start.jar" />
<copy file="${jetty.base}/lib/jetty-server-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jetty.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-continuation-${jetty.ver}.jar" tofile="jettylib/jetty-continuation.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-deploy-${jetty.ver}.jar" tofile="jettylib/jetty-deploy.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-http-${jetty.ver}.jar" tofile="jettylib/jetty-http.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-io-${jetty.ver}.jar" tofile="jettylib/jetty-io.jar" />
<!-- comment out above line and uncomment below and the patches section further down if we need patches -->
<!--
<jar destfile="jettylib/jetty-io.jar" manifest="${jetty.base}/lib/jetty-io-${jetty.ver}.jar" filesetmanifest="mergewithoutmain" >
<zipfileset excludes="**/SslConnection*.class" src="${jetty.base}/lib/jetty-io-${jetty.ver}.jar" />
<zipfileset src="build/jetty-io-patch.jar" />
</jar>
-->
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-jmx-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jmx.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-rewrite-${jetty.ver}.jar" tofile="jettylib/jetty-rewrite-handler.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-security-${jetty.ver}.jar" tofile="jettylib/jetty-security.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-servlet-${jetty.ver}.jar" tofile="jettylib/jetty-servlet.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-servlets-${jetty.ver}.jar" tofile="jettylib/jetty-servlets.jar" />
<!--
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" tofile="jettylib/jetty-util.jar" />
-->
<!-- comment out above line and uncomment below and the patches section further down if we need patches -->
<jar destfile="jettylib/jetty-util.jar" manifest="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" filesetmanifest="mergewithoutmain" >
<zipfileset excludes="**/JavaVersion.class" src="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" />
<zipfileset src="build/jetty-util-patch.jar" />
<zipfileset src="${jetty.base}/lib/jetty-ee-${jetty.ver}.jar" />
<zipfileset src="${jetty.base}/lib/jetty-session-${jetty.ver}.jar" />
<zipfileset src="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" />
<zipfileset src="${jetty.base}/lib/logging/slf4j-api-2.0.17.jar" />
</jar>
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-webapp-${jetty.ver}.jar" tofile="jettylib/jetty-webapp.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-xml-${jetty.ver}.jar" tofile="jettylib/jetty-xml.jar" />
<jar destfile="jettylib/jetty-java5-threadpool.jar" >
<manifest>
@@ -203,11 +188,33 @@
<attribute name="Note" value="Intentionally empty" />
</manifest>
</jar>
<jar destfile="jettylib/jetty-continuation.jar" >
<manifest>
<attribute name="Note" value="Intentionally empty" />
</manifest>
</jar>
</target>
<!--
Jetty files only, files that ARE NOT in the libjetty12-java Debian package.
These are built whether with-libjetty12-java is set or not.
Debian libjetty12-java does NOT include the ee8 jars,
so we keep them all together here, for ease in
handling both the Debian and non-Debian build cases.
-->
<target name="copyJettylib1B" depends="extractJettylib, buildPatches" >
<jar destfile="jettylib/jetty-webapp.jar" manifest="${jetty.base}/lib/jetty-ee8-webapp-${jetty.ver}.jar" filesetmanifest="mergewithoutmain" >
<zipfileset src="${jetty.base}/lib/jetty-ee8-nested-${jetty.ver}.jar" />
<zipfileset src="${jetty.base}/lib/jetty-ee8-security-${jetty.ver}.jar" />
<zipfileset src="${jetty.base}/lib/jetty-ee8-webapp-${jetty.ver}.jar" />
</jar>
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-ee8-servlet-${jetty.ver}.jar" tofile="jettylib/jetty-servlet.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-ee8-servlets-${jetty.ver}.jar" tofile="jettylib/jetty-servlets.jar" />
</target>
<!--
Make javax.servlet.jar.
If with-libtomcat8-java or with-libtomcat9-java but not with-libjetty9-java, we don't do this.
If with-libtomcat9-java but not with-libjetty12-java, we don't do this.
copyTomcatLib1 dependency to set the with-libtomcat-java variable.
-->
<target name="copyJettylib2" depends="extractJettylib, copyTomcatLib1" unless="${with-libtomcat-java}" >
@@ -228,7 +235,7 @@
<!-- In Debian packages they are found in /usr/share/java/tomcat8-servlet-api.jar in the libtomcat8-java package -->
<!-- javax/servlet/jsp/resources are dups of those in apache-jsp jar -->
<!--
<zipfileset includes="javax/**/*" src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-jsp-8.0.33.jar"/>
<zipfileset includes="javax/**/*" src="${jetty.base}/lib/ee8-apache-jsp/org.mortbay.jasper.apache-jsp-9.0.96.jar"/>
<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" />
-->
@@ -245,10 +252,10 @@
</target>
<!-- Copy jetty-apache-jsp.jar -->
<!-- ONLY if with-libtomcat8-java but NOT with-libjetty9-java (wheezy/jessie configuration) -->
<!-- If neither with-libtomcat8-java nor with-libjetty9-java, it's merged into jasper-runtime.jar in the copyTomcatLib2 target below -->
<!-- ONLY if with-libtomcat9-java but NOT with-libjetty12-java -->
<!-- If neither with-libtomcat9-java nor with-libjetty12-java, it's merged into jasper-runtime.jar in the copyTomcatLib2 target below -->
<target name="copyJettylib3" depends="extractJettylib, copyTomcatLib1" if="${with-libtomcat-without-libjetty}" >
<copy preservelastmodified="true" file="${jetty.base}/lib/apache-jsp/org.eclipse.jetty.apache-jsp-${jetty.ver}.jar" tofile="jettylib/jetty-apache-jsp.jar" />
<copy preservelastmodified="true" file="${jetty.base}/lib/jetty-ee8-apache-jsp-${jetty.ver}.jar" tofile="jettylib/jetty-apache-jsp.jar" />
</target>
<!-- Tomcat.
@@ -281,7 +288,7 @@
<and>
<istrue value="${with-libtomcat-java}" />
<not>
<istrue value="${with-libjetty9-java}" />
<istrue value="${with-libjetty12-java}" />
</not>
</and>
</condition>
@@ -330,7 +337,7 @@
<!-- For both Apache in Jetty package and Apache package versions -->
<!-- required Jetty initializer (see RouterConsoleRunner) -->
<zipfileset src="${jetty.base}/lib/apache-jsp/org.eclipse.jetty.apache-jsp-${jetty.ver}.jar"/>
<zipfileset src="${jetty.base}/lib/jetty-ee8-apache-jsp-${jetty.ver}.jar"/>
<!-- Apache in Jetty package version -->
<!-- Also includes javax.servlet.jsp.*, this is copied into javax.servlet.jar above -->
@@ -485,13 +492,13 @@
</target>
<!-- empty, uncomment below if needed -->
<target name="buildPatches" unless="${with-libjetty12-java}" />
<!--
<target name="buildPatches" unless="${with-libjetty9-java}" />
<target name="buildPatches" depends="jarPatches" unless="${with-libjetty12-java}" />
-->
<target name="buildPatches" depends="jarPatches" unless="${with-libjetty9-java}" />
<target name="compilePatches" unless="${with-libjetty9-java}" >
<target name="compilePatches" unless="${with-libjetty12-java}" >
<mkdir dir="./build" />
<mkdir dir="./build/objPatches" />
<javac
@@ -532,7 +539,7 @@
<target name="jarPatchesUpToDate" >
<condition property="jarPatches.uptodate" >
<or>
<equals arg1="${with-libjetty9-java}" arg2="true" />
<equals arg1="${with-libjetty12-java}" arg2="true" />
<uptodate property="jarPatches.uptodate" targetfile="jettylib/jetty-i2p.jar" >
<srcfiles dir= "build/objPatches" includes="**/*.class" />
<!--

View File

@@ -19,8 +19,10 @@ import java.nio.channels.ClosedChannelException;
import net.i2p.I2PAppContext;
import net.i2p.util.Log;
import org.slf4j.Logger;
import org.slf4j.Marker;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.log.Logger;
/**
* Modified from Jetty 6.1.26 StdErrLog.java and Slf4jLog.java
@@ -281,4 +283,106 @@ public class I2PLogger implements Logger
public void debug(String msg, long arg) {
debug(msg, Long.valueOf(arg), null);
}
/**
* All of the following
* @since Jetty 12
*/
public void debug(Marker marker, String msg) { debug(msg); }
public void debug(Marker marker, String format, Object arg) { debug(format, arg); }
public void debug(Marker marker, String format, Object... arguments) { debug(format, arguments); }
public void debug(Marker marker, String format, Object arg1, Object arg2) { debug(format, arg1, arg2); }
public void debug(Marker marker, String msg, Throwable t) { debug(msg, t); }
public void error(Marker marker, String msg) { error(msg); }
public void error(Marker marker, String format, Object arg) { error(format, arg); }
public void error(Marker marker, String format, Object... arguments) { error(format, arguments); }
public void error(Marker marker, String format, Object arg1, Object arg2) { error(format, arg1, arg2); }
public void error(Marker marker, String msg, Throwable t) { error(msg, t); }
public void info(Marker marker, String msg) { info(msg); }
public void info(Marker marker, String format, Object arg) { info(format, arg); }
public void info(Marker marker, String format, Object... arguments) { info(format, arguments); }
public void info(Marker marker, String format, Object arg1, Object arg2) { info(format, arg1, arg2); }
public void info(Marker marker, String msg, Throwable t) { info(msg, t); }
public void trace(Marker marker, String msg) { trace(msg); }
public void trace(Marker marker, String format, Object arg) { trace(format, arg); }
public void trace(Marker marker, String format, Object... arguments) { trace(format, arguments); }
public void trace(Marker marker, String format, Object arg1, Object arg2) { trace(format, arg1, arg2); }
public void trace(Marker marker, String msg, Throwable t) { trace(msg, t); }
public void warn(Marker marker, String msg) { warn(msg); }
public void warn(Marker marker, String format, Object arg) { warn(format, arg); }
public void warn(Marker marker, String format, Object... arguments) { warn(format, arguments); }
public void warn(Marker marker, String format, Object arg1, Object arg2) { warn(format, arg1, arg2); }
public void warn(Marker marker, String msg, Throwable t) { warn(msg, t); }
public boolean isDebugEnabled(Marker marker) { return isDebugEnabled(); }
public boolean isErrorEnabled(Marker marker) { return isErrorEnabled(); }
public boolean isInfoEnabled(Marker marker) { return isInfoEnabled(); }
public boolean isTraceEnabled(Marker marker) { return isTraceEnabled(); }
public boolean isWarnEnabled(Marker marker) { return isWarnEnabled(); }
public boolean isErrorEnabled() { return _log.shouldError(); }
public boolean isInfoEnabled() { return _log.shouldInfo(); }
public boolean isTraceEnabled() { return _log.shouldDebug(); }
public boolean isWarnEnabled() { return _log.shouldWarn(); }
public void trace(String msg) { debug(msg); }
public void trace(String format, Object arg) { debug(format, arg); }
public void trace(String format, Object... arguments) { debug(format, arguments); }
public void trace(String format, Object arg1, Object arg2) { debug(format, arg1, arg2); }
public void trace(String msg, Throwable t) { debug(msg, t); }
public void debug(String msg, Object arg) { debug(msg, arg, null); }
public void info(String msg, Object arg) { info(msg, arg, null); }
public void warn(String msg, Object arg) { warn(msg, arg, null); }
public void debug(String msg) { debug(msg, null, null); }
public void info(String msg) { info(msg, null, null); }
public void warn(String msg) { warn(msg, null, null); }
public void error(String msg,Object arg0, Object arg1)
{
if (arg0 == null && arg1 == null) {
_log.error(msg);
} else if (arg0 != null && arg1 == null && arg0 instanceof Throwable) {
error(msg, (Throwable) arg0);
} else {
format(msg,arg0,arg1);
if (arg1 != null && arg1 instanceof Throwable)
_log.error(_buffer.toString(), (Throwable) arg1);
else
_log.error(_buffer.toString());
}
}
public void error(String msg)
{
_log.error(msg);
}
public void error(String msg, Throwable th)
{
_log.error(msg, th);
}
public void error(Throwable thrown)
{
error("", thrown);
}
public void error(String msg, Object arg)
{
error(msg, arg, null);
}
public void error(String msg, Object... args)
{
Object a1 = args.length > 0 ? args[0] : null;
Object a2 = args.length > 1 ? args[1] : null;
error(msg, a1, a2);
}
}

View File

@@ -0,0 +1,68 @@
package net.i2p.jetty;
import org.slf4j.ILoggerFactory;
import org.slf4j.IMarkerFactory;
import org.slf4j.Logger;
import org.slf4j.helpers.BasicMarkerFactory;
import org.slf4j.helpers.BasicMDCAdapter;
import org.slf4j.spi.SLF4JServiceProvider;
import org.slf4j.spi.MDCAdapter;
/**
* An SLF4J Service Provider logging to router log with levels,
* replacing Jetty's Service Provider that logs to stderr
* (wrapper log).
*
* As this is a SLF4JServiceProvider, it requires SLF4J 2.0.x.
* It is enabled by setting the environment as follows:
*
*<pre>
* System.setProperty("slf4j.provider", "net.i2p.jetty.I2PLoggingServiceProvider");
*</pre>
*
* We do this in RouterConsoleRunner and in i2psnark RunStandalone.
*
* @since Jetty 12
*/
public class I2PLoggingServiceProvider implements SLF4JServiceProvider {
private final ILoggerFactory lf;
private final IMarkerFactory mf;
private final MDCAdapter md;
public I2PLoggingServiceProvider() {
lf = new LoggerFactory();
mf = new BasicMarkerFactory();
md = new BasicMDCAdapter();
}
public ILoggerFactory getLoggerFactory() {
return lf;
}
public IMarkerFactory getMarkerFactory() {
return mf;
}
public MDCAdapter getMDCAdapter() {
return md;
}
public String getRequestedApiVersion() {
return "2.0.999";
}
public void initialize() {}
private static class LoggerFactory implements ILoggerFactory {
private final Logger logger;
public LoggerFactory() {
logger = new I2PLogger();
}
public Logger getLogger(String name) {
return logger;
}
}
}

View File

@@ -17,23 +17,19 @@ package net.i2p.jetty;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
//import java.io.Writer; // As of Jetty 9.4.15, RequestLog interface has a Writer subinterface
import java.util.ArrayList;
import java.util.Locale;
import java.util.TimeZone;
import javax.servlet.http.Cookie;
import org.eclipse.jetty.http.PathMap;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.RequestLog;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.DateCache;
import org.eclipse.jetty.util.RolloverFileOutputStream;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
/**
* This {@link RequestLog} implementation outputs logs in the pseudo-standard NCSA common log format.
@@ -80,10 +76,7 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
private transient OutputStream _out;
private transient OutputStream _fileOut;
private transient DateCache _logDateCache;
private transient PathMap<String> _ignorePathMap;
private transient java.io.Writer _writer;
private transient ArrayList<Utf8StringBuilder> _buffers;
private transient char[] _copy;
public I2PRequestLog()
@@ -259,68 +252,56 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
try
{
if (_ignorePathMap != null && _ignorePathMap.getMatch(request.getRequestURI()) != null)
return;
if (_fileOut == null)
return;
Utf8StringBuilder u8buf;
StringBuilder buf;
synchronized(_writer)
{
int size=_buffers.size();
u8buf = size==0?new Utf8StringBuilder(160):_buffers.remove(size-1);
buf = u8buf.getStringBuilder();
}
synchronized(buf) // for efficiency until we can use StringBuilder
{
StringBuilder buf = new StringBuilder(160);
if (_logServer)
{
buf.append(request.getServerName());
buf.append(Request.getServerName(request));
buf.append(' ');
}
String addr = null;
if (_preferProxiedForAddress)
{
addr = request.getHeader("X-Forwarded-For");
addr = request.getHeaders().get("X-Forwarded-For");
}
if (addr == null) {
if (_b64) {
addr = request.getHeader("X-I2P-DestHash");
addr = request.getHeaders().get("X-I2P-DestHash");
if (addr != null)
addr += ".i2p";
} else {
// 52chars.b32.i2p
addr = request.getHeader("X-I2P-DestB32");
addr = request.getHeaders().get("X-I2P-DestB32");
}
if (addr == null)
addr = request.getRemoteAddr();
addr = Request.getRemoteAddr(request);
}
buf.append(addr);
buf.append(" - ");
String user = request.getRemoteUser();
String user = request.getHttpURI().getUser();
buf.append((user == null)? " - " : user);
buf.append(" [");
if (_logDateCache!=null)
buf.append(_logDateCache.format(request.getTimeStamp()));
buf.append(_logDateCache.format(Request.getTimeStamp(request)));
else
//buf.append(request.getTimeStampBuffer().toString());
// TODO SimpleDateFormat or something
buf.append(request.getTimeStamp());
buf.append(Request.getTimeStamp(request));
buf.append("] \"");
buf.append(request.getMethod());
buf.append(' ');
u8buf.append(request.getRequestURI());
buf.append(request.getHttpURI().getPathQuery());
buf.append(' ');
buf.append(request.getProtocol());
buf.append(request.getConnectionMetaData().getProtocol());
buf.append("\" ");
int status = response.getStatus();
if (status<=0)
@@ -330,18 +311,7 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
buf.append((char)('0'+(status%10)));
long responseLength=response.getContentCount();
// The above is what Jetty used before 9, but now
// it often (for large content?) returns 0 for non-cgi responses.
// Now, Jetty uses getLongContentLength(), but according to
// these threads it returns 0 for streaming (cgi) responses.
// So we take whichever one is nonzero, if the result was 200.
// See:
// https://dev.eclipse.org/mhonarc/lists/jetty-dev/msg02261.html
// and followups including this workaround:
// https://dev.eclipse.org/mhonarc/lists/jetty-dev/msg02267.html
if (responseLength == 0 && status == 200 && !"HEAD".equals(request.getMethod()))
responseLength = response.getLongContentLength();
long responseLength = Response.getContentBytesWritten(response);
if (responseLength >=0)
{
buf.append(' ');
@@ -364,64 +334,30 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
else
buf.append(" - ");
}
if (!_extended && !_logCookies && !_logLatency)
{
synchronized(_writer)
{
buf.append(System.getProperty("line.separator", "\n"));
int l=buf.length();
if (l>_copy.length)
l=_copy.length;
buf.getChars(0,l,_copy,0);
_writer.write(_copy,0,l);
_writer.write(buf.toString());
_writer.flush();
u8buf.reset();
_buffers.add(u8buf);
}
}
else
{
synchronized(_writer)
{
int l=buf.length();
if (l>_copy.length)
l=_copy.length;
buf.getChars(0,l,_copy,0);
_writer.write(_copy,0,l);
u8buf.reset();
_buffers.add(u8buf);
_writer.write(buf.toString());
// TODO do outside synchronized scope
if (_extended)
logExtended(request, response, _writer);
// TODO do outside synchronized scope
if (_logCookies)
{
Cookie[] cookies = request.getCookies();
if (cookies == null || cookies.length == 0)
_writer.write(" -");
else
{
_writer.write(" \"");
for (int i = 0; i < cookies.length; i++)
{
if (i != 0)
_writer.write(';');
_writer.write(cookies[i].getName());
_writer.write('=');
_writer.write(cookies[i].getValue());
}
_writer.write('\"');
}
}
if (_logLatency)
{
_writer.write(' ');
_writer.write(Long.toString(System.currentTimeMillis() - request.getTimeStamp()));
_writer.write(Long.toString(System.currentTimeMillis() - Request.getTimeStamp(request)));
}
_writer.write(System.getProperty("line.separator", "\n"));
@@ -431,7 +367,8 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
}
catch (IOException e)
{
Log.getLogger((String)null).warn(e);
System.out.println(e.toString());
e.printStackTrace();
}
}
@@ -441,7 +378,7 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
Response response,
java.io.Writer writer) throws IOException
{
String referer = request.getHeader("Referer");
String referer = request.getHeaders().get("Referer");
if (referer == null)
writer.write("\"-\" ");
else
@@ -451,7 +388,7 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
writer.write("\" ");
}
String agent = request.getHeader("User-Agent");
String agent = request.getHeaders().get("User-Agent");
if (agent == null)
writer.write("\"-\" ");
else
@@ -474,25 +411,13 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
{
_fileOut = new RolloverFileOutputStream(_filename,_append,_retainDays,TimeZone.getTimeZone(_logTimeZone),_filenameDateFormat,null);
_closeOut = true;
Log.getLogger((String)null).info("Opened "+getDatedFilename());
}
else
_fileOut = System.err;
_out = _fileOut;
if (_ignorePaths != null && _ignorePaths.length > 0)
{
_ignorePathMap = new PathMap<String>();
for (int i = 0; i < _ignorePaths.length; i++)
_ignorePathMap.put(_ignorePaths[i], _ignorePaths[i]);
}
else
_ignorePathMap = null;
_writer = new OutputStreamWriter(_out, "UTF-8");
_buffers = new ArrayList<Utf8StringBuilder>();
_copy = new char[1024];
super.doStart();
}
@@ -500,17 +425,15 @@ public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
protected void doStop() throws Exception
{
super.doStop();
try {if (_writer != null) _writer.flush();} catch (IOException e) {Log.getLogger((String)null).ignore(e);}
try {if (_writer != null) _writer.flush();} catch (IOException e) {}
if (_out != null && _closeOut)
try {_out.close();} catch (IOException e) {Log.getLogger((String)null).ignore(e);}
try {_out.close();} catch (IOException e) {}
_out = null;
_fileOut = null;
_closeOut = false;
_logDateCache = null;
_writer = null;
_buffers = null;
_copy = null;
}
/* ------------------------------------------------------------ */

View File

@@ -40,8 +40,10 @@ import net.i2p.util.VersionComparator;
import org.eclipse.jetty.server.AbstractNetworkConnector;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.resource.ResourceFactory;
import org.eclipse.jetty.xml.XmlConfiguration;
/**
@@ -141,7 +143,7 @@ public class JettyStart implements ClientApp {
}
} else {
URL configUrl = f.toURI().toURL();
XmlConfiguration configuration = new XmlConfiguration(configUrl);
XmlConfiguration configuration = new XmlConfiguration(ResourceFactory.root().newResource(configUrl));
if (last!=null)
configuration.getIdMap().putAll(last.getIdMap());
if (properties.size()>0) {
@@ -181,7 +183,9 @@ public class JettyStart implements ClientApp {
if (!lc.isRunning()) {
if (lc instanceof Server) {
Server server = (Server) lc;
server.insertHandler(new XI2PLocationFilter());
Handler.Wrapper filter = new XI2PLocationFilter();
filter.setHandler(server.getHandler());
server.setHandler(filter);
}
try {
lc.start();

View File

@@ -43,25 +43,6 @@ public class JettyXmlConfigurationParser
private static XmlParser initParser()
{
XmlParser parser = new XmlParser();
URL config60 = Loader.getResource(XmlConfiguration.class, "org/eclipse/jetty/xml/configure_6_0.dtd");
URL config76 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_7_6.dtd");
URL config90 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_9_0.dtd");
parser.redirectEntity("configure.dtd",config90);
parser.redirectEntity("configure_1_0.dtd",config60);
parser.redirectEntity("configure_1_1.dtd",config60);
parser.redirectEntity("configure_1_2.dtd",config60);
parser.redirectEntity("configure_1_3.dtd",config60);
parser.redirectEntity("configure_6_0.dtd",config60);
parser.redirectEntity("configure_7_6.dtd",config76);
parser.redirectEntity("configure_9_0.dtd",config90);
parser.redirectEntity("http://jetty.mortbay.org/configure.dtd",config90);
parser.redirectEntity("http://jetty.eclipse.org/configure.dtd",config90);
parser.redirectEntity("http://www.eclipse.org/jetty/configure.dtd",config90);
parser.redirectEntity("-//Mort Bay Consulting//DTD Configure//EN",config90);
parser.redirectEntity("-//Jetty//Configure//EN",config90);
return parser;
}

View File

@@ -1,49 +1,6 @@
// Contains code from Jetty 9.2.21:
//
// ========================================================================
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package net.i2p.servlet;
import java.io.IOException;
import java.text.Collator;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import javax.servlet.ServletContext;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollection;
import net.i2p.data.DataHelper;
import org.eclipse.jetty.ee8.servlet.DefaultServlet;
/**
* Extends DefaultServlet to set locale for the displayed time of directory listings,
@@ -54,318 +11,10 @@ import net.i2p.data.DataHelper;
*/
public class I2PDefaultServlet extends DefaultServlet
{
// shadows of private fields in super
private ContextHandler _contextHandler;
private boolean _dirAllowed=true;
private Resource _resourceBase;
private Resource _stylesheet;
private static final String FORMAT = "yyyy-MM-dd HH:mm";
/**
* Overridden to save local copies of dirAllowed, locale, resourceBase, and stylesheet.
* Calls super.
* @since Jetty 12
*/
@Override
public void init()
throws UnavailableException
{
super.init();
_dirAllowed=getInitBoolean("dirAllowed",_dirAllowed);
String rb=getInitParameter("resourceBase");
if (rb!=null)
{
try{_resourceBase=_contextHandler.newResource(rb);}
catch (Exception e)
{
throw new UnavailableException(e.toString());
}
}
String css=getInitParameter("stylesheet");
try
{
if(css!=null)
{
_stylesheet = Resource.newResource(css);
if(!_stylesheet.exists())
{
_stylesheet = null;
}
}
if(_stylesheet == null)
{
_stylesheet = Resource.newResource(this.getClass().getResource("/jetty-dir.css"));
}
}
catch(Exception e)
{
}
}
/**
* Overridden to save the result
* Calls super.
*/
@Override
protected ContextHandler initContextHandler(ServletContext servletContext)
{
ContextHandler rv = super.initContextHandler(servletContext);
_contextHandler = rv;
return rv;
}
/* copied from DefaultServlet unchanged */
private boolean getInitBoolean(String name, boolean dft)
{
String value=getInitParameter(name);
if (value==null || value.length()==0)
return dft;
return (value.startsWith("t")||
value.startsWith("T")||
value.startsWith("y")||
value.startsWith("Y")||
value.startsWith("1"));
}
/**
* Copied and modified from DefaultServlet.java.
* Overridden to set the Locale for the dates.
*
* Get the resource list as a HTML directory listing.
*/
@Override
protected void sendDirectory(HttpServletRequest request,
HttpServletResponse response,
Resource resource,
String pathInContext)
throws IOException
{
if (!_dirAllowed)
{
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
byte[] data=null;
String base = URIUtil.addPaths(request.getRequestURI(),URIUtil.SLASH);
//If the DefaultServlet has a resource base set, use it
if (_resourceBase != null)
{
// handle ResourceCollection
if (_resourceBase instanceof ResourceCollection)
resource=_resourceBase.addPath(pathInContext);
}
//Otherwise, try using the resource base of its enclosing context handler
else if (_contextHandler.getBaseResource() instanceof ResourceCollection)
resource=_contextHandler.getBaseResource().addPath(pathInContext);
String dir = getListHTML(resource, base, pathInContext.length()>1);
if (dir==null)
{
response.sendError(HttpServletResponse.SC_FORBIDDEN,
"No directory");
return;
}
data=dir.getBytes("UTF-8");
response.setContentType("text/html; charset=UTF-8");
response.setContentLength(data.length);
response.getOutputStream().write(data);
}
/**
* Copied and modified from Resource.java
* Modified to set the Locale for the dates.
*
* Get the resource list as a HTML directory listing.
* @param base The base URL
* @param parent True if the parent directory should be included
* @return String of HTML
*/
private static String getListHTML(Resource res, String base, boolean parent)
throws IOException
{
base=URIUtil.canonicalPath(base);
if (base==null || !res.isDirectory())
return null;
String[] ls = res.list();
if (ls==null)
return null;
DataHelper.sort(ls, new FileComparator(res));
String decodedBase = URIUtil.decodePath(base);
String title = "Directory: "+deTag(decodedBase);
StringBuilder buf=new StringBuilder(4096);
buf.append("<HTML><HEAD>");
buf.append("<LINK HREF=\"").append("jetty-dir.css").append("\" REL=\"stylesheet\" TYPE=\"text/css\"/><TITLE>");
buf.append(title);
buf.append("</TITLE></HEAD><BODY>\n<H1>");
buf.append(title);
buf.append("</H1>\n<TABLE BORDER=0>\n");
if (parent)
{
buf.append("<TR><TD><A HREF=\"");
buf.append(URIUtil.addPaths(base,"../"));
buf.append("\">Parent Directory</A></TD><TD></TD><TD></TD></TR>\n");
}
String encodedBase = hrefEncodeURI(base);
DateFormat dfmt = new SimpleDateFormat(FORMAT, Locale.UK);
TimeZone utc = TimeZone.getTimeZone("GMT");
dfmt.setTimeZone(utc);
for (int i=0 ; i< ls.length ; i++)
{
Resource item;
try {
item = res.addPath(ls[i]);
} catch (IOException ioe) {
System.out.println("Skipping file in directory listing: " + ioe.getMessage());
continue;
} catch (RuntimeException re) {
// Jetty bug, addPath() argument must be unencoded,
// but does not escape [],so it throws an unchecked exception:
//
// java.nio.file.InvalidPathException:
// Illegal character in path at index xx: file:/home/.../[test].txt: [test].txt
// at org.eclipse.jetty.util.resource.FileResource.addPath(FileResource.java:213)
// ...
//
// Catch here and continue so we show the rest of the listing,
// and don't output the full path in the error page
// TODO actually handle it
System.out.println("Skipping file in directory listing: " + re.getMessage());
continue;
}
buf.append("\n<TR><TD><A HREF=\"");
String path=URIUtil.addPaths(encodedBase,URIUtil.encodePath(ls[i]));
buf.append(path);
boolean isDir = item.isDirectory();
if (isDir && !path.endsWith("/"))
buf.append(URIUtil.SLASH);
buf.append("\">");
buf.append(deTag(ls[i]));
buf.append("</A></TD><TD ALIGN=right>");
if (!isDir) {
buf.append(item.length());
buf.append(" bytes&nbsp;");
}
buf.append("</TD><TD>");
if (!isDir) {
buf.append(dfmt.format(new Date(item.lastModified())));
buf.append(" UTC");
}
buf.append("</TD></TR>");
}
buf.append("</TABLE>\n");
buf.append("</BODY></HTML>\n");
return buf.toString();
}
/**
* I2P
*
* @since 0.9.51
*/
private static class FileComparator implements Comparator<String> {
private final Comparator<Object> _coll;
private final Resource _base;
public FileComparator(Resource base) {
_base = base;
_coll = Collator.getInstance(Locale.US);
}
public int compare(String a, String b) {
try {
Resource ra = _base.addPath(a);
Resource rb = _base.addPath(b);
boolean da = ra.isDirectory();
boolean db = rb.isDirectory();
if (da && !db) return -1;
if (!da && db) return 1;
} catch (Exception e) {
// see above
}
return _coll.compare(a, b);
}
}
/**
* Copied unchanged from Resource.java
*
* Encode any characters that could break the URI string in an HREF.
* Such as &lt;a href="/path/to;&lt;script&gt;Window.alert("XSS"+'%20'+"here");&lt;/script&gt;"&gt;Link&lt;/a&gt;
*
* The above example would parse incorrectly on various browsers as the "&lt;" or '"' characters
* would end the href attribute value string prematurely.
*
* @param raw the raw text to encode.
* @return the defanged text.
*/
private static String hrefEncodeURI(String raw)
{
StringBuffer buf = null;
loop:
for (int i=0;i<raw.length();i++)
{
char c=raw.charAt(i);
switch(c)
{
case '\'':
case '"':
case '<':
case '>':
buf=new StringBuffer(raw.length()<<1);
break loop;
}
}
if (buf==null)
return raw;
for (int i=0;i<raw.length();i++)
{
char c=raw.charAt(i);
switch(c)
{
case '"':
buf.append("%22");
continue;
case '\'':
buf.append("%27");
continue;
case '<':
buf.append("%3C");
continue;
case '>':
buf.append("%3E");
continue;
default:
buf.append(c);
continue;
}
}
return buf.toString();
}
/**
* Copied unchanged from Resource.java
*/
private static String deTag(String raw)
{
return StringUtil.sanitizeXmlString(raw);
public I2PDefaultServlet() {
super(new I2PResourceService());
}
}

View File

@@ -0,0 +1,69 @@
package net.i2p.servlet;
import java.io.File;
import org.eclipse.jetty.ee8.servlet.ErrorPageErrorHandler;
import net.i2p.I2PAppContext;
import net.i2p.util.FileSuffixFilter;
/**
* Customize the error page.
*
* @since Jetty 12
*/
public class I2PErrorHandler extends ErrorPageErrorHandler
{
private final File _docroot;
private static final String RESOURCES = ".resources";
public I2PErrorHandler() {
this(new File(I2PAppContext.getGlobalContext().getConfigDir(), "eepsite/docroot"));
}
public I2PErrorHandler(String docroot) {
this(new File(docroot));
}
public I2PErrorHandler(File docroot) {
super();
_docroot = docroot;
setShowServlet(false);
setShowStacks(false);
setErrorPages();
}
/*
* Add error pages for any nnn.html files found.
* Also for the special files 000.html (default), 4xx.html, and 5xx.html.
*/
private void setErrorPages() {
File dir = new File(_docroot, RESOURCES);
if (!dir.isDirectory())
return;
File[] files = dir.listFiles(new FileSuffixFilter(".html"));
if (files == null)
return;
for (File file : files) {
String name = file.getName();
if (name.equals("000.html")) {
addErrorPage(GLOBAL_ERROR_PAGE, '/' + RESOURCES + "/000.html");
} else if (name.equals("4xx.html")) {
addErrorPage(400, 499, '/' + RESOURCES + "/4xx.html");
} else if (name.equals("5xx.html")) {
addErrorPage(500, 599, '/' + RESOURCES + "/5xx.html");
} else if (name.length() == 8 && (name.startsWith("4") || name.startsWith("5"))) {
int code;
try {
code = Integer.parseInt(name.substring(0, 3));
} catch (NumberFormatException nfe) {
continue;
}
addErrorPage(code, '/' + RESOURCES + '/' + name);
}
}
}
// TODO Overrides
}

View File

@@ -0,0 +1,452 @@
// Adapted from Jetty ResourceService.java and ResourceListing.java
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package net.i2p.servlet;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.text.Collator;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.ee8.nested.ResourceService;
import org.eclipse.jetty.util.Fields;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.UrlEncoded;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollators;
import org.eclipse.jetty.util.resource.Resources;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
/**
* To customize directory listings.
* Used by I2PDefaultServlet.
*
* @since Jetty 12
*/
public class I2PResourceService extends ResourceService {
private static final String FORMAT = "yyyy-MM-dd HH:mm";
/**
* Copied and modified from ResourceService.java.
* Overridden to set the Locale for the dates.
*
* Get the resource list as a HTML directory listing.
*/
@Override
protected void sendDirectory(HttpServletRequest request,
HttpServletResponse response,
Resource resource,
String pathInContext)
throws IOException
{
if (!isDirAllowed())
{
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
byte[] data;
String base = URIUtil.addEncodedPaths(request.getRequestURI(), "/");
String dir = getListHTML(resource, base, pathInContext.length() > 1, request.getQueryString());
if (dir == null)
{
response.sendError(HttpServletResponse.SC_FORBIDDEN,
"No directory");
return;
}
data = dir.getBytes(StandardCharsets.UTF_8);
response.setContentType("text/html;charset=utf-8");
response.setContentLength(data.length);
response.getOutputStream().write(data);
}
/**
* Copied and modified from Resource.java (Jetty 9) / ResourceListing.java (Jetty 12).
* Modified to set the Locale for the dates.
*
* Get the resource list as a HTML directory listing.
* @param base The base URL
* @param parent True if the parent directory should be included
* @return String of HTML
* @since Jetty 12 moved from I2PDefaultServlet
*/
private static String getListHTML(Resource resource, String base, boolean parent, String query)
throws IOException
{
// This method doesn't check aliases, so it is OK to canonicalize here.
base = URIUtil.normalizePath(base);
if (base == null)
return null;
if (!Resources.isReadableDirectory(resource))
return null;
List<Resource> listing = resource.list().stream()
.filter(distinctBy(Resource::getFileName))
.collect(Collectors.toCollection(ArrayList::new));
boolean sortOrderAscending = true;
String sortColumn = "N"; // name (or "M" for Last Modified, or "S" for Size)
// check for query
if (query != null)
{
Fields params = new Fields(true);
UrlEncoded.decodeUtf8To(query, 0, query.length(), params);
String paramO = params.getValue("O");
String paramC = params.getValue("C");
if (StringUtil.isNotBlank(paramO))
{
switch (paramO)
{
case "A" -> sortOrderAscending = true;
case "D" -> sortOrderAscending = false;
}
}
if (StringUtil.isNotBlank(paramC))
{
if (paramC.equals("N") || paramC.equals("M") || paramC.equals("S"))
{
sortColumn = paramC;
}
}
}
// Perform sort
Comparator<? super Resource> sort;
switch (sortColumn)
{
case "M": sort = ResourceCollators.byLastModified(sortOrderAscending);
break;
case "S": sort = new SizeComparator();
if (!sortOrderAscending)
sort = sort.reversed();
break;
default: sort = new FileComparator();
if (!sortOrderAscending)
sort = sort.reversed();
break;
}
DataHelper.sort(listing, sort);
String decodedBase = URIUtil.decodePath(base);
String title = "Directory: " + deTag(decodedBase);
StringBuilder buf = new StringBuilder(4096);
// Doctype Declaration + XHTML. The spec says the encoding MUST be "utf-8" in all cases at it is ignored;
// see: https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-charset
buf.append("""
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
""");
// HTML Header
buf.append("<head>\n");
buf.append("<link href=\"jetty-dir.css\" rel=\"stylesheet\" />\n");
buf.append("<title>");
buf.append(title);
buf.append("</title>\n");
buf.append("</head>\n");
// HTML Body
buf.append("<body>\n");
buf.append("<h1 class=\"title\">").append(title).append("</h1>\n");
// HTML Table
final String ARROW_DOWN = "&nbsp; &#8681;";
final String ARROW_UP = "&nbsp; &#8679;";
buf.append("<table class=\"listing\">\n");
buf.append("<thead>\n");
String arrow = "";
String order = "A";
if (sortColumn.equals("N"))
{
if (sortOrderAscending)
{
order = "D";
arrow = ARROW_UP;
}
else
{
order = "A";
arrow = ARROW_DOWN;
}
}
buf.append("<tr><th class=\"name\"><a href=\"?C=N&amp;O=").append(order).append("\">");
buf.append("Name").append(arrow);
buf.append("</a></th>");
arrow = "";
order = "A";
if (sortColumn.equals("M"))
{
if (sortOrderAscending)
{
order = "D";
arrow = ARROW_UP;
}
else
{
order = "A";
arrow = ARROW_DOWN;
}
}
buf.append("<th class=\"lastmodified\"><a href=\"?C=M&amp;O=").append(order).append("\">");
buf.append("Last Modified (UTC)").append(arrow);
buf.append("</a></th>");
arrow = "";
order = "A";
if (sortColumn.equals("S"))
{
if (sortOrderAscending)
{
order = "D";
arrow = ARROW_UP;
}
else
{
order = "A";
arrow = ARROW_DOWN;
}
}
buf.append("<th class=\"size\"><a href=\"?C=S&amp;O=").append(order).append("\">");
buf.append("Size").append(arrow);
buf.append("</a></th></tr>\n");
buf.append("</thead>\n");
buf.append("<tbody>\n");
String encodedBase = hrefEncodeURI(base);
if (parent)
{
// Name
buf.append("<tr><td class=\"name\"><a href=\"");
// TODO This produces an absolute link from the /context/<listing-dir> path, investigate if we can use relative links reliably now
buf.append(URIUtil.addPaths(encodedBase, "../"));
buf.append("\">Parent Directory</a></td>");
// Last Modified
buf.append("<td class=\"lastmodified\">-</td>");
// Size
buf.append("<td class=\"size\">-</td>");
buf.append("</tr>\n");
}
DateFormat dfmt = new SimpleDateFormat(FORMAT, Locale.UK);
TimeZone utc = TimeZone.getTimeZone("GMT");
dfmt.setTimeZone(utc);
for (Resource item : listing)
{
// Listings always return non-composite Resource entries
String name = item.getFileName();
if (StringUtil.isBlank(name))
continue; // a resource either not backed by a filename (eg: MemoryResource), or has no filename (eg: a segment-less root "/")
// Ensure name has a slash if it's a directory
boolean isDir = item.isDirectory();
if (isDir && !name.endsWith("/"))
name += "/";
// Name
buf.append("<tr><td class=\"name\"><a href=\"");
// TODO should this be a relative link?
String path = URIUtil.addEncodedPaths(encodedBase, URIUtil.encodePath(name));
buf.append(path);
buf.append("\">");
buf.append(deTag(name));
buf.append("&nbsp;</a></td>");
// Last Modified
buf.append("<td class=\"lastmodified\">");
Instant lastModified = item.lastModified();
buf.append(dfmt.format(new Date(lastModified.toEpochMilli())));
buf.append("&nbsp;</td>");
// Size
buf.append("<td class=\"size\">");
if (isDir) {
buf.append('-');
} else {
long length = item.length();
if (length >= 0)
{
buf.append(String.format("%,d bytes", item.length()));
} else {
buf.append('-');
}
}
buf.append("</td></tr>\n");
}
buf.append("</tbody>\n");
buf.append("</table>\n");
buf.append("</body></html>\n");
return buf.toString();
}
private static <T> Predicate<T> distinctBy(Function<? super T, Object> keyExtractor)
{
HashSet<Object> map = new HashSet<>();
return t -> map.add(keyExtractor.apply(t));
}
/**
* I2P
*
* @since 0.9.51
*/
private static class FileComparator implements Comparator<Resource> {
private final Comparator<Object> _coll;
public FileComparator() {
_coll = Collator.getInstance(Locale.US);
}
public int compare(Resource ra, Resource rb) {
try {
boolean da = ra.isDirectory();
boolean db = rb.isDirectory();
if (da && !db) return -1;
if (!da && db) return 1;
} catch (Exception e) {
// see above
}
return _coll.compare(ra.toString(), rb.toString());
}
}
/**
* I2P
*
* @since Jetty 12
*/
private static class SizeComparator implements Comparator<Resource> {
private final Comparator<Object> _coll;
public SizeComparator() {
_coll = Collator.getInstance(Locale.US);
}
public int compare(Resource ra, Resource rb) {
try {
boolean da = ra.isDirectory();
boolean db = rb.isDirectory();
long sa = da ? -1 : ra.length();
long sb = db ? -1 : rb.length();
int rv = Long.compare(sa, sb);
if (rv != 0) return rv;
} catch (Exception e) {
// see above
}
return _coll.compare(ra.toString(), rb.toString());
}
}
/**
* Copied unchanged from Resource.java
*
* Encode any characters that could break the URI string in an HREF.
* Such as &lt;a href="/path/to;&lt;script&gt;Window.alert("XSS"+'%20'+"here");&lt;/script&gt;"&gt;Link&lt;/a&gt;
*
* The above example would parse incorrectly on various browsers as the "&lt;" or '"' characters
* would end the href attribute value string prematurely.
*
* @param raw the raw text to encode.
* @return the defanged text.
* @since Jetty 12 moved from I2PDefaultServlet
*/
private static String hrefEncodeURI(String raw)
{
StringBuffer buf = null;
loop:
for (int i=0;i<raw.length();i++)
{
char c=raw.charAt(i);
switch(c)
{
case '\'':
case '"':
case '<':
case '>':
buf=new StringBuffer(raw.length()<<1);
break loop;
}
}
if (buf==null)
return raw;
for (int i=0;i<raw.length();i++)
{
char c=raw.charAt(i);
switch(c)
{
case '"':
buf.append("%22");
continue;
case '\'':
buf.append("%27");
continue;
case '<':
buf.append("%3C");
continue;
case '>':
buf.append("%3E");
continue;
default:
buf.append(c);
continue;
}
}
return buf.toString();
}
/**
* Copied unchanged from Resource.java
* @since Jetty 12 moved from I2PDefaultServlet
*/
private static String deTag(String raw)
{
return StringUtil.sanitizeXmlString(raw);
}
}

View File

@@ -1,9 +1,9 @@
package net.i2p.servlet;
import org.apache.tomcat.SimpleInstanceManager;
import org.eclipse.jetty.deploy.providers.WebAppProvider;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.deploy.providers.ContextProvider;
import org.eclipse.jetty.ee8.webapp.Configuration;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
import net.i2p.I2PAppContext;
@@ -22,8 +22,10 @@ public class WebAppProviderConfiguration {
* Modified from routerconsole WebAppStarter.
* MUST be called from jetty.xml after the WebAppProvider is created.
*/
public static void configure(WebAppProvider wap) {
String[] classNames = WebAppContext.getDefaultConfigurationClasses();
public static void configure(ContextProvider wap) {
// Not in Jetty 12 but these are the two defaults
//String[] classNames = WebAppContext.getDefaultConfigurationClasses();
String[] classNames = { "org.eclipse.jetty.ee8.webapp.WebXmlConfiguration", "org.eclipse.jetty.ee8.webapp.JettyWebXmlConfiguration" };
int sz = classNames.length;
String[] newClassNames = new String[sz + 1];
for (int j = 0; j < sz; j++) {
@@ -34,7 +36,8 @@ public class WebAppProviderConfiguration {
// set the temp dir while we're at it,
// so the extracted wars don't end up in /tmp
wap.setTempDir(I2PAppContext.getGlobalContext().getTempDir());
// FIXME
//wap.setTempDir(I2PAppContext.getGlobalContext().getTempDir());
}
public static class WAPConfiguration implements Configuration {
@@ -54,5 +57,15 @@ public class WebAppProviderConfiguration {
public void preConfigure(WebAppContext context) {}
public void postConfigure(WebAppContext context) {}
/**
* @since Jetty 12
*/
public boolean abort(WebAppContext context) { return false; }
/**
* @since Jetty 12
*/
public boolean isEnabledByDefault() { return true; }
}
}

View File

@@ -2,27 +2,19 @@ package net.i2p.servlet.filters;
import java.io.IOException;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Properties;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.util.Callback;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.data.PrivateKeyFile;
import net.i2p.util.Log;
/**
@@ -34,26 +26,25 @@ import net.i2p.util.Log;
*
* @since 0.9.51
*/
public class XI2PLocationFilter extends HandlerWrapper {
public class XI2PLocationFilter extends Handler.Wrapper {
private String X_I2P_Location = null;
private long lastFailure = -1;
private static final long failTimeout = 600000;
private static final String encodeUTF = StandardCharsets.UTF_8.toString();
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(XI2PLocationFilter.class);
private synchronized void setLocation(String xi2plocation) {
if (_log.shouldInfo())
_log.info("Checking X-I2P-Location header prefix" + xi2plocation);
_log.info("Checking X-I2P-Location header prefix: " + xi2plocation);
if (X_I2P_Location != null)
return ;
return;
if (xi2plocation == null)
return ;
return;
if (xi2plocation.equals(""))
return ;
return;
X_I2P_Location = xi2plocation;
if (_log.shouldInfo())
_log.info("Caching X-I2P-Location header prefix" + X_I2P_Location);
_log.info("Caching X-I2P-Location header prefix: " + X_I2P_Location);
}
private synchronized boolean shouldRecheck(){
@@ -81,6 +72,8 @@ public class XI2PLocationFilter extends HandlerWrapper {
File tunnelConfig = new File(configDir, "i2ptunnel.config");
boolean isSingleFile = tunnelConfig.exists();
if (!isSingleFile) {
if (host.startsWith("[") && host.endsWith("]"))
host = host.substring(1, host.length() - 1);
File tunnelConfigD = new File(configDir, "i2ptunnel.config.d");
File[] configFiles = tunnelConfigD.listFiles(new net.i2p.util.FileSuffixFilter(".config"));
if (configFiles == null)
@@ -135,54 +128,57 @@ public class XI2PLocationFilter extends HandlerWrapper {
return null;
}
private synchronized String headerContents(final HttpServletRequest httpRequest) {
/**
* @return the value for the X-I2P-Location header, or null
*/
private synchronized String headerContents(final Request request) {
HttpURI uri = request.getHttpURI();
if (X_I2P_Location != null) {
String scheme = httpRequest.getScheme();
String scheme = uri.getScheme();
if (scheme == null)
scheme = "";
String path = httpRequest.getPathInfo();
if (path == null)
path = "";
String query = httpRequest.getQueryString();
if (query == null)
query = "";
try {
if (query.equals("")) {
URI uri = new URI(scheme, X_I2P_Location, path, null);
String encodedURL = uri.toASCIIString();
return encodedURL;
} else {
URI uri = new URI(scheme, X_I2P_Location, path, query, null);
String encodedURL = uri.toASCIIString();
return encodedURL;
}
}catch(URISyntaxException use){
return null;
}
// encoded
String path = uri.getPath();
if (path == null)
path = "/";
// encoded
String query = uri.getQuery();
int port = uri.getPort();
StringBuilder buf = new StringBuilder(256);
buf.append(scheme)
.append("://")
.append(X_I2P_Location);
if (port > 0)
buf.append(':').append(port);
buf.append(path);
if (query != null)
buf.append('?').append(query);
return buf.toString();
}
return null;
}
@Override
public void handle(final String target, final Request request, final HttpServletRequest httpRequest, HttpServletResponse httpResponse)
throws IOException, ServletException {
final String hashHeader = httpRequest.getHeader("X-I2P-DestHash");
public boolean handle(final Request request, final Response response, Callback callback)
throws Exception {
final String hashHeader = request.getHeaders().get("X-I2P-DestHash");
if (hashHeader == null) {
if (shouldRecheck()) {
String xi2plocation = getXI2PLocation(request.getLocalAddr(), String.valueOf(request.getLocalPort()));
String xi2plocation = getXI2PLocation(Request.getLocalAddr(request), String.valueOf(Request.getLocalPort(request)));
if (_log.shouldInfo())
_log.info("Checking X-I2P-Location header IP " + request.getLocalAddr() + " port " + request.getLocalPort() + " prefix " + xi2plocation);
setLocation(xi2plocation);
_log.info("Checking X-I2P-Location header: IP " + Request.getLocalAddr(request) + " port " + Request.getLocalPort(request) + " prefix " + xi2plocation);
if (xi2plocation != null)
setLocation(xi2plocation);
}
String headerURL = headerContents(httpRequest);
String headerURL = headerContents(request);
if (headerURL != null) {
if (_log.shouldInfo())
_log.info("Checking X-I2P-Location header" + headerURL);
httpResponse.addHeader("X-I2P-Location", headerURL);
_log.info("Setting X-I2P-Location header: " + headerURL);
response.getHeaders().put("X-I2P-Location", headerURL);
}
}
_handler.handle(target, request, httpRequest, httpResponse);
return super.handle(request, response, callback);
}
}

View File

@@ -1,153 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.util;
/**
* Java Version Utility class.
* <p>Parses java versions to extract a consistent set of version parts</p>
*/
public class JavaVersion
{
/**
* Context attribute that can be set to target a different version of the jvm than the current runtime.
* Acceptable values should correspond to those returned by JavaVersion.getPlatform().
*/
public static final String JAVA_TARGET_PLATFORM = "org.eclipse.jetty.javaTargetPlatform";
public static final JavaVersion VERSION = parse(System.getProperty("java.version"));
public static JavaVersion parse(String v)
{
// $VNUM is a dot-separated list of integers of arbitrary length
String[] split = v.split("[^0-9]");
int len = Math.min(split.length, 3);
int[] version = new int[len];
for (int i = 0; i < len; i++)
{
try
{
version[i] = Integer.parseInt(split[i]);
}
catch (Throwable e)
{
len = i - 1;
break;
}
}
return new JavaVersion(
v,
(version[0] >= 9 || len == 1) ? version[0] : version[1],
version[0],
len > 1 ? version[1] : 0,
len > 2 ? version[2] : 0);
}
private final String version;
private final int platform;
private final int major;
private final int minor;
private final int micro;
private JavaVersion(String version, int platform, int major, int minor, int micro)
{
this.version = version;
this.platform = platform;
this.major = major;
this.minor = minor;
this.micro = micro;
}
/**
* @return the string from which this JavaVersion was created
*/
public String getVersion()
{
return version;
}
/**
* <p>Returns the Java Platform version, such as {@code 8} for JDK 1.8.0_92 and {@code 9} for JDK 9.2.4.</p>
*
* @return the Java Platform version
*/
public int getPlatform()
{
return platform;
}
/**
* <p>Returns the major number version, such as {@code 1} for JDK 1.8.0_92 and {@code 9} for JDK 9.2.4.</p>
*
* @return the major number version
*/
public int getMajor()
{
return major;
}
/**
* <p>Returns the minor number version, such as {@code 8} for JDK 1.8.0_92 and {@code 2} for JDK 9.2.4.</p>
*
* @return the minor number version
*/
public int getMinor()
{
return minor;
}
/**
* <p>Returns the micro number version (aka security number), such as {@code 0} for JDK 1.8.0_92 and {@code 4} for JDK 9.2.4.</p>
*
* @return the micro number version
*/
public int getMicro()
{
return micro;
}
/**
* <p>Returns the update number version, such as {@code 92} for JDK 1.8.0_92 and {@code 0} for JDK 9.2.4.</p>
*
* @return the update number version
*/
@Deprecated
public int getUpdate()
{
return 0;
}
/**
* <p>Returns the remaining string after the version numbers, such as {@code -internal} for
* JDK 1.8.0_92-internal and {@code -ea} for JDK 9-ea, or {@code +13} for JDK 9.2.4+13.</p>
*
* @return the remaining string after the version numbers
*/
@Deprecated
public String getSuffix()
{
return null;
}
@Override
public String toString()
{
return version;
}
}

View File

@@ -473,7 +473,6 @@
<jvmarg value="-Dtomcat.util.scan.StandardJarScanFilter.jarsToSkip=commons-collections.jar,junit.jar,junit4.jar" />
<!-- these are to detect tomcat version and reproducible build setting -->
<jvmarg value="-Dbuild.reproducible=${build.reproducible}" />
<jvmarg value="-Dwith-libtomcat8-java=${with-libtomcat8-java}" />
<jvmarg value="-Dwith-libtomcat9-java=${with-libtomcat9-java}" />
<jvmarg value="-Djasper.jar=../../jetty/jettylib/jasper-runtime.jar" />
<classpath>

View File

@@ -4,10 +4,6 @@ import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.util.Addresses;
@@ -15,7 +11,9 @@ import net.i2p.util.Log;
import net.i2p.util.PortMapper;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
import org.eclipse.jetty.util.Callback;
/**
* Block certain Host headers to prevent DNS rebinding attacks.
@@ -75,14 +73,13 @@ public class HostCheckHandler extends GzipHandler
* redirect HTTP to HTTPS,
* pass everything else to the delegate.
*/
public void handle(String pathInContext,
Request baseRequest,
HttpServletRequest httpRequest,
HttpServletResponse httpResponse)
throws IOException, ServletException
@Override
public boolean handle(Request request,
Response response,
Callback callback)
throws Exception
{
String host = httpRequest.getHeader("Host");
String host = request.getHeaders().get("Host");
if (!allowHost(host)) {
Log log = _context.logManager().getLog(HostCheckHandler.class);
host = DataHelper.stripHTML(getHost(host));
@@ -91,29 +88,28 @@ public class HostCheckHandler extends GzipHandler
" add the line \"" + RouterConsoleRunner.PROP_ALLOWED_HOSTS + '=' + host + "\"\n" +
" to advanced configuration and restart.";
log.logAlways(Log.WARN, s);
httpResponse.sendError(403, s);
baseRequest.setHandled(true);
return;
Response.writeError(request, response, callback, 403, s);
return true;
}
// redirect HTTP to HTTPS if available, AND:
// either 1) PROP_REDIRECT is set to true;
// or 2) PROP_REDIRECT is unset and the Upgrade-Insecure-Requests request header is set
// https://w3c.github.io/webappsec-upgrade-insecure-requests/
if (!httpRequest.isSecure()) {
if (!request.isSecure()) {
int httpsPort = _portMapper.getPort(PortMapper.SVC_HTTPS_CONSOLE);
if (httpsPort > 0 && httpRequest.getLocalPort() != httpsPort) {
if (httpsPort > 0 && Request.getLocalPort(request) != httpsPort) {
String redir = _context.getProperty(PROP_REDIRECT);
if (Boolean.parseBoolean(redir) ||
(redir == null && "1".equals(httpRequest.getHeader("Upgrade-Insecure-Requests")))) {
sendRedirect(httpsPort, httpRequest, httpResponse);
baseRequest.setHandled(true);
return;
(redir == null && "1".equals(request.getHeaders().get("Upgrade-Insecure-Requests")))) {
sendRedirect(httpsPort, request, response);
callback.succeeded();
return true;
}
}
}
super.handle(pathInContext, baseRequest, httpRequest, httpResponse);
return super.handle(request, response, callback);
}
/**
@@ -172,11 +168,11 @@ public class HostCheckHandler extends GzipHandler
*
* @since 0.9.34
*/
private static void sendRedirect(int httpsPort, HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws IOException {
private static void sendRedirect(int httpsPort, Request request,
Response response) throws IOException {
StringBuilder buf = new StringBuilder(64);
buf.append("https://");
String name = httpRequest.getServerName();
String name = Request.getServerName(request);
boolean ipv6 = name.indexOf(':') >= 0 && !name.startsWith("[");
if (ipv6)
buf.append('[');
@@ -184,14 +180,13 @@ public class HostCheckHandler extends GzipHandler
if (ipv6)
buf.append(']');
buf.append(':').append(httpsPort)
.append(httpRequest.getRequestURI());
String q = httpRequest.getQueryString();
.append(request.getHttpURI().getPath());
String q = request.getHttpURI().getQuery();
if (q != null)
buf.append('?').append(q);
httpResponse.setHeader("Location", buf.toString());
response.getHeaders().put("Location", buf.toString());
// https://w3c.github.io/webappsec-upgrade-insecure-requests/
httpResponse.setHeader("Vary", "Upgrade-Insecure-Requests");
httpResponse.setStatus(307);
httpResponse.getOutputStream().close();
response.getHeaders().put("Vary", "Upgrade-Insecure-Requests");
response.setStatus(307);
}
}

View File

@@ -11,11 +11,14 @@ import javax.servlet.http.HttpServletResponse;
import net.i2p.I2PAppContext;
import org.eclipse.jetty.ee8.nested.SessionHandler;
import org.eclipse.jetty.ee8.servlet.ServletHandler;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
import org.eclipse.jetty.http.pathmap.MatchedResource;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Callback;
/**
* Convert foo.jsp to foo_xx.jsp for language xx.
@@ -26,7 +29,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
*
* @author zzz
*/
public class LocaleWebAppHandler extends HandlerWrapper
public class LocaleWebAppHandler extends Handler.Wrapper
{
private final I2PAppContext _context;
private final WebAppContext _wac;
@@ -43,24 +46,24 @@ public class LocaleWebAppHandler extends HandlerWrapper
_wac.setServletHandler(servletHandler);
setHandler(_wac);
}
/**
* Handle foo.jsp by converting to foo_xx.jsp
* for language xx, where xx is the language for the default locale,
* or as specified in the routerconsole.lang property.
* Unless language == "en".
*/
public void handle(String pathInContext,
Request baseRequest,
HttpServletRequest httpRequest,
HttpServletResponse httpResponse)
throws IOException, ServletException
public boolean handle(Request request,
Response response,
Callback callback)
throws Exception
{
String pathInContext = Request.getPathInContext(request);
String newPath = pathInContext;
// transparent rewriting
if (pathInContext.equals("/") || pathInContext.equals("/index.html")) {
// home page
pathInContext = "/index.jsp";
newPath = "/index.jsp";
} else if (pathInContext.equals("/favicon.ico")) {
// pass thru unchanged
} else if (pathInContext.indexOf('/', 1) < 0 &&
@@ -68,11 +71,10 @@ public class LocaleWebAppHandler extends HandlerWrapper
(!pathInContext.endsWith(".log")) &&
(!pathInContext.endsWith(".txt"))) {
// add .jsp to pages at top level
pathInContext += ".jsp";
newPath += ".jsp";
}
//System.err.println("Path: " + pathInContext);
String newPath = pathInContext;
//if (pathInContext.endsWith(".jsp")) {
// We only ended up doing this for help.jsp, so save some effort
// unless we translate more pages like this
@@ -87,9 +89,9 @@ public class LocaleWebAppHandler extends HandlerWrapper
String testPath = pathInContext.substring(0, len - 4) + '_' + lang + ".jsp";
// Do we have a servlet for the new path that isn't the catchall *.jsp?
@SuppressWarnings("rawtypes")
Map.Entry servlet = _wac.getServletHandler().getHolderEntry(testPath);
MatchedResource<ServletHandler.MappedServlet> servlet = _wac.getServletHandler().getMatchedServlet(testPath);
if (servlet != null) {
String servletPath = (String) servlet.getKey();
String servletPath = servlet.getPathSpec().getDeclaration();
if (servletPath != null && !servletPath.startsWith("*")) {
// success!!
//System.err.println("Servlet is: " + servletPath);
@@ -99,14 +101,20 @@ public class LocaleWebAppHandler extends HandlerWrapper
}
}
} else if (pathInContext.startsWith("/js/")) {
// https://stackoverflow.com/questions/78878330/how-to-set-encoding-for-httpservletrequest-and-httpservletresponse-in-jetty12-t
// war internal
httpResponse.setCharacterEncoding("ISO-8859-1");
//response.setCharacterEncoding("ISO-8859-1");
// probably not doing anything
response.getHeaders().put("Content-Type", "text/javascript;charset=iso-8859-1");
} else if (pathInContext.endsWith(".css")) {
// war internal
httpResponse.setCharacterEncoding("UTF-8");
//response.setCharacterEncoding("UTF-8");
response.getHeaders().put("Content-Type", "text/css;charset=utf-8");
}
//System.err.println("New path: " + newPath);
super.handle(newPath, baseRequest, httpRequest, httpResponse);
if (!newPath.equals(pathInContext))
request = Request.serveAs(request, Request.newHttpURIFrom(request, newPath));
return super.handle(request, response, callback);
//System.err.println("Was handled? " + httpRequest.isHandled());
}
@@ -152,4 +160,11 @@ public class LocaleWebAppHandler extends HandlerWrapper
context.setInitParameter((String)e.getKey(), (String)e.getValue());
}
}
/**
* @since Jetty 12
*/
public WebAppContext getWebAppContext() {
return _wac;
}
}

View File

@@ -22,7 +22,7 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.concurrent.LinkedBlockingQueue;
import javax.servlet.ServletRequest;
import java.util.function.Function;
import net.i2p.I2PAppContext;
import net.i2p.app.ClientApp;
@@ -46,34 +46,38 @@ import net.i2p.util.SecureDirectory;
import net.i2p.util.I2PSSLSocketFactory;
import net.i2p.util.SystemVersion;
import org.eclipse.jetty.ee8.nested.ServletConstraint;
import org.eclipse.jetty.ee8.security.ConstraintMapping;
import org.eclipse.jetty.ee8.security.ConstraintSecurityHandler;
import org.eclipse.jetty.ee8.security.SecurityHandler;
import org.eclipse.jetty.ee8.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.ee8.security.authentication.DigestAuthenticator;
import org.eclipse.jetty.ee8.security.authentication.LoginAuthenticator;
import org.eclipse.jetty.ee8.servlet.ServletHandler;
import org.eclipse.jetty.ee8.servlet.ServletHolder;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
import org.eclipse.jetty.security.Constraint;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.ConstraintMapping;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
import org.eclipse.jetty.security.authentication.LoginAuthenticator;
import org.eclipse.jetty.security.UserIdentity;
import org.eclipse.jetty.security.UserStore;
import org.eclipse.jetty.server.AbstractConnector;
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.CustomRequestLog;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.Session;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.security.Constraint;
import org.eclipse.jetty.util.resource.ResourceFactory;
import org.eclipse.jetty.util.resource.URLResourceFactory;
import org.eclipse.jetty.util.security.Credential;
import org.eclipse.jetty.util.security.Credential.MD5;
import org.eclipse.jetty.util.ssl.SslContextFactory;
@@ -91,15 +95,8 @@ public class RouterConsoleRunner implements RouterApp {
static {
// To take effect, must be set before any Jetty classes are loaded
try {
Log.setLog(new I2PLogger());
} catch (Throwable t) {
System.err.println("INFO: I2P Jetty logging class not found, logging to wrapper log");
}
// This way it doesn't try to load Slf4jLog first
// This causes an NPE in AbstractLifeCycle
// http://dev.eclipse.org/mhonarc/lists/jetty-users/msg02587.html
//System.setProperty("org.eclipse.jetty.util.log.class", "net.i2p.jetty.I2PLogger");
// https://slf4j.org/faq.html
System.setProperty("slf4j.provider", "net.i2p.jetty.I2PLoggingServiceProvider");
}
private final RouterContext _context;
@@ -501,12 +498,10 @@ public class RouterConsoleRunner implements RouterApp {
_server = new Server(qtp);
//}
HandlerCollection hColl = new HandlerCollection();
Handler.Sequence hColl = new Handler.Sequence();
ContextHandlerCollection chColl = new ContextHandlerCollection();
HostCheckHandler chCollWrapper = new HostCheckHandler(_context);
chCollWrapper.setHandler(chColl);
// gone in Jetty 7
//_server.addHandler(hColl);
_server.setHandler(hColl);
hColl.addHandler(chCollWrapper);
hColl.addHandler(new DefaultHandler());
@@ -517,9 +512,7 @@ public class RouterConsoleRunner implements RouterApp {
if (!logFile.isAbsolute())
logFile = new File(_context.getLogDir(), "logs/" + log);
try {
RequestLogHandler rhl = new RequestLogHandler();
rhl.setRequestLog(new NCSARequestLog(logFile.getAbsolutePath()));
hColl.addHandler(rhl);
_server.setRequestLog(new CustomRequestLog(logFile.toString(), CustomRequestLog.NCSA_FORMAT));
} catch (Exception ioe) {
System.err.println("ERROR: Unable to create Jetty log: " + ioe);
}
@@ -544,7 +537,7 @@ public class RouterConsoleRunner implements RouterApp {
_webAppsDir += '/';
Set<String> listenHosts = new HashSet<String>(8);
HandlerWrapper rootWebApp = null;
LocaleWebAppHandler rootWebApp = null;
ServletHandler rootServletHandler = null;
List<Connector> connectors = new ArrayList<Connector>(4);
try {
@@ -644,7 +637,8 @@ public class RouterConsoleRunner implements RouterApp {
}
if (verifyKeyStore(keyStore, altNames)) {
// the keystore path and password
SslContextFactory sslFactory = new SslContextFactory(keyStore.getAbsolutePath());
SslContextFactory.Server sslFactory = new SslContextFactory.Server();
sslFactory.setKeyStorePath(keyStore.getAbsolutePath());
sslFactory.setKeyStorePassword(_context.getProperty(PROP_KEYSTORE_PASSWORD, KeyStoreUtil.DEFAULT_KEYSTORE_PASSWORD));
// the X.509 cert password (if not present, verifyKeyStore() returned false)
sslFactory.setKeyManagerPassword(_context.getProperty(PROP_KEY_PASSWORD, "thisWontWork"));
@@ -735,11 +729,11 @@ public class RouterConsoleRunner implements RouterApp {
// Got a clue from this ancient post for Tomcat 6:
// https://bz.apache.org/bugzilla/show_bug.cgi?id=39804
// see also apps/jetty/build.xml
Class.forName("org.eclipse.jetty.apache.jsp.JettyJasperInitializer");
Class.forName("org.eclipse.jetty.ee8.apache.jsp.JettyJasperInitializer");
} catch (ClassNotFoundException cnfe) {
System.err.println("Warning: JettyJasperInitializer not found");
}
WebAppContext wac = (WebAppContext)(rootWebApp.getHandler());
WebAppContext wac = rootWebApp.getWebAppContext();
initialize(_context, wac);
WebAppStarter.setWebAppConfiguration(wac, false);
chColl.addHandler(rootWebApp);
@@ -772,7 +766,10 @@ public class RouterConsoleRunner implements RouterApp {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=364936
// WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,jar:file:/.../webapps/routerconsole.war!/},/.../webapps/routerconsole.war
// java.lang.IllegalStateException: zip file closed
Resource.setDefaultUseCaches(false);
// FIXME
//URLResourceFactory urlrf = new URLResourceFactory();
//urlrf.setUseCaches(false);
//ResourceFactory.registerResourceFactory("jar", urlrf);
try {
// start does a mapContexts()
_server.start();
@@ -994,6 +991,8 @@ public class RouterConsoleRunner implements RouterApp {
String rlm = isBasic ? PROMETHEUS_REALM : JETTY_REALM;
HashLoginService realm = new CustomHashLoginService(rlm, context.getContextPath(),
ctx.logManager().getLog(RouterConsoleRunner.class));
UserStore userStore = new UserStore();
realm.setUserStore(userStore);
sec.setLoginService(realm);
LoginAuthenticator auth = isBasic ? basicAuthenticator : authenticator;
sec.setAuthenticator(auth);
@@ -1003,8 +1002,8 @@ public class RouterConsoleRunner implements RouterApp {
String pw = e.getValue();
// for basic, the password will be the md5 hash itself
Credential cred = Credential.getCredential(isBasic ? pw : MD5_CREDENTIAL_TYPE + pw);
realm.putUser(user, cred, role);
Constraint constraint = new Constraint(user, JETTY_ROLE);
userStore.addUser(user, cred, role);
ServletConstraint constraint = new ServletConstraint(user, JETTY_ROLE);
constraint.setAuthenticate(true);
ConstraintMapping cm = new ConstraintMapping();
cm.setConstraint(constraint);
@@ -1023,8 +1022,8 @@ public class RouterConsoleRunner implements RouterApp {
try {
// each char truncated to 8 bytes
String user2 = new String(b2, "ISO-8859-1");
realm.putUser(user2, cred, role);
constraint = new Constraint(user2, JETTY_ROLE);
userStore.addUser(user2, cred, role);
constraint = new ServletConstraint(user2, JETTY_ROLE);
constraint.setAuthenticate(true);
cm = new ConstraintMapping();
cm.setConstraint(constraint);
@@ -1034,8 +1033,8 @@ public class RouterConsoleRunner implements RouterApp {
// each UTF-8 byte as a char
// this is what chrome does
String user3 = new String(b1, "ISO-8859-1");
realm.putUser(user3, cred, role);
constraint = new Constraint(user3, JETTY_ROLE);
userStore.addUser(user3, cred, role);
constraint = new ServletConstraint(user2, JETTY_ROLE);
constraint.setAuthenticate(true);
cm = new ConstraintMapping();
cm.setConstraint(constraint);
@@ -1057,7 +1056,7 @@ public class RouterConsoleRunner implements RouterApp {
// See also:
// http://old.nabble.com/Disable-HTTP-TRACE-in-Jetty-5.x-td12412607.html
Constraint sc = new Constraint();
ServletConstraint sc = new ServletConstraint();
sc.setName("No trace");
ConstraintMapping cm = new ConstraintMapping();
cm.setMethod("TRACE");
@@ -1065,8 +1064,6 @@ public class RouterConsoleRunner implements RouterApp {
cm.setPathSpec("/");
constraints.add(cm);
sc = new Constraint();
sc.setName("No options");
cm = new ConstraintMapping();
cm.setMethod("OPTIONS");
cm.setConstraint(sc);
@@ -1109,11 +1106,11 @@ public class RouterConsoleRunner implements RouterApp {
}
@Override
public UserIdentity login(String username, Object credentials, ServletRequest request) {
UserIdentity rv = super.login(username, credentials, request);
public UserIdentity login(String username, Object credentials, Request request, Function<Boolean, Session> getOrCreateSession) {
UserIdentity rv = super.login(username, credentials, request, getOrCreateSession);
if (rv == null)
//_log.logAlways(net.i2p.util.Log.WARN, "Console authentication failed, webapp: " + _webapp + ", user: " + username);
_log.logAlways(net.i2p.util.Log.WARN, "Console authentication failed, user: " + username + " IP: " + request.getRemoteAddr());
_log.logAlways(net.i2p.util.Log.WARN, "Console authentication failed, user: " + username + " IP: " + Request.getRemoteAddr(request));
return rv;
}
}

View File

@@ -17,9 +17,9 @@ import net.i2p.I2PAppContext;
import net.i2p.util.FileSuffixFilter;
import org.apache.tomcat.SimpleInstanceManager;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.ee8.webapp.Configuration;
import org.eclipse.jetty.ee8.webapp.WebAppClassLoader;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
/**
@@ -103,11 +103,11 @@ public class WebAppConfiguration implements Configuration {
// Only really required if started manually, but we don't know that from here
cp = "jetty-util.jar";
****/
// Java 11+ fix to prevent dup contexts
wac.setParentLoaderPriority(true);
if (ctxPath.equals("/susidns")) {
// Old installs don't have this in their wrapper.config classpath
cp = "addressbook.jar";
// Java 11+ fix to prevent dup contexts
wac.setParentLoaderPriority(true);
} else if (pluginDir.exists()) {
File consoleDir = new File(pluginDir, "console");
Properties props = RouterConsoleRunner.webAppProperties(consoleDir.getAbsolutePath());
@@ -223,4 +223,14 @@ public class WebAppConfiguration implements Configuration {
/** @since Jetty 7 */
public void postConfigure(WebAppContext context) {}
/**
* @since Jetty 12
*/
public boolean abort(WebAppContext context) { return false; }
/**
* @since Jetty 12
*/
public boolean isEnabledByDefault() { return true; }
}

View File

@@ -17,11 +17,12 @@ import net.i2p.util.FileUtil;
import net.i2p.util.PortMapper;
import net.i2p.util.SecureDirectory;
import org.eclipse.jetty.ee.WebAppClassLoading;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.webapp.WebAppContext;
/**
@@ -57,7 +58,7 @@ public class WebAppStarter {
// javax-annotations-api.jar
private static final String CLASS_ANNOT4 = "javax.annotation.security.RunAs";
private static final String CLASS_CONFIG = "org.eclipse.jetty.webapp.JettyWebXmlConfiguration";
private static final String CLASS_CONFIG = "org.eclipse.jetty.ee8.webapp.JettyWebXmlConfiguration";
private static final boolean HAS_ANNOTATION_CLASSES;
private static final Set<String> BUILTINS = new HashSet<String>(8);
@@ -202,12 +203,15 @@ public class WebAppStarter {
// Without the default configuration, the web.xml isn't read, and the webapp
// won't respond to any requests, even though it appears to be running.
// See WebAppContext.loadConfigurations() in source
if (classNames.length == 0)
classNames = wac.getDefaultConfigurationClasses();
if (classNames.length == 0) {
//classNames = wac.getDefaultConfigurationClasses();
// These are the defaults as documented in WebAppContext
classNames = new String[] { "org.eclipse.jetty.ee8.webapp.WebXmlConfiguration", "org.eclipse.jetty.ee8.webapp.JettyWebXmlConfiguration" };
}
List<String> newClassNames = new ArrayList<String>(Arrays.asList(classNames));
for (String name : newClassNames) {
// fix for Jetty 9.4 ticket #2385
wac.prependServerClass("-" + name);
WebAppClassLoading.addHiddenClasses(wac, name);
}
// https://www.eclipse.org/jetty/documentation/current/using-annotations.html
// https://www.eclipse.org/jetty/documentation/9.4.x/using-annotations-embedded.html
@@ -327,14 +331,14 @@ public class WebAppStarter {
* @since 0.9.41
*/
private static ContextHandler getWebApp(ContextHandlerCollection server, String appName) {
Handler handlers[] = server.getHandlers();
if (handlers == null)
List<Handler> handlers = server.getHandlers();
if (handlers == null || handlers.isEmpty())
return null;
String path = '/'+ appName;
for (int i = 0; i < handlers.length; i++) {
if (!(handlers[i] instanceof ContextHandler))
for (Handler h : handlers) {
if (!(h instanceof ContextHandler))
continue;
ContextHandler ch = (ContextHandler) handlers[i];
ContextHandler ch = (ContextHandler) h;
if (path.equals(ch.getContextPath()))
return ch;
}
@@ -360,9 +364,7 @@ public class WebAppStarter {
* @since 0.9.41
*/
private static ContextHandlerCollection getConsoleServer(Server s) {
Handler h = s.getChildHandlerByClass(ContextHandlerCollection.class);
if (h == null)
return null;
return (ContextHandlerCollection) h;
ContextHandlerCollection h = s.getDescendant(ContextHandlerCollection.class);
return h;
}
}

View File

@@ -78,7 +78,6 @@
<java classname="net.i2p.servlet.util.JspC" fork="true" classpathref="cp" failonerror="true">
<!-- these are to detect tomcat version and reproducible build setting -->
<jvmarg value="-Dbuild.reproducible=${build.reproducible}" />
<jvmarg value="-Dwith-libtomcat8-java=${with-libtomcat8-java}" />
<jvmarg value="-Dwith-libtomcat9-java=${with-libtomcat9-java}" />
<jvmarg value="-Djasper.jar=${lib}/jasper-runtime.jar" />
<arg value="-d" />

View File

@@ -82,7 +82,7 @@
- in the base context which invalidates it in our context too.
-->
<context-param>
<param-name>org.eclipse.jetty.servlet.SessionCookie</param-name>
<param-name>org.eclipse.jetty.session.SessionCookie</param-name>
<param-value>SUSIMAILJSESSIONID</param-value>
</context-param>

View File

@@ -44,8 +44,8 @@ sloccount.report.file=sloccount.sc
require.gettext=true
# Compile for this version of Java
#javac.version=1.8
#javac.release=8
#javac.version=17
#javac.release=17
# Additional classpath if required
#javac.classpath=/PATH/TO/pack200.jar
@@ -147,11 +147,9 @@ require.gettext=true
#build.reproducible=true
# Don't include geoip files, we will use geoip-database package
#with-geoip-database=true
# Don't include jetty files, we will use libjetty9-java package. Requires with-libtomcat8-java=true.
#with-libjetty9-java=true
# Don't include jetty files, we will use libjetty9-java package. Requires with-libtomcat9-java=true.
#with-libjetty12-java=true
# Don't include tomcat files, we will use libtomcat8-java package
#with-libtomcat8-java=true
# Don't include tomcat files, we will use libtomcat9-java package
#with-libtomcat9-java=true
# Don't include jstl.jar and standard.jar, we will use libtaglibs-standard-* packages
#with-libtaglibs-standard=true

View File

@@ -2,8 +2,9 @@
<project basedir="." default="all" name="i2p"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- for javac "release" parameter -->
<property name="ant.minimumVersion" value="1.9.8"/>
<!-- for javaversion condition -->
<property name="ant.minimumVersion" value="1.10.2"/>
<property name="java.minimumVersion" value="17"/>
<!-- Include property files so that values can be easily overridden.
Users should create an override.properties file to make changes.
@@ -14,7 +15,7 @@
and checksum in apps/jetty/build.xml
and versions in gradle.properties and apps/jetty/build.gradle
-->
<property name="jetty.ver" value="9.3.30.v20211001" />
<property name="jetty.ver" value="12.0.21" />
<property name="tomcat.ver" value="9.0.88" />
<!-- You probably don't want to change anything from here down -->
@@ -432,6 +433,13 @@
</target>
<target name="buildProperties" depends="getGitRev, getReleaseNumber, getBuildNumber, setBuildTimestamp, disableManifestClasspath" >
<fail message="FATAL: Minimum Java version is ${java.minimumVersion} - your Java version is ${java.version}">
<condition>
<not>
<javaversion atleast="${java.minimumVersion}"/>
</not>
</condition>
</fail>
<antversion property="antversion"/>
<fail message="FATAL: Minimum Ant version is ${ant.minimumVersion} - your Ant version is ${antversion}">
<condition>
@@ -450,6 +458,9 @@
<echo message="Ant: ${ant.version}" />
<echo message="JDK: ${java.vendor} ${java.version} (${java.runtime.name} ${java.runtime.version})" />
<echo message="Building version ${full.version} (revision ${workspace.version})" />
<property name="javac.version" value="17" />
<property name="javac.release" value="17" />
<echo message="Building for minimum Java version ${javac.version} release ${javac.release}" />
</target>
<target name="setBuildTimestamp" unless="${build.reproducible}" >
@@ -874,7 +885,7 @@
<mkdir dir="./build" />
<mkdir dir="./build/javadoc" />
<!-- set if unset -->
<property name="javac.version" value="1.8" />
<property name="javac.version" value="17" />
<javadoc access="package"
source="${javac.version}"
destdir="./build/javadoc"
@@ -2530,8 +2541,8 @@
</ant>
<ant dir="apps/jetty/">
<!-- not used in Android -->
<property name="javac.version" value="1.8" />
<property name="javac.release" value="8" />
<property name="javac.version" value="17" />
<property name="javac.release" value="17" />
<target name="servletJar" />
<target name="servletJavadocJar" />
<target name="servletSourcesJar" />
@@ -2766,26 +2777,12 @@
<arg value="-p1" />
</exec>
<echo />
<echo message="Checking debian/patches/0002-jetty-compatibility.patch" />
<exec executable="patch" failonerror="true" input="debian/patches/0002-jetty-compatibility.patch" >
<arg value="--dry-run" />
<arg value="-F0" />
<arg value="-p1" />
</exec>
<echo />
<echo message="Checking debian/patches/0003-json-simple-3.patch" />
<exec executable="patch" failonerror="true" input="debian/patches/0003-json-simple-3.patch" >
<arg value="--dry-run" />
<arg value="-F0" />
<arg value="-p1" />
</exec>
<echo />
<echo message="Checking debian-alt/xenial/patches/0002-jetty-old-api.patch" />
<exec executable="patch" failonerror="true" input="debian-alt/xenial/patches/0002-jetty-old-api.patch" >
<arg value="--dry-run" />
<arg value="-F0" />
<arg value="-p1" />
</exec>
</target>

View File

@@ -14,9 +14,11 @@ Versions are as follows:
Min version Max version Uses src pkg Copied to Debian
----------- ----------- ------------ ----------------
jammy questing bionic buster, bullseye, bookworm, trixie, sid
Unsupported (No Java 17):
bionic -- bionic --
focal -- bionic --
jammy questing bionic buster, bullseye, bookworm, trixie, sid
Unsupported (Java 7):
precise saucy precise wheezy

6
debian/apparmor/i2p vendored
View File

@@ -63,20 +63,20 @@
/usr/share/java/eclipse-jdt-core-*.jar r,
/usr/share/java/libintl.jar r,
/usr/share/java/libintl-*.jar r,
/usr/share/java/glassfish-appserv-jstl.jar r,
/usr/share/maven-repo/jstl/jstl/1.2/jstl-1.2.jar r,
/usr/share/java/gnu-getopt.jar r,
/usr/share/java/gnu-getopt-*.jar r,
/usr/share/java/jetty9-*.jar r,
/usr/share/java/jetty12-*.jar r,
/usr/share/java/json-simple.jar r,
/usr/share/java/json-simple-*.jar r,
/usr/share/java/jsp-api.jar r,
/usr/share/java/jsp-api-*.jar r,
/usr/share/java/servlet-api.jar r,
/usr/share/java/servlet-api-*.jar r,
/usr/share/java/slf4j-*.jar r,
/usr/share/maven-repo/org/slf4j/slf4j-api/2.x/slf4j-api-2.x.jar r,
/usr/share/java/standard.jar r,
/usr/share/java/standard-*.jar r,
/usr/share/java/tomcat8-*.jar r,
/usr/share/java/tomcat9-*.jar r,
/usr/share/java/taglibs-standard-*.jar r,
/usr/share/flags/countries/16x11/* r,

10
debian/control vendored
View File

@@ -8,10 +8,11 @@ Homepage: https://geti2p.net/
Vcs-Browser: https://salsa.debian.org/debian/i2p
Vcs-Git: https://salsa.debian.org/debian/i2p.git
Build-Depends: debhelper (>= 9.20160709)
,ant (>= 1.9.8)
,ant (>= 1.10.2)
,debconf
,default-jdk
,libjetty9-java (>= 9.4)
,libjetty12-java
,libslf4j2-java
,libjsp-api-java
,libservlet-api-java
,libtaglibs-standard-jstlel-java
@@ -80,12 +81,13 @@ Architecture: all
Section: net
Priority: optional
Depends: ${misc:Depends}, ${java:Depends}, ${shlibs:Depends},
default-jre-headless | java11-runtime-headless | openjdk-21-jre-headless | openjdk-17-jre-headless | openjdk-11-jre-headless | java21-runtime-headless | java17-runtime-headless,
default-jre-headless | openjdk-21-jre-headless | openjdk-17-jre-headless | java21-runtime-headless | java17-runtime-headless,
geoip-database,
gettext-base,
libgetopt-java,
libjson-simple-java (>= 2),libjson-simple-java (<< 3),
libjetty9-java (>= 9.4),
libjetty12-java,
libslf4j2-java,
libjsp-api-java,
libservlet-api-java,
libtaglibs-standard-jstlel-java,

View File

@@ -32,24 +32,25 @@ pkg-temp/lib/streaming.jar usr/share/i2p/lib
pkg-temp/lib/systray.jar usr/share/i2p/lib
# uncomment if not building with libjetty9-java
# uncomment if not building with libjetty12-java
# ubuntu: in trusty vivid wily xenial
# debian: in wheezy jessie stretch sid
#pkg-temp/lib/jetty-continuation.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-deploy.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-http.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-io.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-rewrite-handler.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-security.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-servlet.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-servlets.jar usr/share/i2p/lib
# debian package does NOT contain the ee8 jars
pkg-temp/lib/jetty-servlet.jar usr/share/i2p/lib
pkg-temp/lib/jetty-servlets.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-start.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-util.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-webapp.jar usr/share/i2p/lib
# debian package does NOT contain the ee8 jars
pkg-temp/lib/jetty-webapp.jar usr/share/i2p/lib
#pkg-temp/lib/jetty-xml.jar usr/share/i2p/lib
#pkg-temp/lib/org.mortbay.jetty.jar usr/share/i2p/lib
#pkg-temp/lib/org.mortbay.jmx.jar usr/share/i2p/lib
# following two are from libservlet3.0-java which is a dependency of libjetty9-java
# following two are from libservlet-api-java which is a dependency of libjetty12-java
#pkg-temp/lib/javax.servlet.jar usr/share/i2p/lib

View File

@@ -9,31 +9,36 @@ usr/share/common-licenses/BSD usr/share/doc/i2p-router/licenses/LICENSE-BSD.txt
# comment out if not building with libjetty9-java
# ubuntu: in trusty vivid wily xenial
# debian: in wheezy jessie stretch sid
usr/share/java/jetty9-apache-jsp.jar usr/share/i2p/lib/jetty-apache-jsp.jar
usr/share/java/jetty9-continuation.jar usr/share/i2p/lib/jetty-continuation.jar
usr/share/java/jetty9-deploy.jar usr/share/i2p/lib/jetty-deploy.jar
usr/share/java/jetty9-http.jar usr/share/i2p/lib/jetty-http.jar
usr/share/java/jetty9-io.jar usr/share/i2p/lib/jetty-io.jar
# comment out if not building with libjetty12-java
# ubuntu: NO
# debian: in trixie sid
usr/share/java/jetty12-apache-jsp.jar usr/share/i2p/lib/jetty-apache-jsp.jar
usr/share/java/jetty12-deploy.jar usr/share/i2p/lib/jetty-deploy.jar
usr/share/java/jetty12-ee.jar usr/share/i2p/lib/ee.jar
usr/share/java/jetty12-http.jar usr/share/i2p/lib/jetty-http.jar
usr/share/java/jetty12-io.jar usr/share/i2p/lib/jetty-io.jar
# legacy name in lib/
usr/share/java/jetty9-rewrite.jar usr/share/i2p/lib/jetty-rewrite-handler.jar
usr/share/java/jetty9-security.jar usr/share/i2p/lib/jetty-security.jar
usr/share/java/jetty9-servlet.jar usr/share/i2p/lib/jetty-servlet.jar
usr/share/java/jetty9-servlets.jar usr/share/i2p/lib/jetty-servlets.jar
usr/share/java/jetty9-start.jar usr/share/i2p/lib/jetty-start.jar
usr/share/java/jetty9-util.jar usr/share/i2p/lib/jetty-util.jar
usr/share/java/jetty9-webapp.jar usr/share/i2p/lib/jetty-webapp.jar
usr/share/java/jetty9-xml.jar usr/share/i2p/lib/jetty-xml.jar
usr/share/java/jetty12-rewrite.jar usr/share/i2p/lib/jetty-rewrite-handler.jar
usr/share/java/jetty12-security.jar usr/share/i2p/lib/jetty-security.jar
# debian package does NOT contain the ee8 jars
#usr/share/java/jetty12-ee8-servlet.jar usr/share/i2p/lib/jetty-servlet.jar
#usr/share/java/jetty12-ee8-servlets.jar usr/share/i2p/lib/jetty-servlets.jar
usr/share/java/jetty12-session.jar usr/share/i2p/lib/jetty-session.jar
usr/share/java/jetty12-start.jar usr/share/i2p/lib/jetty-start.jar
usr/share/java/jetty12-util.jar usr/share/i2p/lib/jetty-util.jar
# debian package does NOT contain the ee8 jars
#usr/share/java/jetty12-ee8-webapp.jar usr/share/i2p/lib/jetty-webapp.jar
usr/share/java/jetty12-xml.jar usr/share/i2p/lib/jetty-xml.jar
# legacy name in lib/
usr/share/java/jetty9-server.jar usr/share/i2p/lib/org.mortbay.jetty.jar
usr/share/java/jetty12-server.jar usr/share/i2p/lib/org.mortbay.jetty.jar
# legacy name in lib/
usr/share/java/jetty9-jmx.jar usr/share/i2p/lib/org.mortbay.jmx.jar
usr/share/java/jetty12-jmx.jar usr/share/i2p/lib/org.mortbay.jmx.jar
# legacy name in lib/
usr/share/java/servlet-api.jar usr/share/i2p/lib/javax.servlet.jar
# combined into javax.servlet.jar in non-package builds
usr/share/java/jsp-api.jar usr/share/i2p/lib/jsp-api.jar
# the libslf4j2-java package does NOT provide a non-versioned file except in the maven-repo dir
usr/share/maven-repo/org/slf4j/slf4j-api/2.x/slf4j-api-2.x.jar usr/share/i2p/lib/slf4j-api.jar
# comment out if not building with libtomcat9-java

View File

@@ -1,85 +0,0 @@
--- a/apps/jetty/java/src/net/i2p/jetty/JettyXmlConfigurationParser.java
+++ b/apps/jetty/java/src/net/i2p/jetty/JettyXmlConfigurationParser.java
@@ -43,9 +43,9 @@
private static XmlParser initParser()
{
XmlParser parser = new XmlParser();
- URL config60 = Loader.getResource(XmlConfiguration.class, "org/eclipse/jetty/xml/configure_6_0.dtd");
- URL config76 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_7_6.dtd");
- URL config90 = Loader.getResource(XmlConfiguration.class,"org/eclipse/jetty/xml/configure_9_0.dtd");
+ URL config60 = Loader.getResource("org/eclipse/jetty/xml/configure_6_0.dtd");
+ URL config76 = Loader.getResource("org/eclipse/jetty/xml/configure_7_6.dtd");
+ URL config90 = Loader.getResource("org/eclipse/jetty/xml/configure_9_0.dtd");
parser.redirectEntity("configure.dtd",config90);
parser.redirectEntity("configure_1_0.dtd",config60);
parser.redirectEntity("configure_1_1.dtd",config60);
--- a/apps/jetty/java/src/net/i2p/servlet/I2PDefaultServlet.java
+++ b/apps/jetty/java/src/net/i2p/servlet/I2PDefaultServlet.java
@@ -135,7 +135,6 @@
*
* Get the resource list as a HTML directory listing.
*/
- @Override
protected void sendDirectory(HttpServletRequest request,
HttpServletResponse response,
Resource resource,
--- a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java
@@ -49,6 +50,7 @@
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.ConstraintMapping;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
+import org.eclipse.jetty.security.UserStore;
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
import org.eclipse.jetty.security.authentication.LoginAuthenticator;
@@ -994,6 +998,8 @@
String rlm = isBasic ? PROMETHEUS_REALM : JETTY_REALM;
HashLoginService realm = new CustomHashLoginService(rlm, context.getContextPath(),
ctx.logManager().getLog(RouterConsoleRunner.class));
+ UserStore userStore = new UserStore();
+ realm.setUserStore(userStore);
sec.setLoginService(realm);
LoginAuthenticator auth = isBasic ? basicAuthenticator : authenticator;
sec.setAuthenticator(auth);
@@ -1003,7 +1007,7 @@
String pw = e.getValue();
// for basic, the password will be the md5 hash itself
Credential cred = Credential.getCredential(isBasic ? pw : MD5_CREDENTIAL_TYPE + pw);
- realm.putUser(user, cred, role);
+ userStore.addUser(user, cred, role);
Constraint constraint = new Constraint(user, JETTY_ROLE);
constraint.setAuthenticate(true);
ConstraintMapping cm = new ConstraintMapping();
@@ -1023,7 +1027,7 @@
try {
// each char truncated to 8 bytes
String user2 = new String(b2, "ISO-8859-1");
- realm.putUser(user2, cred, role);
+ userStore.addUser(user2, cred, role);
constraint = new Constraint(user2, JETTY_ROLE);
constraint.setAuthenticate(true);
cm = new ConstraintMapping();
@@ -1034,7 +1038,7 @@
// each UTF-8 byte as a char
// this is what chrome does
String user3 = new String(b1, "ISO-8859-1");
- realm.putUser(user3, cred, role);
+ userStore.addUser(user3, cred, role);
constraint = new Constraint(user3, JETTY_ROLE);
constraint.setAuthenticate(true);
cm = new ConstraintMapping();
--- a/apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java
@@ -87,9 +87,9 @@
String testPath = pathInContext.substring(0, len - 4) + '_' + lang + ".jsp";
// Do we have a servlet for the new path that isn't the catchall *.jsp?
@SuppressWarnings("rawtypes")
- Map.Entry servlet = _wac.getServletHandler().getHolderEntry(testPath);
+ org.eclipse.jetty.http.pathmap.MappedResource servlet = _wac.getServletHandler().getMappedServlet(testPath);
if (servlet != null) {
- String servletPath = (String) servlet.getKey();
+ String servletPath = servlet.getPathSpec().getDeclaration();
if (servletPath != null && !servletPath.startsWith("*")) {
// success!!
//System.err.println("Servlet is: " + servletPath);

View File

@@ -1,4 +1,3 @@
0001-path-substitution.patch
0002-jetty-compatibility.patch
0003-json-simple-3.patch

40
debian/rules vendored
View File

@@ -100,28 +100,34 @@ endif
@# debian and ubuntu: everywhere
@/bin/echo -e "with-geoip-database=true" >> $(CURDIR)/override.properties
@# ubuntu: in xenial
@# debian: in jessie-backports stretch sid
@/bin/echo -e "with-libjetty9-java=true" >> $(CURDIR)/override.properties
@# ubuntu: NO
@# debian: in trixie sid
@# this also implies with-libslf4j2-java
@/bin/echo -e "with-libjetty12-java=true" >> $(CURDIR)/override.properties
mkdir -p $(CURDIR)/apps/jetty/jettylib
ln -sf /usr/share/java/jetty9-continuation.jar $(CURDIR)/apps/jetty/jettylib/jetty-continuation.jar
ln -sf /usr/share/java/jetty9-deploy.jar $(CURDIR)/apps/jetty/jettylib/jetty-deploy.jar
ln -sf /usr/share/java/jetty9-http.jar $(CURDIR)/apps/jetty/jettylib/jetty-http.jar
ln -sf /usr/share/java/jetty9-io.jar $(CURDIR)/apps/jetty/jettylib/jetty-io.jar
ln -sf /usr/share/java/jetty9-rewrite.jar $(CURDIR)/apps/jetty/jettylib/jetty-rewrite-handler.jar
ln -sf /usr/share/java/jetty9-security.jar $(CURDIR)/apps/jetty/jettylib/jetty-security.jar
ln -sf /usr/share/java/jetty9-servlet.jar $(CURDIR)/apps/jetty/jettylib/jetty-servlet.jar
ln -sf /usr/share/java/jetty9-servlets.jar $(CURDIR)/apps/jetty/jettylib/jetty-servlets.jar
ln -sf /usr/share/java/jetty9-start.jar $(CURDIR)/apps/jetty/jettylib/jetty-start.jar
ln -sf /usr/share/java/jetty9-util.jar $(CURDIR)/apps/jetty/jettylib/jetty-util.jar
ln -sf /usr/share/java/jetty9-webapp.jar $(CURDIR)/apps/jetty/jettylib/jetty-webapp.jar
ln -sf /usr/share/java/jetty9-xml.jar $(CURDIR)/apps/jetty/jettylib/jetty-xml.jar
ln -sf /usr/share/java/jetty9-server.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jetty.jar
ln -sf /usr/share/java/jetty9-jmx.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jmx.jar
ln -sf /usr/share/java/jetty12-deploy.jar $(CURDIR)/apps/jetty/jettylib/jetty-deploy.jar
ln -sf /usr/share/java/jetty12-ee.jar $(CURDIR)/apps/jetty/jettylib/jetty-ee.jar
ln -sf /usr/share/java/jetty12-http.jar $(CURDIR)/apps/jetty/jettylib/jetty-http.jar
ln -sf /usr/share/java/jetty12-io.jar $(CURDIR)/apps/jetty/jettylib/jetty-io.jar
ln -sf /usr/share/java/jetty12-rewrite.jar $(CURDIR)/apps/jetty/jettylib/jetty-rewrite-handler.jar
ln -sf /usr/share/java/jetty12-security.jar $(CURDIR)/apps/jetty/jettylib/jetty-security.jar
@# debian package does NOT contain the ee8 jars
@#ln -sf /usr/share/java/jetty12-servlet.jar $(CURDIR)/apps/jetty/jettylib/jetty-ee8-servlet.jar
@#ln -sf /usr/share/java/jetty12-servlets.jar $(CURDIR)/apps/jetty/jettylib/jetty-ee8-servlets.jar
ln -sf /usr/share/java/jetty12-session.jar $(CURDIR)/apps/jetty/jettylib/jetty-session.jar
ln -sf /usr/share/java/jetty12-start.jar $(CURDIR)/apps/jetty/jettylib/jetty-start.jar
ln -sf /usr/share/java/jetty12-util.jar $(CURDIR)/apps/jetty/jettylib/jetty-util.jar
@# debian package does NOT contain the ee8 jars
@#ln -sf /usr/share/java/jetty12-webapp.jar $(CURDIR)/apps/jetty/jettylib/jetty-ee8-webapp.jar
ln -sf /usr/share/java/jetty12-xml.jar $(CURDIR)/apps/jetty/jettylib/jetty-xml.jar
ln -sf /usr/share/java/jetty12-server.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jetty.jar
ln -sf /usr/share/java/jetty12-jmx.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jmx.jar
@# following two are formerly from libservlet3.1-java, now in their own packages
ln -sf /usr/share/java/servlet-api.jar $(CURDIR)/apps/jetty/jettylib/javax.servlet.jar
@# this is roughly the same as tomcat8-jsp-api.jar, we use this one
ln -sf /usr/share/java/jsp-api.jar $(CURDIR)/apps/jetty/jettylib/jsp-api.jar
@# the libslf4j2-java package does NOT provide a non-versioned file except in the maven-repo dir
ln -sf /usr/share/maven-repo/org/slf4j/slf4j-api/2.x/slf4j-api-2.x.jar $(CURDIR)/apps/jetty/jettylib/slf4j-api.jar
@# debian and ubuntu: buster, disco
@/bin/echo -e "with-libtomcat9-java=true" >> $(CURDIR)/override.properties

View File

@@ -7,7 +7,7 @@
<customProcName>false</customProcName>
<icon>resources/console.ico</icon>
<jre>
<minVersion>1.8.0</minVersion>
<minVersion>17</minVersion>
</jre>
<!--
<splash>

View File

@@ -7,7 +7,7 @@
<customProcName>false</customProcName>
<icon>resources/start.ico</icon>
<jre>
<minVersion>1.8.0</minVersion>
<minVersion>17</minVersion>
<!--
<minHeapSize>64</minHeapSize>
-->

View File

@@ -9,7 +9,7 @@
<author name="I2P" email="https://geti2p.net/"/>
</authors>
<url>https://geti2p.net/</url>
<javaversion>1.8</javaversion>
<javaversion>17</javaversion>
<!-- use pack200 compression, saves about 33%
see http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/pack200.html

View File

@@ -15,7 +15,7 @@
<author name="I2P" email="https://geti2p.net/"/>
</authors>
<url>https://geti2p.net/</url>
<javaversion>1.8</javaversion>
<javaversion>17</javaversion>
<!-- adding this element will make the installer attempt to launch itself with administrator permissions,
-->

View File

@@ -13,16 +13,8 @@
<Arg>
<New id="GzipHandler" class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize"><Property name="jetty.gzip.minGzipSize" deprecated="gzip.minGzipSize" default="512"/></Set>
<Set name="checkGzExists"><Property name="jetty.gzip.checkGzExists" deprecated="gzip.checkGzExists" default="false"/></Set>
<Set name="compressionLevel"><Property name="jetty.gzip.compressionLevel" deprecated="gzip.compressionLevel" default="-1"/></Set>
<Set name="syncFlush"><Property name="jetty.gzip.syncFlush" default="false" /></Set>
<Set name="excludedAgentPatterns">
<Array type="String">
<Item><Property name="jetty.gzip.excludedUserAgent" deprecated="gzip.excludedUserAgent" default=".*MSIE.6\.0.*"/></Item>
</Array>
</Set>
<Set name="includedMethods">
<Array type="String">
<Item>GET</Item>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<!--
Configure a custom context for the eepsite.
@@ -8,9 +8,12 @@ This context contains only a ServletContextHandler with a default servlet
to serve static html files and images.
-->
<Configure class="org.eclipse.jetty.servlet.ServletContextHandler">
<Configure class="org.eclipse.jetty.ee8.servlet.ServletContextHandler">
<New id="baseroot" class="java.lang.String">
<Arg>./eepsite/docroot</Arg>
</New>
<Set name="contextPath">/</Set>
<Set name="resourceBase">./eepsite/docroot/</Set>
<Set name="baseResourceAsString"><Ref refid="baseroot" /></Set>
<Call name="setInitParameter">
<Arg>org.eclipse.jetty.servlet.Default.cacheControl</Arg>
<Arg>max-age=3600,public</Arg>
@@ -20,27 +23,16 @@ to serve static html files and images.
<Arg>org.eclipse.jetty.servlet.Default.dirAllowed</Arg>
<Arg>true</Arg>
</Call>
<Call name="setMimeTypes">
<Arg>
<New class="org.eclipse.jetty.http.MimeTypes">
<Call name="addMimeMapping">
<Arg>sud</Arg>
<Arg>application/zip</Arg>
</Call>
<Call name="addMimeMapping">
<Arg>su2</Arg>
<Arg>application/zip</Arg>
</Call>
<Call name="addMimeMapping">
<Arg>xpi2p</Arg>
<Arg>application/zip</Arg>
</Call>
</New>
</Arg>
</Call>
<Call name="addServlet">
<Arg>net.i2p.servlet.I2PDefaultServlet</Arg>
<Arg>/</Arg>
</Call>
<Call name="setErrorHandler">
<Arg>
<New class="net.i2p.servlet.I2PErrorHandler">
<Arg><Ref refid="baseroot" /></Arg>
</New>
</Arg>
</Call>
</Configure>

View File

@@ -1,36 +1,62 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<!--
Configure a custom context for the eepsite.
CGI was removed from Jetty 12.
This is a FCGI replacement for the cgi-context.xml configuration which
served CGI scripts under /cgi-bin.
This does NOT serve CGI scripts under the base context.
Scripts may have any suffix, they do not have to be named *.cgi
Prerequisites:
- sudo apt install spawn-fcgi fcgiwrap
Create a start-fcgi script:
#!/bin/bash
export SKT=/var/tmp/fcgi-socket-0
rm -f $SKT
/usr/bin/spawn-fcgi -s $SKT -F 8 /usr/sbin/fcgiwrap > /var/tmp/fastcgi.log 2>&1 &
Or, to use standard sockets, edit the XML below to remove the unixDomainPath line and use:
#!/bin/bash
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -F 8 /usr/sbin/fcgiwrap > /var/tmp/fastcgi.log 2>&1 &
Start the fcgi-server with
start-fcgi
Ref:
https://jetty.org/docs/jetty/12/operations-guide/protocols/index.html#fcgi
* CGI Servlet.
*
* The cgi bin directory can be set with the "cgibinResourceBase" init parameter
* or it will default to the resource base of the context.
*
* The "commandPrefix" init parameter may be used to set a prefix to all
* commands passed to exec. This can be used on systems that need assistance to
* execute a particular file type. For example on windows this can be set to
* "perl" so that perl scripts are executed.
*
* The "Path" init param is passed to the exec environment as PATH. Note: Must
* be run unpacked somewhere in the filesystem.
*
* Any initParameter that starts with ENV_ is used to set an environment
* variable with the name stripped of the leading ENV_ and using the init
* parameter value.
-->
<Configure class="org.eclipse.jetty.servlet.ServletContextHandler">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
<New id="cgiroot" class="java.lang.String">
<Arg>./eepsite/cgi-bin</Arg>
</New>
<Set name="contextPath">/cgi-bin</Set>
<Set name="resourceBase">./eepsite/cgi-bin/</Set>
<Call name="setInitParameter">
<Arg>Path</Arg>
<Arg>/usr/local/bin:/bin:/usr/bin</Arg>
</Call>
<Call name="addServlet">
<Arg>org.eclipse.jetty.servlets.CGI</Arg>
<Arg>/</Arg>
</Call>
<Set name="baseResourceAsString"><Ref refid="cgiroot" /></Set>
<Set name="handler">
<New class="org.eclipse.jetty.server.handler.PathMappingsHandler">
<Call name="addMapping">
<Arg>
<New class="org.eclipse.jetty.http.pathmap.ServletPathSpec"><Arg>/</Arg></New>
</Arg>
<Arg>
<New class="org.eclipse.jetty.fcgi.proxy.FastCGIProxyHandler">
<Arg>(https?)://([^/]+)(.*)</Arg>
<!-- host:port ignored since if using a domain socket, but argument must be here -->
<Arg>http://localhost:9000$3</Arg>
<Arg><Ref refid="cgiroot" /></Arg>
<Set name="scriptPattern"><Call class="java.util.regex.Pattern" name="compile"><Arg>/cgi-bin(.+)</Arg></Call></Set>
<Set name="fastCGISecure">false</Set>
<!-- Remove this line and set the correct port above if using standard sockets -->
<Set name="unixDomainPath"><Call class="java.nio.file.Path" name="of"><Arg>/var/tmp/fcgi-socket-0</Arg></Call></Set>
</New>
</Arg>
</Call>
</New>
</Set>
</Configure>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
Put your custom error pages here.
The following files are recognized:
- 4nn.html, 5nn.html (for example, 404.html)
Served for that specific error code
- "4xx.html"
Served for any error code 400-499 not matched above
- "5xx.html"
Served for any error code 500-599 not matched above
- "000.html"
Served for any error code not matched above
These error pages are only for the base context.
The CGI context has its own error handler.

View File

@@ -35,27 +35,21 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- UNCOMMENT TO ACTIVATE
<context-param>
<param-name>org.eclipse.jetty.servlet.SessionDomain</param-name>
<param-name>org.eclipse.jetty.session.SessionDomain</param-name>
<param-value>127.0.0.1</param-value>
</context-param>
<context-param>
<param-name>org.eclipse.jetty.servlet.SessionPath</param-name>
<param-name>org.eclipse.jetty.session.SessionPath</param-name>
<param-value>/</param-value>
</context-param>
<context-param>
<param-name>org.eclipse.jetty.servlet.MaxAge</param-name>
<param-name>org.eclipse.jetty.session.MaxAge</param-name>
<param-value>-1</param-value>
</context-param>
-->
<context-param>
<param-name>org.eclipse.jetty.webapp.NoTLDJarPattern</param-name>
<param-value>start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar</param-value>
</context-param>
<!-- ==================================================================== -->
<!-- The default servlet. -->
@@ -112,7 +106,7 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<servlet-class>org.eclipse.jetty.ee8.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>acceptRanges</param-name>
<param-value>true</param-value>
@@ -306,7 +300,7 @@
<!-- Uncomment for dynamic invocation
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.Invoker</servlet-class>
<servlet-class>org.eclipse.jetty.ee8.servlet.Invoker</servlet-class>
<init-param>
<param-name>verbose</param-name>
<param-value>false</param-value>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">

View File

@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- =============================================================== -->
<!-- Mixin the RewriteHandler -->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- This configuration supports Jetty 9. Do not remove this line. -->
<!-- This configuration supports Jetty 12. Do not remove this line. -->
<!-- ========================================================================= -->
<!-- If you have a 'split' directory installation, with configuration -->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- This configuration supports Jetty 9. Do not remove this line. -->
<!-- This configuration supports Jetty 12. Do not remove this line. -->
<!-- ========================================================================= -->
<!-- This file configures the Jetty server. -->
@@ -154,23 +154,14 @@
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
<Set name="defaultHandler">
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
<Set name="showContexts">false</Set>
</New>
</Set>
<Set name="handler">
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Set>
<!-- =============================================================== -->
<!-- Create the deployment manager -->
@@ -189,14 +180,33 @@
<Set name="contexts">
<Ref refid="Contexts" />
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/.*jsp-api-[^/]*\.jar$|.*/.*jsp-[^/]*\.jar$|.*/.*taglibs[^/]*\.jar$</Arg>
</Call>
</New>
</Arg>
</Call>
<!-- Setup ee8 environment -->
<!-- First call needed to initialize the class and prevent NPE -->
<Call class="org.eclipse.jetty.util.component.Environment" name="get" >
<Arg>foo</Arg>
</Call>
<New id="EBuilder" class="org.eclipse.jetty.xml.EnvironmentBuilder" >
<Arg>ee8</Arg>
</New>
<Ref refid="EBuilder">
<Call id="Environment" name="build" />
</Ref>
<Ref refid="Environment">
<Call class="org.eclipse.jetty.util.Attributes" name="setAttribute">
<Arg>contextHandlerClass</Arg>
<Arg>org.eclipse.jetty.ee8.webapp.WebAppContext</Arg>
</Call>
</Ref>
<Call class="org.eclipse.jetty.util.component.Environment" name="set" >
<Arg>
<Ref refid="Environment"/>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure the context deployer -->
<!-- A context deployer will deploy contexts described in -->
@@ -211,7 +221,10 @@
<Ref refid="DeploymentManager">
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<New class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="EnvironmentName">ee8</Set>
<Set name="parentLoaderPriority">true</Set>
<Set name="configurationClasses" property="jetty.deploy.configurationClasses" />
<Set name="monitoredDirName">./eepsite/contexts</Set>
<Set name="scanInterval">120</Set>
</New>
@@ -235,9 +248,11 @@
<Ref refid="DeploymentManager">
<Call id="webappprovider" name="addAppProvider">
<Arg>
<New id="WebAppProvider" class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<New id="WebAppProvider" class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="EnvironmentName">ee8</Set>
<Set name="parentLoaderPriority">true</Set>
<Set name="configurationClasses" property="jetty.deploy.configurationClasses" />
<Set name="monitoredDirName">./eepsite/webapps</Set>
<Set name="parentLoaderPriority">false</Set>
<!-- this is required because Jetty can't handle jars inside wars,
for example in php-java-bridge's JavaBridgeTemplate.war
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=433708
@@ -299,7 +314,6 @@
<!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
<!-- for an example). -->
<!-- =========================================================== -->
<Ref refid="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="net.i2p.jetty.I2PRequestLog">
<Set name="filename">./eepsite/logs/yyyy_mm_dd.request.log</Set>
@@ -313,7 +327,6 @@
<Set name="b64">false</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- extra options -->

View File

@@ -1,20 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>
<p>19 May, 2009</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). The Content is dual licensed and is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 (&quot;EPL&quot;) as well as the Apache Software License Version 2.0. A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. A copy of the ASL is available at <a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>. For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise indicated below, the terms and conditions of the EPL still apply to any source code in the Content and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
</body>
</html>

View File

@@ -1,319 +0,0 @@
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="ProgId" content="Word.Document">
<meta name="Generator" content="Microsoft Word 9">
<meta name="Originator" content="Microsoft Word 9">
<title>Eclipse Public License - Version 1.0</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Revision>2</o:Revision>
<o:TotalTime>3</o:TotalTime>
<o:Created>2004-03-05T23:03:00Z</o:Created>
<o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
<o:Pages>4</o:Pages>
<o:Words>1626</o:Words>
<o:Characters>9270</o:Characters>
<o:Lines>77</o:Lines>
<o:Paragraphs>18</o:Paragraphs>
<o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
<o:Version>9.4402</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:TrackRevisions/>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:553679495 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p
{margin-right:0in;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p.BalloonText, li.BalloonText, div.BalloonText
{mso-style-name:"Balloon Text";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:8.0pt;
font-family:Tahoma;
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head><body style="" lang="EN-US">
<div class="Section1">
<p style="text-align: center;" align="center"><b>Eclipse Public License - v 1.0</b>
</p>
<p><span style="font-size: 10pt;">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
OF THIS AGREEMENT.</span> </p>
<p><b><span style="font-size: 10pt;">1. DEFINITIONS</span></b> </p>
<p><span style="font-size: 10pt;">"Contribution" means:</span> </p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and<br clear="left">
b) in the case of each subsequent Contributor:</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i)
changes to the Program, and</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii)
additions to the Program;</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">where
such changes and/or additions to the Program originate from and are distributed
by that particular Contributor. A Contribution 'originates' from a Contributor
if it was added to the Program by such Contributor itself or anyone acting on
such Contributor's behalf. Contributions do not include additions to the
Program which: (i) are separate modules of software distributed in conjunction
with the Program under their own license agreement, and (ii) are not derivative
works of the Program. </span></p>
<p><span style="font-size: 10pt;">"Contributor" means any person or
entity that distributes the Program.</span> </p>
<p><span style="font-size: 10pt;">"Licensed Patents " mean patent
claims licensable by a Contributor which are necessarily infringed by the use
or sale of its Contribution alone or when combined with the Program. </span></p>
<p><span style="font-size: 10pt;">"Program" means the Contributions
distributed in accordance with this Agreement.</span> </p>
<p><span style="font-size: 10pt;">"Recipient" means anyone who
receives the Program under this Agreement, including all Contributors.</span> </p>
<p><b><span style="font-size: 10pt;">2. GRANT OF RIGHTS</span></b> </p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
Subject to the terms of this Agreement, each Contributor hereby grants Recipient
a non-exclusive, worldwide, royalty-free copyright license to<span style="color: red;"> </span>reproduce, prepare derivative works of, publicly
display, publicly perform, distribute and sublicense the Contribution of such
Contributor, if any, and such derivative works, in source code and object code
form.</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b)
Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide,<span style="color: green;"> </span>royalty-free
patent license under Licensed Patents to make, use, sell, offer to sell, import
and otherwise transfer the Contribution of such Contributor, if any, in source
code and object code form. This patent license shall apply to the combination
of the Contribution and the Program if, at the time the Contribution is added
by the Contributor, such addition of the Contribution causes such combination
to be covered by the Licensed Patents. The patent license shall not apply to
any other combinations which include the Contribution. No hardware per se is
licensed hereunder. </span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">c)
Recipient understands that although each Contributor grants the licenses to its
Contributions set forth herein, no assurances are provided by any Contributor
that the Program does not infringe the patent or other intellectual property
rights of any other entity. Each Contributor disclaims any liability to Recipient
for claims brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the rights and
licenses granted hereunder, each Recipient hereby assumes sole responsibility
to secure any other intellectual property rights needed, if any. For example,
if a third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license before
distributing the Program.</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">d)
Each Contributor represents that to its knowledge it has sufficient copyright
rights in its Contribution, if any, to grant the copyright license set forth in
this Agreement. </span></p>
<p><b><span style="font-size: 10pt;">3. REQUIREMENTS</span></b> </p>
<p><span style="font-size: 10pt;">A Contributor may choose to distribute the
Program in object code form under its own license agreement, provided that:</span>
</p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
it complies with the terms and conditions of this Agreement; and</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b)
its license agreement:</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i)
effectively disclaims on behalf of all Contributors all warranties and
conditions, express and implied, including warranties or conditions of title
and non-infringement, and implied warranties or conditions of merchantability
and fitness for a particular purpose; </span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii)
effectively excludes on behalf of all Contributors all liability for damages,
including direct, indirect, special, incidental and consequential damages, such
as lost profits; </span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iii)
states that any provisions which differ from this Agreement are offered by that
Contributor alone and not by any other party; and</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iv)
states that source code for the Program is available from such Contributor, and
informs licensees how to obtain it in a reasonable manner on or through a
medium customarily used for software exchange.<span style="color: blue;"> </span></span></p>
<p><span style="font-size: 10pt;">When the Program is made available in source
code form:</span> </p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
it must be made available under this Agreement; and </span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) a
copy of this Agreement must be included with each copy of the Program. </span></p>
<p><span style="font-size: 10pt;">Contributors may not remove or alter any
copyright notices contained within the Program. </span></p>
<p><span style="font-size: 10pt;">Each Contributor must identify itself as the
originator of its Contribution, if any, in a manner that reasonably allows
subsequent Recipients to identify the originator of the Contribution. </span></p>
<p><b><span style="font-size: 10pt;">4. COMMERCIAL DISTRIBUTION</span></b> </p>
<p><span style="font-size: 10pt;">Commercial distributors of software may
accept certain responsibilities with respect to end users, business partners
and the like. While this license is intended to facilitate the commercial use
of the Program, the Contributor who includes the Program in a commercial
product offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes the
Program in a commercial product offering, such Contributor ("Commercial
Contributor") hereby agrees to defend and indemnify every other
Contributor ("Indemnified Contributor") against any losses, damages and
costs (collectively "Losses") arising from claims, lawsuits and other
legal actions brought by a third party against the Indemnified Contributor to
the extent caused by the acts or omissions of such Commercial Contributor in
connection with its distribution of the Program in a commercial product
offering. The obligations in this section do not apply to any claims or Losses
relating to any actual or alleged intellectual property infringement. In order
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
Contributor in writing of such claim, and b) allow the Commercial Contributor
to control, and cooperate with the Commercial Contributor in, the defense and
any related settlement negotiations. The Indemnified Contributor may participate
in any such claim at its own expense.</span> </p>
<p><span style="font-size: 10pt;">For example, a Contributor might include the
Program in a commercial product offering, Product X. That Contributor is then a
Commercial Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance claims and
warranties are such Commercial Contributor's responsibility alone. Under this
section, the Commercial Contributor would have to defend claims against the
other Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.</span> </p>
<p><b><span style="font-size: 10pt;">5. NO WARRANTY</span></b> </p>
<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS
AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
responsible for determining the appropriateness of using and distributing the
Program and assumes all risks associated with its exercise of rights under this
Agreement , including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs or
equipment, and unavailability or interruption of operations. </span></p>
<p><b><span style="font-size: 10pt;">6. DISCLAIMER OF LIABILITY</span></b> </p>
<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS
AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
<p><b><span style="font-size: 10pt;">7. GENERAL</span></b> </p>
<p><span style="font-size: 10pt;">If any provision of this Agreement is invalid
or unenforceable under applicable law, it shall not affect the validity or
enforceability of the remainder of the terms of this Agreement, and without
further action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.</span> </p>
<p><span style="font-size: 10pt;">If Recipient institutes patent litigation
against any entity (including a cross-claim or counterclaim in a lawsuit)
alleging that the Program itself (excluding combinations of the Program with
other software or hardware) infringes such Recipient's patent(s), then such
Recipient's rights granted under Section 2(b) shall terminate as of the date
such litigation is filed. </span></p>
<p><span style="font-size: 10pt;">All Recipient's rights under this Agreement
shall terminate if it fails to comply with any of the material terms or
conditions of this Agreement and does not cure such failure in a reasonable
period of time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use and
distribution of the Program as soon as reasonably practicable. However,
Recipient's obligations under this Agreement and any licenses granted by
Recipient relating to the Program shall continue and survive. </span></p>
<p><span style="font-size: 10pt;">Everyone is permitted to copy and distribute
copies of this Agreement, but in order to avoid inconsistency the Agreement is
copyrighted and may only be modified in the following manner. The Agreement
Steward reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement Steward has
the right to modify this Agreement. The Eclipse Foundation is the initial
Agreement Steward. The Eclipse Foundation may assign the responsibility to
serve as the Agreement Steward to a suitable separate entity. Each new version
of the Agreement will be given a distinguishing version number. The Program
(including Contributions) may always be distributed subject to the version of
the Agreement under which it was received. In addition, after a new version of
the Agreement is published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. Except as expressly stated
in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
the intellectual property of any Contributor under this Agreement, whether
expressly, by implication, estoppel or otherwise. All rights in the Program not
expressly granted under this Agreement are reserved.</span> </p>
<p><span style="font-size: 10pt;">This Agreement is governed by the laws of the
State of New York and the intellectual property laws of the United States of
America. No party to this Agreement will bring a legal action under this
Agreement more than one year after the cause of action arose. Each party waives
its rights to a jury trial in any resulting litigation.</span> </p>
<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
</div>
</body></html>

483
licenses/LICENSE-Jetty.txt Normal file
View File

@@ -0,0 +1,483 @@
Eclipse Public License - v 2.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial content
Distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from
and are Distributed by that particular Contributor. A Contribution
"originates" from a Contributor if it was added to the Program by
such Contributor itself or anyone acting on such Contributor's behalf.
Contributions do not include changes or additions to the Program that
are not Modified Works.
"Contributor" means any person or entity that Distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which
are necessarily infringed by the use or sale of its Contribution alone
or when combined with the Program.
"Program" means the Contributions Distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement
or any Secondary License (as applicable), including Contributors.
"Derivative Works" shall mean any work, whether in Source Code or other
form, that is based on (or derived from) the Program and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship.
"Modified Works" shall mean any work in Source Code or other form that
results from an addition to, deletion from, or modification of the
contents of the Program, including, for purposes of clarity any new file
in Source Code form that contains any contents of the Program. Modified
Works shall not include works that contain only declarations,
interfaces, types, classes, structures, or files of the Program solely
in each case in order to link to, bind by name, or subclass the Program
or Modified Works thereof.
"Distribute" means the acts of a) distributing or b) making available
in any manner that enables the transfer of a copy.
"Source Code" means the form of a Program preferred for making
modifications, including but not limited to software source code,
documentation source, and configuration files.
"Secondary License" means either the GNU General Public License,
Version 2.0, or any later versions of that license, including any
exceptions or additional permissions as identified by the initial
Contributor.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free copyright
license to reproduce, prepare Derivative Works of, publicly display,
publicly perform, Distribute and sublicense the Contribution of such
Contributor, if any, and such Derivative Works.
b) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free patent
license under Licensed Patents to make, use, sell, offer to sell,
import and otherwise transfer the Contribution of such Contributor,
if any, in Source Code or other form. This patent license shall
apply to the combination of the Contribution and the Program if, at
the time the Contribution is added by the Contributor, such addition
of the Contribution causes such combination to be covered by the
Licensed Patents. The patent license shall not apply to any other
combinations which include the Contribution. No hardware per se is
licensed hereunder.
c) Recipient understands that although each Contributor grants the
licenses to its Contributions set forth herein, no assurances are
provided by any Contributor that the Program does not infringe the
patent or other intellectual property rights of any other entity.
Each Contributor disclaims any liability to Recipient for claims
brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the
rights and licenses granted hereunder, each Recipient hereby
assumes sole responsibility to secure any other intellectual
property rights needed, if any. For example, if a third party
patent license is required to allow Recipient to Distribute the
Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
d) Each Contributor represents that to its knowledge it has
sufficient copyright rights in its Contribution, if any, to grant
the copyright license set forth in this Agreement.
e) Notwithstanding the terms of any Secondary License, no
Contributor makes additional grants to any Recipient (other than
those set forth in this Agreement) as a result of such Recipient's
receipt of the Program under the terms of a Secondary License
(if permitted under the terms of Section 3).
3. REQUIREMENTS
3.1 If a Contributor Distributes the Program in any form, then:
a) the Program must also be made available as Source Code, in
accordance with section 3.2, and the Contributor must accompany
the Program with a statement that the Source Code for the Program
is available under this Agreement, and informs Recipients how to
obtain it in a reasonable manner on or through a medium customarily
used for software exchange; and
b) the Contributor may Distribute the Program under a license
different than this Agreement, provided that such license:
i) effectively disclaims on behalf of all other Contributors all
warranties and conditions, express and implied, including
warranties or conditions of title and non-infringement, and
implied warranties or conditions of merchantability and fitness
for a particular purpose;
ii) effectively excludes on behalf of all other Contributors all
liability for damages, including direct, indirect, special,
incidental and consequential damages, such as lost profits;
iii) does not attempt to limit or alter the recipients' rights
in the Source Code under section 3.2; and
iv) requires any subsequent distribution of the Program by any
party to be under a license that satisfies the requirements
of this section 3.
3.2 When the Program is Distributed as Source Code:
a) it must be made available under this Agreement, or if the
Program (i) is combined with other material in a separate file or
files made available under a Secondary License, and (ii) the initial
Contributor attached to the Source Code the notice described in
Exhibit A of this Agreement, then the Program may be made available
under the terms of such Secondary Licenses, and
b) a copy of this Agreement must be included with each copy of
the Program.
3.3 Contributors may not remove or alter any copyright, patent,
trademark, attribution notices, disclaimers of warranty, or limitations
of liability ("notices") contained within the Program from any copy of
the Program which they Distribute, provided that Contributors may add
their own appropriate notices.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities
with respect to end users, business partners and the like. While this
license is intended to facilitate the commercial use of the Program,
the Contributor who includes the Program in a commercial product
offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes
the Program in a commercial product offering, such Contributor
("Commercial Contributor") hereby agrees to defend and indemnify every
other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits
and other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such
Commercial Contributor in connection with its distribution of the Program
in a commercial product offering. The obligations in this section do not
apply to any claims or Losses relating to any actual or alleged
intellectual property infringement. In order to qualify, an Indemnified
Contributor must: a) promptly notify the Commercial Contributor in
writing of such claim, and b) allow the Commercial Contributor to control,
and cooperate with the Commercial Contributor in, the defense and any
related settlement negotiations. The Indemnified Contributor may
participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial
product offering, Product X. That Contributor is then a Commercial
Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance
claims and warranties are such Commercial Contributor's responsibility
alone. Under this section, the Commercial Contributor would have to
defend claims against the other Contributors related to those performance
claims and warranties, and if a court requires any other Contributor to
pay any damages as a result, the Commercial Contributor must pay
those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. Each Recipient is solely responsible for determining the
appropriateness of using and distributing the Program and assumes all
risks associated with its exercise of rights under this Agreement,
including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs
or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this Agreement, and without further
action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that the
Program itself (excluding combinations of the Program with other software
or hardware) infringes such Recipient's patent(s), then such Recipient's
rights granted under Section 2(b) shall terminate as of the date such
litigation is filed.
All Recipient's rights under this Agreement shall terminate if it
fails to comply with any of the material terms or conditions of this
Agreement and does not cure such failure in a reasonable period of
time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use
and distribution of the Program as soon as reasonably practicable.
However, Recipient's obligations under this Agreement and any licenses
granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement,
but in order to avoid inconsistency the Agreement is copyrighted and
may only be modified in the following manner. The Agreement Steward
reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement
Steward has the right to modify this Agreement. The Eclipse Foundation
is the initial Agreement Steward. The Eclipse Foundation may assign the
responsibility to serve as the Agreement Steward to a suitable separate
entity. Each new version of the Agreement will be given a distinguishing
version number. The Program (including Contributions) may always be
Distributed subject to the version of the Agreement under which it was
received. In addition, after a new version of the Agreement is published,
Contributor may elect to Distribute the Program (including its
Contributions) under the new version.
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
receives no rights or licenses to the intellectual property of any
Contributor under this Agreement, whether expressly, by implication,
estoppel or otherwise. All rights in the Program not expressly granted
under this Agreement are reserved. Nothing in this Agreement is intended
to be enforceable by any entity that is not a Contributor or Recipient.
No third-party beneficiary rights are created under this Agreement.
Exhibit A - Form of Secondary Licenses Notice
"This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set forth
in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
version(s), and exceptions or additional permissions here}."
Simply including a copy of this Agreement, including this Exhibit A
is not sufficient to license the Source Code under Secondary Licenses.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to
look for such a notice.
You may add additional accurate notices of copyright ownership.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0

View File

@@ -1,111 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Eclipse.org Software User Agreement</title>
</head><body lang="EN-US" link="blue" vlink="purple">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>March 17, 2005</p>
<h3>Usage Of Content</h3>
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
<h3>Applicable Licenses</h3>
<p>Unless otherwise indicated, all Content made available by the
Eclipse Foundation is provided to you under the terms and conditions of
the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is
provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, "Program" will mean the Content.</p>
<p>Content includes, but is not limited to, source code, object code,
documentation and other files maintained in the Eclipse.org CVS
repository ("Repository") in CVS modules ("Modules") and made available
as downloadable archives ("Downloads").</p>
<ul>
<li>Content may be structured and packaged into modules to
facilitate delivering, extending, and upgrading the Content. Typical
modules may include plug-ins ("Plug-ins"), plug-in fragments
("Fragments"), and features ("Features").</li>
<li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&#8482; ARchive) in a directory named "plugins".</li>
<li>A
Feature is a bundle of one or more Plug-ins and/or Fragments and
associated material. Each Feature may be packaged as a sub-directory in
a directory named "features". Within a Feature, files named
"feature.xml" may contain a list of the names and version numbers of
the Plug-ins and/or Fragments associated with that Feature.</li>
<li>Features
may also include other Features ("Included Features"). Within a
Feature, files named "feature.xml" may contain a list of the names and
version numbers of Included Features.</li>
</ul>
<p>The terms and conditions governing Plug-ins and Fragments should be
contained in files named "about.html" ("Abouts"). The terms and
conditions governing Features and
Included Features should be contained in files named "license.html"
("Feature Licenses"). Abouts and Feature Licenses may be located in any
directory of a Download or Module
including, but not limited to the following locations:</p>
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
<li>Inside Plug-ins and Fragments packaged as JARs</li>
<li>Sub-directories of the directory named "src" of certain Plug-ins</li>
<li>Feature directories</li>
</ul>
<p>Note: if a Feature made available by the Eclipse Foundation is
installed using the Eclipse Update Manager, you must agree to a license
("Feature Update License") during the
installation process. If the Feature contains Included Features, the
Feature Update License should either provide you with the terms and
conditions governing the Included Features or
inform you where you can locate them. Feature Update Licenses may be
found in the "license" property of files named "feature.properties"
found within a Feature.
Such Abouts, Feature Licenses, and Feature Update Licenses contain the
terms and conditions (or references to such terms and conditions) that
govern your use of the associated Content in
that directory.</p>
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER
TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
CONDITIONS. SOME OF THESE
OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
<ul>
<li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
<li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
<li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
<li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
<li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
<li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
</ul>
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
or Feature Update License is provided, please
contact the Eclipse Foundation to determine what terms and conditions
govern that particular Content.</p>
<h3>Cryptography</h3>
<p>Content may contain encryption software. The country in which you
are currently may have restrictions on the import, possession, and use,
and/or re-export to another country, of encryption software. BEFORE
using any encryption software, please check the country's laws,
regulations and policies concerning the import, possession, or use, and
re-export of encryption software, to see if this is permitted.</p>
<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
</body></html>

93
licenses/NOTICE-Jetty.txt Normal file
View File

@@ -0,0 +1,93 @@
Notices for Eclipse Jetty
=========================
This content is produced and maintained by the Eclipse Jetty project.
Project home: https://jetty.org/
Trademarks
----------
Eclipse Jetty, and Jetty are trademarks of the Eclipse Foundation.
Copyright
---------
All contributions are the property of the respective authors or of
entities to which copyright has been assigned by the authors (eg. employer).
Declared Project Licenses
-------------------------
This artifacts of this project are made available under the terms of:
* the Eclipse Public License v2.0
https://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
or
* the Apache License, Version 2.0
https://www.apache.org/licenses/LICENSE-2.0
SPDX-License-Identifier: Apache-2.0
The following dependencies are EPL.
* org.eclipse.jetty.orbit:org.eclipse.jdt.core
The following dependencies are EPL and ASL2.
* org.eclipse.jetty.orbit:javax.security.auth.message
The following dependencies are EPL and CDDL 1.0.
* org.eclipse.jetty.orbit:javax.mail.glassfish
The following dependencies are CDDL + GPLv2 with classpath exception.
https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html
* jakarta.servlet:jakarta.servlet-api
* javax.annotation:javax.annotation-api
* javax.transaction:javax.transaction-api
* javax.websocket:javax.websocket-api
The following dependencies are licensed by the OW2 Foundation according to the
terms of http://asm.ow2.org/license.html
* org.ow2.asm:asm-commons
* org.ow2.asm:asm
The following dependencies are ASL2 licensed.
* org.apache.taglibs:taglibs-standard-spec
* org.apache.taglibs:taglibs-standard-impl
The following dependencies are ASL2 licensed. Based on selected classes from
following Apache Tomcat jars, all ASL2 licensed.
* org.mortbay.jasper:apache-jsp
* org.apache.tomcat:tomcat-jasper
* org.apache.tomcat:tomcat-juli
* org.apache.tomcat:tomcat-jsp-api
* org.apache.tomcat:tomcat-el-api
* org.apache.tomcat:tomcat-jasper-el
* org.apache.tomcat:tomcat-api
* org.apache.tomcat:tomcat-util-scan
* org.apache.tomcat:tomcat-util
* org.mortbay.jasper:apache-el
* org.apache.tomcat:tomcat-jasper-el
* org.apache.tomcat:tomcat-el-api
The following artifacts are CDDL + GPLv2 with classpath exception.
https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html
* org.eclipse.jetty.toolchain:jetty-schemas
Cryptography
------------
Content may contain encryption software. The country in which you are currently
may have restrictions on the import, possession, and use, and/or re-export to
another country, of encryption software. BEFORE using any encryption software,
please check the country's laws, regulations and policies concerning the import,
possession, or use, and re-export of encryption software, to see if this is
permitted.
The UnixCrypt.java code implements the one way cryptography used by
Unix systems for simple password protection. Copyright 1996 Aki Yoshida,
modified April 2001 by Iris Van den Broeke, Daniel Deville.
Permission to use, copy, modify and distribute UnixCrypt
for non-commercial or commercial purposes and without fee is
granted provided that the copyright notice appears in all copies.