mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-14 18:03:44 +00:00
8344229: Revisit SecurityManager usage in jdk.httpserver after JEP 486 integration
Reviewed-by: dfuchs
This commit is contained in:
parent
923321cfb1
commit
16ef6e2a18
@ -31,8 +31,6 @@ import com.sun.net.httpserver.HttpsServer;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.ServiceLoader;
|
||||
@ -83,12 +81,7 @@ public abstract class HttpServerProvider {
|
||||
/**
|
||||
* Initializes a new instance of this class.
|
||||
*/
|
||||
protected HttpServerProvider() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("httpServerProvider"));
|
||||
}
|
||||
protected HttpServerProvider() {}
|
||||
|
||||
private static boolean loadProviderFromProperty() {
|
||||
String cn = System.getProperty("com.sun.net.httpserver.HttpServerProvider");
|
||||
@ -107,8 +100,7 @@ public abstract class HttpServerProvider {
|
||||
NoSuchMethodException |
|
||||
ClassNotFoundException |
|
||||
IllegalAccessException |
|
||||
InstantiationException |
|
||||
SecurityException x) {
|
||||
InstantiationException x) {
|
||||
throw new ServiceConfigurationError(null, x);
|
||||
}
|
||||
}
|
||||
@ -118,20 +110,10 @@ public abstract class HttpServerProvider {
|
||||
ServiceLoader.load(HttpServerProvider.class,
|
||||
ClassLoader.getSystemClassLoader())
|
||||
.iterator();
|
||||
for (;;) {
|
||||
try {
|
||||
if (!i.hasNext())
|
||||
return false;
|
||||
provider = i.next();
|
||||
return true;
|
||||
} catch (ServiceConfigurationError sce) {
|
||||
if (sce.getCause() instanceof SecurityException) {
|
||||
// Ignore the security exception, try the next provider
|
||||
continue;
|
||||
}
|
||||
throw sce;
|
||||
}
|
||||
}
|
||||
if (!i.hasNext())
|
||||
return false;
|
||||
provider = i.next();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,22 +152,16 @@ public abstract class HttpServerProvider {
|
||||
*
|
||||
* @return The system-wide default HttpServerProvider
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static HttpServerProvider provider () {
|
||||
synchronized (lock) {
|
||||
if (provider != null)
|
||||
return provider;
|
||||
return (HttpServerProvider)AccessController
|
||||
.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
if (loadProviderFromProperty())
|
||||
return provider;
|
||||
if (loadProviderAsService())
|
||||
return provider;
|
||||
provider = new sun.net.httpserver.DefaultHttpServerProvider();
|
||||
return provider;
|
||||
}
|
||||
});
|
||||
if (loadProviderFromProperty())
|
||||
return provider;
|
||||
if (loadProviderAsService())
|
||||
return provider;
|
||||
provider = new sun.net.httpserver.DefaultHttpServerProvider();
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,12 +27,6 @@ package sun.net.httpserver;
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
import java.io.*;
|
||||
import java.nio.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.*;
|
||||
import javax.security.auth.*;
|
||||
import javax.security.auth.callback.*;
|
||||
import javax.security.auth.login.*;
|
||||
|
||||
public class AuthFilter extends Filter {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,14 +27,9 @@ package sun.net.httpserver;
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.*;
|
||||
import java.security.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
import com.sun.net.httpserver.spi.*;
|
||||
|
||||
public class HttpServerImpl extends HttpServer {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,14 +27,9 @@ package sun.net.httpserver;
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.*;
|
||||
import java.security.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
import com.sun.net.httpserver.spi.*;
|
||||
|
||||
public class HttpsServerImpl extends HttpsServer {
|
||||
|
||||
|
||||
@ -27,14 +27,11 @@ package sun.net.httpserver;
|
||||
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* Parameters that users will not likely need to set
|
||||
* but are useful for debugging
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
class ServerConfig {
|
||||
|
||||
private static final int DEFAULT_IDLE_TIMER_SCHEDULE_MILLIS = 10000 ; // 10 sec.
|
||||
@ -52,94 +49,73 @@ class ServerConfig {
|
||||
private static final int DEFAULT_MAX_REQ_HEADER_SIZE = 380 * 1024;
|
||||
private static final long DEFAULT_DRAIN_AMOUNT = 64 * 1024;
|
||||
|
||||
private static long idleTimerScheduleMillis;
|
||||
private static long idleIntervalMillis;
|
||||
private static final long idleTimerScheduleMillis;
|
||||
private static final long idleIntervalMillis;
|
||||
// The maximum number of bytes to drain from an inputstream
|
||||
private static long drainAmount;
|
||||
private static final long drainAmount;
|
||||
// the maximum number of connections that the server will allow to be open
|
||||
// after which it will no longer "accept()" any new connections, till the
|
||||
// current connection count goes down due to completion of processing the requests
|
||||
private static int maxConnections;
|
||||
private static int maxIdleConnections;
|
||||
private static final int maxConnections;
|
||||
private static final int maxIdleConnections;
|
||||
// The maximum number of request headers allowable
|
||||
private static int maxReqHeaders;
|
||||
private static final int maxReqHeaders;
|
||||
// a maximum value for the header list size. This is the
|
||||
// names size + values size + 32 bytes per field line
|
||||
private static int maxReqHeadersSize;
|
||||
private static final int maxReqHeadersSize;
|
||||
// max time a request or response is allowed to take
|
||||
private static long maxReqTime;
|
||||
private static long maxRspTime;
|
||||
private static long reqRspTimerScheduleMillis;
|
||||
private static boolean debug;
|
||||
private static final long maxReqTime;
|
||||
private static final long maxRspTime;
|
||||
private static final long reqRspTimerScheduleMillis;
|
||||
private static final boolean debug;
|
||||
|
||||
// the value of the TCP_NODELAY socket-level option
|
||||
private static boolean noDelay;
|
||||
private static final boolean noDelay;
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new PrivilegedAction<Void>() {
|
||||
@Override
|
||||
public Void run () {
|
||||
idleIntervalMillis = Long.getLong("sun.net.httpserver.idleInterval",
|
||||
DEFAULT_IDLE_INTERVAL_IN_SECS) * 1000;
|
||||
if (idleIntervalMillis <= 0) {
|
||||
idleIntervalMillis = DEFAULT_IDLE_INTERVAL_IN_SECS * 1000;
|
||||
}
|
||||
|
||||
idleTimerScheduleMillis = Long.getLong("sun.net.httpserver.clockTick",
|
||||
DEFAULT_IDLE_TIMER_SCHEDULE_MILLIS);
|
||||
if (idleTimerScheduleMillis <= 0) {
|
||||
// ignore zero or negative value and use the default schedule
|
||||
idleTimerScheduleMillis = DEFAULT_IDLE_TIMER_SCHEDULE_MILLIS;
|
||||
}
|
||||
long providedIdleIntervalMillis =
|
||||
Long.getLong("sun.net.httpserver.idleInterval", DEFAULT_IDLE_INTERVAL_IN_SECS) * 1000;
|
||||
idleIntervalMillis = providedIdleIntervalMillis > 0
|
||||
? providedIdleIntervalMillis
|
||||
: Math.multiplyExact(DEFAULT_IDLE_INTERVAL_IN_SECS, 1000);
|
||||
|
||||
maxConnections = Integer.getInteger(
|
||||
"jdk.httpserver.maxConnections",
|
||||
DEFAULT_MAX_CONNECTIONS);
|
||||
long providedIdleTimerScheduleMillis =
|
||||
Long.getLong("sun.net.httpserver.clockTick", DEFAULT_IDLE_TIMER_SCHEDULE_MILLIS);
|
||||
// Ignore zero or negative value and use the default schedule
|
||||
idleTimerScheduleMillis = providedIdleTimerScheduleMillis > 0
|
||||
? providedIdleTimerScheduleMillis
|
||||
: DEFAULT_IDLE_TIMER_SCHEDULE_MILLIS;
|
||||
|
||||
maxIdleConnections = Integer.getInteger(
|
||||
"sun.net.httpserver.maxIdleConnections",
|
||||
DEFAULT_MAX_IDLE_CONNECTIONS);
|
||||
maxConnections = Integer.getInteger("jdk.httpserver.maxConnections", DEFAULT_MAX_CONNECTIONS);
|
||||
|
||||
drainAmount = Long.getLong("sun.net.httpserver.drainAmount",
|
||||
DEFAULT_DRAIN_AMOUNT);
|
||||
maxIdleConnections = Integer.getInteger("sun.net.httpserver.maxIdleConnections", DEFAULT_MAX_IDLE_CONNECTIONS);
|
||||
|
||||
maxReqHeaders = Integer.getInteger(
|
||||
"sun.net.httpserver.maxReqHeaders",
|
||||
DEFAULT_MAX_REQ_HEADERS);
|
||||
if (maxReqHeaders <= 0) {
|
||||
maxReqHeaders = DEFAULT_MAX_REQ_HEADERS;
|
||||
}
|
||||
drainAmount = Long.getLong("sun.net.httpserver.drainAmount", DEFAULT_DRAIN_AMOUNT);
|
||||
|
||||
// a value <= 0 means unlimited
|
||||
maxReqHeadersSize = Integer.getInteger(
|
||||
"sun.net.httpserver.maxReqHeaderSize",
|
||||
DEFAULT_MAX_REQ_HEADER_SIZE);
|
||||
if (maxReqHeadersSize <= 0) {
|
||||
maxReqHeadersSize = 0;
|
||||
}
|
||||
int providedMaxReqHeaders = Integer.getInteger("sun.net.httpserver.maxReqHeaders", DEFAULT_MAX_REQ_HEADERS);
|
||||
maxReqHeaders = providedMaxReqHeaders > 0 ? providedMaxReqHeaders : DEFAULT_MAX_REQ_HEADERS;
|
||||
|
||||
maxReqTime = Long.getLong("sun.net.httpserver.maxReqTime",
|
||||
DEFAULT_MAX_REQ_TIME);
|
||||
// A value <= 0 means unlimited
|
||||
maxReqHeadersSize = Math.max(
|
||||
Integer.getInteger("sun.net.httpserver.maxReqHeaderSize", DEFAULT_MAX_REQ_HEADER_SIZE),
|
||||
0);
|
||||
|
||||
maxRspTime = Long.getLong("sun.net.httpserver.maxRspTime",
|
||||
DEFAULT_MAX_RSP_TIME);
|
||||
maxReqTime = Long.getLong("sun.net.httpserver.maxReqTime", DEFAULT_MAX_REQ_TIME);
|
||||
|
||||
reqRspTimerScheduleMillis = Long.getLong("sun.net.httpserver.timerMillis",
|
||||
DEFAULT_REQ_RSP_TIMER_TASK_SCHEDULE_MILLIS);
|
||||
if (reqRspTimerScheduleMillis <= 0) {
|
||||
// ignore any negative or zero value for this configuration and reset
|
||||
// to default schedule
|
||||
reqRspTimerScheduleMillis = DEFAULT_REQ_RSP_TIMER_TASK_SCHEDULE_MILLIS;
|
||||
}
|
||||
maxRspTime = Long.getLong("sun.net.httpserver.maxRspTime", DEFAULT_MAX_RSP_TIME);
|
||||
|
||||
debug = Boolean.getBoolean("sun.net.httpserver.debug");
|
||||
long providedReqRspTimerScheduleMillis = Long.getLong(
|
||||
"sun.net.httpserver.timerMillis",
|
||||
DEFAULT_REQ_RSP_TIMER_TASK_SCHEDULE_MILLIS);
|
||||
// Ignore any negative or zero value for this configuration and reset to default schedule
|
||||
reqRspTimerScheduleMillis = providedReqRspTimerScheduleMillis > 0
|
||||
? providedReqRspTimerScheduleMillis
|
||||
: DEFAULT_REQ_RSP_TIMER_TASK_SCHEDULE_MILLIS;
|
||||
|
||||
noDelay = Boolean.getBoolean("sun.net.httpserver.nodelay");
|
||||
debug = Boolean.getBoolean("sun.net.httpserver.debug");
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
noDelay = Boolean.getBoolean("sun.net.httpserver.nodelay");
|
||||
|
||||
}
|
||||
|
||||
@ -148,39 +124,22 @@ class ServerConfig {
|
||||
// legacy properties that are no longer used
|
||||
// print a warning to logger if they are set.
|
||||
|
||||
java.security.AccessController.doPrivileged(
|
||||
new PrivilegedAction<Void>() {
|
||||
public Void run () {
|
||||
if (System.getProperty("sun.net.httpserver.readTimeout")
|
||||
!=null)
|
||||
{
|
||||
logger.log (Level.WARNING,
|
||||
"sun.net.httpserver.readTimeout "+
|
||||
"property is no longer used. "+
|
||||
"Use sun.net.httpserver.maxReqTime instead."
|
||||
);
|
||||
}
|
||||
if (System.getProperty("sun.net.httpserver.writeTimeout")
|
||||
!=null)
|
||||
{
|
||||
logger.log (Level.WARNING,
|
||||
"sun.net.httpserver.writeTimeout "+
|
||||
"property is no longer used. Use "+
|
||||
"sun.net.httpserver.maxRspTime instead."
|
||||
);
|
||||
}
|
||||
if (System.getProperty("sun.net.httpserver.selCacheTimeout")
|
||||
!=null)
|
||||
{
|
||||
logger.log (Level.WARNING,
|
||||
"sun.net.httpserver.selCacheTimeout "+
|
||||
"property is no longer used."
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (System.getProperty("sun.net.httpserver.readTimeout") != null) {
|
||||
logger.log(
|
||||
Level.WARNING,
|
||||
"sun.net.httpserver.readTimeout property is no longer used. " +
|
||||
"Use sun.net.httpserver.maxReqTime instead.");
|
||||
}
|
||||
if (System.getProperty("sun.net.httpserver.writeTimeout") != null) {
|
||||
logger.log(
|
||||
Level.WARNING,
|
||||
"sun.net.httpserver.writeTimeout property is no longer used. " +
|
||||
"Use sun.net.httpserver.maxRspTime instead.");
|
||||
}
|
||||
if (System.getProperty("sun.net.httpserver.selCacheTimeout") != null) {
|
||||
logger.log(Level.WARNING, "sun.net.httpserver.selCacheTimeout property is no longer used.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static boolean debugEnabled() {
|
||||
|
||||
@ -53,8 +53,6 @@ import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.Selector;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@ -304,16 +302,8 @@ class ServerImpl {
|
||||
logger.log (Level.DEBUG, "context removed: " + context.getPath());
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public InetSocketAddress getAddress() {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<InetSocketAddress>() {
|
||||
public InetSocketAddress run() {
|
||||
return
|
||||
(InetSocketAddress)schan.socket()
|
||||
.getLocalSocketAddress();
|
||||
}
|
||||
});
|
||||
return (InetSocketAddress) schan.socket().getLocalSocketAddress();
|
||||
}
|
||||
|
||||
void addEvent (Event r) {
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package sun.net.httpserver.simpleserver;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -67,12 +66,6 @@ public final class FileServerHandler implements HttpHandler {
|
||||
|
||||
private FileServerHandler(Path root, UnaryOperator<String> mimeTable) {
|
||||
root = root.normalize();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
var securityManager = System.getSecurityManager();
|
||||
if (securityManager != null)
|
||||
securityManager.checkRead(pathForSecurityCheck(root.toString()));
|
||||
|
||||
if (!Files.exists(root))
|
||||
throw new IllegalArgumentException("Path does not exist: " + root);
|
||||
if (!root.isAbsolute())
|
||||
@ -86,11 +79,6 @@ public final class FileServerHandler implements HttpHandler {
|
||||
this.logger = System.getLogger("com.sun.net.httpserver");
|
||||
}
|
||||
|
||||
private static String pathForSecurityCheck(String path) {
|
||||
var separator = String.valueOf(File.separatorChar);
|
||||
return path.endsWith(separator) ? (path + "-") : (path + separator + "-");
|
||||
}
|
||||
|
||||
private static final HttpHandler NOT_IMPLEMENTED_HANDLER =
|
||||
HttpHandlers.of(501, Headers.of(), "");
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,8 +26,6 @@
|
||||
package sun.net.httpserver.simpleserver;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
@ -84,15 +82,9 @@ public class JWebServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static void setMaxConnectionsIfNotSet() {
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
if (System.getProperty(SYS_PROP_MAX_CONNECTIONS) != null) {
|
||||
// an explicit value has already been set, so we don't override it
|
||||
return null;
|
||||
}
|
||||
if (System.getProperty(SYS_PROP_MAX_CONNECTIONS) == null) {
|
||||
System.setProperty(SYS_PROP_MAX_CONNECTIONS, DEFAULT_JWEBSERVER_MAX_CONNECTIONS);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -21,13 +21,9 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.logging.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
/**
|
||||
|
||||
@ -31,9 +31,7 @@ import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.net.http.HttpResponse.BodyHandlers;
|
||||
import java.security.AccessController;
|
||||
import java.security.KeyStore;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -359,21 +357,15 @@ public class HttpsParametersClientAuthTest {
|
||||
}
|
||||
|
||||
private static KeyStore loadTestKeyStore() throws Exception {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<KeyStore>() {
|
||||
@Override
|
||||
public KeyStore run() throws Exception {
|
||||
final String testKeys = System.getProperty("test.src")
|
||||
+ "/"
|
||||
+ "../../../../../../test/lib/jdk/test/lib/net/testkeys";
|
||||
try (final FileInputStream fis = new FileInputStream(testKeys)) {
|
||||
final char[] passphrase = "passphrase".toCharArray();
|
||||
final KeyStore ks = KeyStore.getInstance("PKCS12");
|
||||
ks.load(fis, passphrase);
|
||||
return ks;
|
||||
}
|
||||
}
|
||||
});
|
||||
final String testKeys = System.getProperty("test.src")
|
||||
+ "/"
|
||||
+ "../../../../../../test/lib/jdk/test/lib/net/testkeys";
|
||||
try (final FileInputStream fis = new FileInputStream(testKeys)) {
|
||||
final char[] passphrase = "passphrase".toCharArray();
|
||||
final KeyStore ks = KeyStore.getInstance("PKCS12");
|
||||
ks.load(fis, passphrase);
|
||||
return ks;
|
||||
}
|
||||
}
|
||||
|
||||
// no-op implementations of the abstract methods of HttpsParameters
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -21,17 +21,11 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.text.*;
|
||||
import java.io.*;
|
||||
import java.nio.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
import javax.security.auth.*;
|
||||
import javax.security.auth.callback.*;
|
||||
import javax.security.auth.login.*;
|
||||
|
||||
class LogFilter extends Filter {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,12 +36,9 @@ import com.sun.net.httpserver.*;
|
||||
import jdk.test.lib.net.SimpleSSLContext;
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
/* basic http/s connectivity test
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -21,13 +21,11 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.logging.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.security.auth.callback.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.security.auth.callback.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,14 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.regex.*;
|
||||
import java.util.regex.Pattern.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
/**
|
||||
* Test pipe-lining over http
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.regex.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
/**
|
||||
* Test pipe-lining (block after read)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.regex.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
/**
|
||||
* Test pipe-lining (no block)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.security.auth.callback.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.security.auth.callback.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import javax.security.auth.callback.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,14 +32,11 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.logging.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
public class TestLogging extends Test {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
public class B6339483 {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
public class B6341616 {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
public class B6526158 {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,13 +33,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
public class B6526913 {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,13 +31,9 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
public class B6529200 {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
import com.sun.net.httpserver.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.*;
|
||||
import javax.net.ssl.*;
|
||||
|
||||
import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
public class B6744329 {
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Tests for FileServerHandler with SecurityManager
|
||||
* @summary Tests file permission checks during the creation of a `FileServerHandler`
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.net.URIBuilder
|
||||
* @run main/othervm -ea RootDirPermissionsTest true
|
||||
@ -245,7 +245,6 @@ public class RootDirPermissionsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static void testCreateHandler(){
|
||||
try {
|
||||
SimpleFileServer.createFileServer(LOOPBACK_ADDR, TEST_DIR, OutputLevel.NONE);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user