Author: sebb
Date: Sun Sep 8 09:52:26 2013
New Revision: 1520849
URL: http://svn.apache.org/r1520849
Log:
Move keystore type to ProxyControl; it's needed there so KeyStore can be intialised when Proxy
is started
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1520849&r1=1520848&r2=1520849&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Sun Sep
8 09:52:26 2013
@@ -106,8 +106,6 @@ public class Proxy extends Thread {
private static final String CERT_FILE =
JMeterUtils.getPropDefault("proxy.cert.file", CERT_FILE_DEFAULT); // $NON-NLS-1$
- private static final String CERT_ALIAS = JMeterUtils.getProperty("proxy.cert.alias");
// $NON-NLS-1$
-
// The alias to be used if dynamic host names are not possible
private static final String JMETER_SERVER_ALIAS = ":jmeter:"; // $NON-NLS-1$
@@ -126,30 +124,10 @@ public class Proxy extends Thread {
// Use with SSL connection
private OutputStream outStreamClient = null;
- static enum KEYSTORE_IMPL {
- USER_KEYSTORE, // user-provided keystore
- JMETER_KEYSTORE, // keystore generated by JMeter; single entry
- DYNAMIC_KEYSTORE
- }
-
- private static final KEYSTORE_IMPL keystoreType;
-
static {
String removeList = JMeterUtils.getPropDefault(PROXY_HEADERS_REMOVE,PROXY_HEADERS_REMOVE_DEFAULT);
headersToRemove = JOrphanUtils.split(removeList,PROXY_HEADERS_REMOVE_SEPARATOR);
log.info("Proxy will remove the headers: "+removeList);
- if (CERT_ALIAS != null) {
- log.info("Proxy Server will use the specified SSL keystore with the alias: '"
+ CERT_ALIAS + "'");
- keystoreType = KEYSTORE_IMPL.USER_KEYSTORE;
- } else {
- if (KeyToolUtils.SUPPORTS_HOST_CERT) {
- keystoreType = KEYSTORE_IMPL.DYNAMIC_KEYSTORE;
- log.info("Java 7 detected: Proxy Server SSL Proxy will use keys that support
embedded 3rd party resources");
- } else {
- keystoreType = KEYSTORE_IMPL.JMETER_KEYSTORE;
- log.warn("Java 7 not detected: Proxy Server SSL Proxy will use keys that may
not work for embedded resources");
- }
- }
}
/** Socket to client. */
@@ -372,7 +350,7 @@ public class Proxy extends Thread {
final KeyStore ks;
final String serverAlias;
String keyPass;
- switch(keystoreType) {
+ switch(ProxyControl.keystoreType) {
case JMETER_KEYSTORE:
ks = getJMeterKeyStore(getPassword(), (String) null);
keyPass = getPassword(); // above call may have updated the stored password
@@ -388,7 +366,7 @@ public class Proxy extends Thread {
String keyStorePass = JMeterUtils.getPropDefault("proxy.cert.keystorepass", DEFAULT_PASSWORD);
// $NON-NLS-1$
ks = getKeyStore(keyStorePass.toCharArray());
keyPass = JMeterUtils.getPropDefault("proxy.cert.keypassword", DEFAULT_PASSWORD);
// $NON-NLS-1$
- serverAlias = CERT_ALIAS;
+ serverAlias = ProxyControl.CERT_ALIAS;
break;
}
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KEYMANAGERFACTORY);
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1520849&r1=1520848&r2=1520849&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Sun Sep 8 09:52:26 2013
@@ -66,6 +66,7 @@ import org.apache.jmeter.testelement.pro
import org.apache.jmeter.threads.AbstractThreadGroup;
import org.apache.jmeter.timers.Timer;
import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.exec.KeyToolUtils;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
import org.apache.oro.text.MalformedCachePatternException;
@@ -149,6 +150,31 @@ public class ProxyControl extends Generi
JMeterUtils.getPropDefault("proxy.pause", 1000); // $NON-NLS-1$
// Detect if user has pressed a new link
+ public static final String CERT_ALIAS = JMeterUtils.getProperty("proxy.cert.alias");
// $NON-NLS-1$
+
+ public static enum KEYSTORE_IMPL {
+ USER_KEYSTORE, // user-provided keystore
+ JMETER_KEYSTORE, // keystore generated by JMeter; single entry
+ DYNAMIC_KEYSTORE
+ }
+
+ public static final KEYSTORE_IMPL keystoreType;
+
+ static {
+ if (CERT_ALIAS != null) {
+ log.info("Proxy Server will use the specified SSL keystore with the alias: '"
+ CERT_ALIAS + "'");
+ keystoreType = KEYSTORE_IMPL.USER_KEYSTORE;
+ } else {
+ if (KeyToolUtils.SUPPORTS_HOST_CERT) {
+ keystoreType = KEYSTORE_IMPL.DYNAMIC_KEYSTORE;
+ log.info("Java 7 detected: Proxy Server SSL Proxy will use keys that support
embedded 3rd party resources");
+ } else {
+ keystoreType = KEYSTORE_IMPL.JMETER_KEYSTORE;
+ log.warn("Java 7 not detected: Proxy Server SSL Proxy will use keys that may
not work for embedded resources");
+ }
+ }
+ }
+
private AtomicBoolean addAssertions = new AtomicBoolean(false);
private AtomicInteger groupingMode = new AtomicInteger(0);
@@ -1043,4 +1069,9 @@ public class ProxyControl extends Generi
public boolean canRemove() {
return null == server;
}
+
+ public String getSSLHosts() {
+ // TODO Auto-generated method stub; should return the field trimmed
+ return "jmeter.apache.org,*.google.co.uk";
+ }
}
|