Files
i2p.i2p/debian/patches/0002-jetty-compatibility.patch
2025-05-21 08:08:15 -04:00

86 lines
5.2 KiB
Diff

--- 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);