Merge branch 'jetty-8' into release-8
This commit is contained in:
commit
53e96f3af5
|
@ -323,9 +323,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
|||
{
|
||||
synchronized (this)
|
||||
{
|
||||
_writable=false;
|
||||
if (!_dispatched)
|
||||
updateKey();
|
||||
if (_dispatched)
|
||||
_writable=false;
|
||||
}
|
||||
}
|
||||
else if (l>0)
|
||||
|
@ -349,9 +348,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
|||
{
|
||||
synchronized (this)
|
||||
{
|
||||
_writable=false;
|
||||
if (!_dispatched)
|
||||
updateKey();
|
||||
if (_dispatched)
|
||||
_writable=false;
|
||||
}
|
||||
}
|
||||
else if (l>0)
|
||||
|
|
|
@ -188,20 +188,6 @@ public class HttpServerTestFixture
|
|||
}
|
||||
}
|
||||
|
||||
// Create a trust manager that does not validate certificate chains
|
||||
public final static TrustManager[] __trustAllCerts = new TrustManager[] {
|
||||
new X509TrustManager(){
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
public void checkClientTrusted(
|
||||
java.security.cert.X509Certificate[] certs, String authType) {
|
||||
}
|
||||
public void checkServerTrusted(
|
||||
java.security.cert.X509Certificate[] certs, String authType) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public final static HostnameVerifier __hostnameverifier = new HostnameVerifier()
|
||||
{
|
||||
|
|
|
@ -20,7 +20,8 @@ package org.eclipse.jetty.server.ssl;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -37,8 +38,6 @@ import javax.net.ssl.HostnameVerifier;
|
|||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -81,25 +80,6 @@ public class SSLEngineTest
|
|||
|
||||
private static final int BODY_SIZE=300;
|
||||
|
||||
private static final TrustManager[] s_dummyTrustManagers=new TrustManager[]
|
||||
{
|
||||
new X509TrustManager()
|
||||
{
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
{
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static Server server;
|
||||
private static SslSelectChannelConnector connector;
|
||||
|
||||
|
@ -134,7 +114,7 @@ public class SSLEngineTest
|
|||
public void testBigResponse() throws Exception
|
||||
{
|
||||
SSLContext ctx=SSLContext.getInstance("TLS");
|
||||
ctx.init(null,s_dummyTrustManagers,new java.security.SecureRandom());
|
||||
ctx.init(null,SslContextFactory.TRUST_ALL_CERTS,new java.security.SecureRandom());
|
||||
|
||||
int port=connector.getLocalPort();
|
||||
|
||||
|
@ -152,7 +132,7 @@ public class SSLEngineTest
|
|||
|
||||
String response = IO.toString(client.getInputStream());
|
||||
|
||||
assertTrue(response.length()>102400);
|
||||
assertThat(response.length(),greaterThan(102400));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -164,7 +144,7 @@ public class SSLEngineTest
|
|||
Socket[] client=new Socket[numConns];
|
||||
|
||||
SSLContext ctx=SSLContext.getInstance("SSLv3");
|
||||
ctx.init(null,s_dummyTrustManagers,new java.security.SecureRandom());
|
||||
ctx.init(null,SslContextFactory.TRUST_ALL_CERTS,new java.security.SecureRandom());
|
||||
|
||||
int port=connector.getLocalPort();
|
||||
|
||||
|
@ -231,7 +211,7 @@ public class SSLEngineTest
|
|||
server.start();
|
||||
|
||||
SSLContext context = SSLContext.getInstance("SSL");
|
||||
context.init(null,s_dummyTrustManagers,new java.security.SecureRandom());
|
||||
context.init(null,SslContextFactory.TRUST_ALL_CERTS,new java.security.SecureRandom());
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
|
||||
|
||||
URL url = new URL("https://localhost:"+connector.getLocalPort()+"/test");
|
||||
|
|
|
@ -73,7 +73,7 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
|
|||
{
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(__hostnameverifier);
|
||||
SSLContext sc = SSLContext.getInstance("TLS");
|
||||
sc.init(null, __trustAllCerts, new java.security.SecureRandom());
|
||||
sc.init(null, SslContextFactory.TRUST_ALL_CERTS, new java.security.SecureRandom());
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
}
|
||||
catch(Exception e)
|
||||
|
|
|
@ -37,22 +37,6 @@ public class SslRenegotiateTest
|
|||
{
|
||||
private static final Logger LOG = Log.getLogger(SslRenegotiateTest.class);
|
||||
|
||||
private static final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager()
|
||||
{
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType )
|
||||
{
|
||||
}
|
||||
|
||||
public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType )
|
||||
{
|
||||
}
|
||||
} };
|
||||
|
||||
private ByteBuffer _outAppB;
|
||||
private ByteBuffer _outPacketB;
|
||||
private ByteBuffer _inAppB;
|
||||
|
@ -110,7 +94,7 @@ public class SslRenegotiateTest
|
|||
_socket.configureBlocking(true);
|
||||
|
||||
SSLContext context=SSLContext.getInstance("SSL");
|
||||
context.init( null, trustAllCerts, new java.security.SecureRandom() );
|
||||
context.init( null, SslContextFactory.TRUST_ALL_CERTS, new java.security.SecureRandom() );
|
||||
|
||||
_engine = context.createSSLEngine();
|
||||
_engine.setUseClientMode(true);
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.eclipse.jetty.servlets;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -215,10 +216,18 @@ public class CrossOriginFilter implements Filter
|
|||
{
|
||||
// WebSocket clients such as Chrome 5 implement a version of the WebSocket
|
||||
// protocol that does not accept extra response headers on the upgrade response
|
||||
if ("Upgrade".equalsIgnoreCase(request.getHeader("Connection")) &&
|
||||
"WebSocket".equalsIgnoreCase(request.getHeader("Upgrade")))
|
||||
for (Enumeration connections = request.getHeaders("Connection"); connections.hasMoreElements();)
|
||||
{
|
||||
return false;
|
||||
String connection = (String)connections.nextElement();
|
||||
if ("Upgrade".equalsIgnoreCase(connection))
|
||||
{
|
||||
for (Enumeration upgrades = request.getHeaders("Upgrade"); upgrades.hasMoreElements();)
|
||||
{
|
||||
String upgrade = (String)upgrades.nextElement();
|
||||
if ("WebSocket".equalsIgnoreCase(upgrade))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -663,18 +663,19 @@ public class Main
|
|||
{
|
||||
StringBuilder cmd = new StringBuilder();
|
||||
cmd.append(findJavaBin());
|
||||
for (String x : _jvmArgs)
|
||||
cmd.append(' ').append(x);
|
||||
cmd.append(" -Djetty.home=").append(_jettyHome);
|
||||
for (String x : _jvmArgs) {
|
||||
cmd.append(x);
|
||||
}
|
||||
cmd.append(" -Djetty.home=").append(escapeSpaces(_jettyHome));
|
||||
for (String p : _sysProps)
|
||||
{
|
||||
cmd.append(" -D").append(p);
|
||||
cmd.append(" -D").append(p);
|
||||
String v = System.getProperty(p);
|
||||
if (v != null && v.length() > 0)
|
||||
cmd.append('=').append(v);
|
||||
cmd.append("=").append(escapeSpaces(v));
|
||||
}
|
||||
cmd.append(" -cp ").append(classpath.toString());
|
||||
cmd.append(" ").append(_config.getMainClassname());
|
||||
cmd.append(" -cp ").append(classpath.toString());
|
||||
cmd.append(" ").append(_config.getMainClassname());
|
||||
|
||||
// Check if we need to pass properties as a file
|
||||
Properties properties = Config.getProperties();
|
||||
|
@ -684,16 +685,19 @@ public class Main
|
|||
if (!_dryRun)
|
||||
prop_file.deleteOnExit();
|
||||
properties.store(new FileOutputStream(prop_file),"start.jar properties");
|
||||
cmd.append(" ").append(prop_file.getAbsolutePath());
|
||||
cmd.append(" ").append(escapeSpaces(prop_file.getAbsolutePath()));
|
||||
}
|
||||
|
||||
for (String xml : xmls)
|
||||
{
|
||||
cmd.append(' ').append(xml);
|
||||
}
|
||||
cmd.append(" ").append(escapeSpaces(xml));
|
||||
|
||||
return cmd.toString();
|
||||
}
|
||||
|
||||
private static String escapeSpaces(String s)
|
||||
{
|
||||
return s.replace(" ","\\ ");
|
||||
}
|
||||
|
||||
private String findJavaBin()
|
||||
{
|
||||
|
|
|
@ -13,12 +13,13 @@
|
|||
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -34,18 +35,13 @@ public class MainTest
|
|||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
System.setProperty("jetty.home",this.getClass().getResource("/jetty.home").getFile());
|
||||
File testJettyHome = MavenTestingUtils.getTestResourceDir("jetty.home");
|
||||
System.setProperty("jetty.home",testJettyHome.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.eclipse.jetty.start.StartIniParser#loadStartIni(java.lang.String)}.
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void testLoadStartIni() throws IOException
|
||||
{
|
||||
URL startIni = this.getClass().getResource("/jetty.home/");
|
||||
System.setProperty("jetty.home",startIni.getFile());
|
||||
Main main = new Main();
|
||||
List<String> args = main.parseStartIniFiles();
|
||||
assertEquals("Expected 5 uncommented lines in start.ini",9,args.size());
|
||||
|
|
|
@ -462,52 +462,60 @@ public class UrlEncoded extends MultiMap implements Cloneable
|
|||
int totalLength=0;
|
||||
while ((b=in.read())>=0)
|
||||
{
|
||||
switch ((char) b)
|
||||
try
|
||||
{
|
||||
case '&':
|
||||
value = buffer.length()==0?"":buffer.toString();
|
||||
buffer.reset();
|
||||
if (key != null)
|
||||
{
|
||||
map.add(key,value);
|
||||
}
|
||||
else if (value!=null&&value.length()>0)
|
||||
{
|
||||
map.add(value,"");
|
||||
}
|
||||
key = null;
|
||||
value=null;
|
||||
if (maxKeys>0 && map.size()>maxKeys)
|
||||
{
|
||||
LOG.warn("maxFormKeys limit exceeded keys>{}",maxKeys);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case '=':
|
||||
if (key!=null)
|
||||
{
|
||||
switch ((char) b)
|
||||
{
|
||||
case '&':
|
||||
value = buffer.length()==0?"":buffer.toString();
|
||||
buffer.reset();
|
||||
if (key != null)
|
||||
{
|
||||
map.add(key,value);
|
||||
}
|
||||
else if (value!=null&&value.length()>0)
|
||||
{
|
||||
map.add(value,"");
|
||||
}
|
||||
key = null;
|
||||
value=null;
|
||||
if (maxKeys>0 && map.size()>maxKeys)
|
||||
{
|
||||
LOG.warn("maxFormKeys limit exceeded keys>{}",maxKeys);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case '=':
|
||||
if (key!=null)
|
||||
{
|
||||
buffer.append((byte)b);
|
||||
break;
|
||||
}
|
||||
key = buffer.toString();
|
||||
buffer.reset();
|
||||
break;
|
||||
|
||||
case '+':
|
||||
buffer.append((byte)' ');
|
||||
break;
|
||||
|
||||
case '%':
|
||||
int dh=in.read();
|
||||
int dl=in.read();
|
||||
if (dh<0||dl<0)
|
||||
break;
|
||||
buffer.append((byte)((TypeUtil.convertHexDigit((byte)dh)<<4) + TypeUtil.convertHexDigit((byte)dl)));
|
||||
break;
|
||||
default:
|
||||
buffer.append((byte)b);
|
||||
break;
|
||||
}
|
||||
key = buffer.toString();
|
||||
buffer.reset();
|
||||
break;
|
||||
|
||||
case '+':
|
||||
buffer.append((byte)' ');
|
||||
break;
|
||||
|
||||
case '%':
|
||||
int dh=in.read();
|
||||
int dl=in.read();
|
||||
if (dh<0||dl<0)
|
||||
break;
|
||||
buffer.append((byte)((TypeUtil.convertHexDigit((byte)dh)<<4) + TypeUtil.convertHexDigit((byte)dl)));
|
||||
break;
|
||||
default:
|
||||
buffer.append((byte)b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(NotUtf8Exception e)
|
||||
{
|
||||
LOG.warn(e.toString());
|
||||
LOG.debug(e);
|
||||
}
|
||||
if (maxLength>=0 && (++totalLength > maxLength))
|
||||
throw new IllegalStateException("Form too large");
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.io.IOException;
|
|||
**/
|
||||
public abstract class Utf8Appendable
|
||||
{
|
||||
private final char REPLACEMENT = '\ufffd';
|
||||
public static final char REPLACEMENT = '\ufffd';
|
||||
private static final int UTF8_ACCEPT = 0;
|
||||
private static final int UTF8_REJECT = 12;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class StdErrLog extends AbstractLogger
|
|||
{
|
||||
private static final String EOL = System.getProperty("line.separator");
|
||||
private static DateCache _dateCache;
|
||||
private static Properties __props = Log.__props;
|
||||
private static final Properties __props = new Properties();
|
||||
|
||||
private final static boolean __source = Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.SOURCE",
|
||||
Log.__props.getProperty("org.eclipse.jetty.util.log.stderr.SOURCE","false")));
|
||||
|
@ -45,6 +45,8 @@ public class StdErrLog extends AbstractLogger
|
|||
|
||||
static
|
||||
{
|
||||
__props.putAll(Log.__props);
|
||||
|
||||
String deprecatedProperties[] =
|
||||
{ "DEBUG", "org.eclipse.jetty.util.log.DEBUG", "org.eclipse.jetty.util.log.stderr.DEBUG" };
|
||||
|
||||
|
@ -97,7 +99,8 @@ public class StdErrLog extends AbstractLogger
|
|||
|
||||
public StdErrLog(String name, Properties props)
|
||||
{
|
||||
__props = props;
|
||||
if (props!=null)
|
||||
__props.putAll(props);
|
||||
this._name = name == null?"":name;
|
||||
this._abbrevname = condensePackageString(this._name);
|
||||
this._level = getLoggingLevel(props,this._name);
|
||||
|
@ -603,7 +606,8 @@ public class StdErrLog extends AbstractLogger
|
|||
|
||||
public static void setProperties(Properties props)
|
||||
{
|
||||
__props = props;
|
||||
__props.clear();
|
||||
__props.putAll(props);
|
||||
}
|
||||
|
||||
public void ignore(Throwable ignored)
|
||||
|
|
|
@ -71,6 +71,22 @@ import org.eclipse.jetty.util.security.Password;
|
|||
*/
|
||||
public class SslContextFactory extends AbstractLifeCycle
|
||||
{
|
||||
public final static TrustManager[] TRUST_ALL_CERTS = new X509TrustManager[]{new X509TrustManager()
|
||||
{
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers()
|
||||
{
|
||||
return new java.security.cert.X509Certificate[]{};
|
||||
}
|
||||
|
||||
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
{
|
||||
}
|
||||
}};
|
||||
|
||||
private static final Logger LOG = Log.getLogger(SslContextFactory.class);
|
||||
|
||||
public static final String DEFAULT_KEYMANAGERFACTORY_ALGORITHM =
|
||||
|
@ -229,22 +245,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
|||
{
|
||||
LOG.debug("No keystore or trust store configured. ACCEPTING UNTRUSTED CERTIFICATES!!!!!");
|
||||
// Create a trust manager that does not validate certificate chains
|
||||
TrustManager trustAllCerts = new X509TrustManager()
|
||||
{
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
{
|
||||
}
|
||||
};
|
||||
trust_managers = new TrustManager[] { trustAllCerts };
|
||||
trust_managers = TRUST_ALL_CERTS;
|
||||
}
|
||||
|
||||
SecureRandom secureRandom = (_secureRandomAlgorithm == null)?null:SecureRandom.getInstance(_secureRandomAlgorithm);
|
||||
|
|
|
@ -15,6 +15,7 @@ package org.eclipse.jetty.util;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
@ -69,12 +70,26 @@ public class DateCacheTest
|
|||
|
||||
// Test string is cached
|
||||
dc = new DateCache();
|
||||
String s1=dc.format(System.currentTimeMillis());
|
||||
dc.format(1);
|
||||
String s2=dc.format(System.currentTimeMillis());
|
||||
dc.format(System.currentTimeMillis()+10*60*60);
|
||||
String s3=dc.format(System.currentTimeMillis());
|
||||
assertTrue(s1==s2 || s2==s3);
|
||||
long now = 1000L*(System.currentTimeMillis()%1000L)+123;
|
||||
// format a time for now
|
||||
String s1=dc.format(now);
|
||||
|
||||
// format a time in the past (this should not reset cached date)
|
||||
dc.format(now-2000);
|
||||
|
||||
// format a time a little later than now
|
||||
String s2=dc.format(now+10);
|
||||
|
||||
// format a time in future (this should reset cached data)
|
||||
dc.format(now+2000);
|
||||
|
||||
// format time a little later than now
|
||||
String s3=dc.format(now+20);
|
||||
|
||||
assertEquals(s1,s2);
|
||||
assertEquals(s2,s3);
|
||||
assertTrue(s1==s2);
|
||||
assertFalse(s2==s3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -220,7 +220,6 @@ public class URLEncodedTest
|
|||
*/
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
@Test
|
||||
public void testUtf8()
|
||||
|
@ -236,4 +235,21 @@ public class URLEncodedTest
|
|||
String expected = new String(TypeUtil.fromHexString(hex),"utf-8");
|
||||
assertEquals(expected,url_encoded.get("text"));
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
@Test
|
||||
public void testNotUtf8() throws Exception
|
||||
{
|
||||
String query="name=X%c0%afZ";
|
||||
|
||||
MultiMap<String> map = new MultiMap<String>();
|
||||
|
||||
UrlEncoded.decodeUtf8To(query.getBytes(StringUtil.__ISO_8859_1),0,query.length(),map);
|
||||
assertEquals("X"+Utf8Appendable.REPLACEMENT+Utf8Appendable.REPLACEMENT+"Z",map.getValue("name",0));
|
||||
|
||||
map.clear();
|
||||
|
||||
UrlEncoded.decodeUtf8To(new ByteArrayInputStream(query.getBytes(StringUtil.__ISO_8859_1)),map,100,2);
|
||||
assertEquals("X"+Utf8Appendable.REPLACEMENT+Utf8Appendable.REPLACEMENT+"Z",map.getValue("name",0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,10 +157,12 @@
|
|||
<param-name>useFileMappedBuffer</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
<!--
|
||||
<init-param>
|
||||
<param-name>resourceCache</param-name>
|
||||
<param-value>resourceCache</param-value>
|
||||
</init-param>
|
||||
-->
|
||||
<!--
|
||||
<init-param>
|
||||
<param-name>cacheControl</param-name>
|
||||
|
|
|
@ -13,15 +13,11 @@
|
|||
|
||||
package org.eclipse.jetty.test.monitor;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
|
||||
import org.eclipse.jetty.client.ContentExchange;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
|
@ -35,7 +31,6 @@ import org.eclipse.jetty.monitor.jmx.MonitorAction;
|
|||
import org.eclipse.jetty.monitor.triggers.GreaterThanAttrEventTrigger;
|
||||
import org.eclipse.jetty.monitor.triggers.LessThanOrEqualToAttrEventTrigger;
|
||||
import org.eclipse.jetty.monitor.triggers.OrEventTrigger;
|
||||
import org.eclipse.jetty.toolchain.jmx.JmxServiceConnection;
|
||||
import org.eclipse.jetty.toolchain.test.JettyDistro;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -98,7 +93,7 @@ public class ProgramConfigTest
|
|||
@Override
|
||||
public void execute(EventTrigger trigger, EventState<?> state, long timestamp)
|
||||
{
|
||||
System.out.println(counter.incrementAndGet());
|
||||
counter.incrementAndGet();
|
||||
}
|
||||
};
|
||||
JMXMonitor.addMonitorActions(action);
|
||||
|
@ -121,7 +116,6 @@ public class ProgramConfigTest
|
|||
}
|
||||
gate.await();
|
||||
JMXMonitor.removeMonitorActions(action);
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
protected static void runTest(String requestUrl, long count)
|
||||
|
|
|
@ -32,6 +32,7 @@ import javax.net.ssl.X509TrustManager;
|
|||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
/**
|
||||
* An HTTPS Socket Impl
|
||||
|
@ -45,26 +46,6 @@ public class HttpsSocketImpl implements HttpSocket
|
|||
|
||||
public HttpsSocketImpl() throws Exception
|
||||
{
|
||||
// Create loose SSL context.
|
||||
// Create a trust manager that does not validate certificate
|
||||
// chains
|
||||
TrustManager[] trustAllCerts = new TrustManager[]
|
||||
{ new X509TrustManager()
|
||||
{
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
{
|
||||
}
|
||||
|
||||
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
{
|
||||
}
|
||||
} };
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
HostnameVerifier hostnameVerifier = new HostnameVerifier()
|
||||
{
|
||||
|
@ -80,7 +61,7 @@ public class HttpsSocketImpl implements HttpSocket
|
|||
{
|
||||
// TODO real trust manager
|
||||
this.sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(null,trustAllCerts,new java.security.SecureRandom());
|
||||
sslContext.init(null,SslContextFactory.TRUST_ALL_CERTS,new java.security.SecureRandom());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue