Lines 28-34
Link Here
|
28 |
import java.net.URL; |
28 |
import java.net.URL; |
29 |
import java.net.URLDecoder; |
29 |
import java.net.URLDecoder; |
30 |
import java.nio.charset.Charset; |
30 |
import java.nio.charset.Charset; |
31 |
import java.security.GeneralSecurityException; |
|
|
32 |
import java.security.PrivilegedActionException; |
31 |
import java.security.PrivilegedActionException; |
33 |
import java.security.PrivilegedExceptionAction; |
32 |
import java.security.PrivilegedExceptionAction; |
34 |
import java.util.ArrayList; |
33 |
import java.util.ArrayList; |
Lines 78-83
Link Here
|
78 |
import org.apache.http.conn.ConnectionKeepAliveStrategy; |
77 |
import org.apache.http.conn.ConnectionKeepAliveStrategy; |
79 |
import org.apache.http.conn.DnsResolver; |
78 |
import org.apache.http.conn.DnsResolver; |
80 |
import org.apache.http.conn.params.ConnRoutePNames; |
79 |
import org.apache.http.conn.params.ConnRoutePNames; |
|
|
80 |
import org.apache.http.conn.scheme.PlainSocketFactory; |
81 |
import org.apache.http.conn.scheme.Scheme; |
81 |
import org.apache.http.conn.scheme.Scheme; |
82 |
import org.apache.http.conn.scheme.SchemeRegistry; |
82 |
import org.apache.http.conn.scheme.SchemeRegistry; |
83 |
import org.apache.http.entity.ContentType; |
83 |
import org.apache.http.entity.ContentType; |
Lines 92-98
Link Here
|
92 |
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy; |
92 |
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy; |
93 |
import org.apache.http.impl.client.DefaultHttpClient; |
93 |
import org.apache.http.impl.client.DefaultHttpClient; |
94 |
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; |
94 |
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; |
95 |
import org.apache.http.impl.conn.SchemeRegistryFactory; |
|
|
96 |
import org.apache.http.impl.conn.SystemDefaultDnsResolver; |
95 |
import org.apache.http.impl.conn.SystemDefaultDnsResolver; |
97 |
import org.apache.http.message.BasicNameValuePair; |
96 |
import org.apache.http.message.BasicNameValuePair; |
98 |
import org.apache.http.params.BasicHttpParams; |
97 |
import org.apache.http.params.BasicHttpParams; |
Lines 110-120
Link Here
|
110 |
import org.apache.jmeter.protocol.http.control.CookieManager; |
109 |
import org.apache.jmeter.protocol.http.control.CookieManager; |
111 |
import org.apache.jmeter.protocol.http.control.HeaderManager; |
110 |
import org.apache.jmeter.protocol.http.control.HeaderManager; |
112 |
import org.apache.jmeter.protocol.http.util.EncoderCache; |
111 |
import org.apache.jmeter.protocol.http.util.EncoderCache; |
113 |
import org.apache.jmeter.protocol.http.util.HC4TrustAllSSLSocketFactory; |
|
|
114 |
import org.apache.jmeter.protocol.http.util.HTTPArgument; |
112 |
import org.apache.jmeter.protocol.http.util.HTTPArgument; |
115 |
import org.apache.jmeter.protocol.http.util.HTTPConstants; |
113 |
import org.apache.jmeter.protocol.http.util.HTTPConstants; |
116 |
import org.apache.jmeter.protocol.http.util.HTTPFileArg; |
114 |
import org.apache.jmeter.protocol.http.util.HTTPFileArg; |
117 |
import org.apache.jmeter.protocol.http.util.SlowHC4SSLSocketFactory; |
|
|
118 |
import org.apache.jmeter.protocol.http.util.SlowHC4SocketFactory; |
115 |
import org.apache.jmeter.protocol.http.util.SlowHC4SocketFactory; |
119 |
import org.apache.jmeter.samplers.SampleResult; |
116 |
import org.apache.jmeter.samplers.SampleResult; |
120 |
import org.apache.jmeter.services.FileServer; |
117 |
import org.apache.jmeter.services.FileServer; |
Lines 197-205
Link Here
|
197 |
// Scheme used for slow HTTP sockets. Cannot be set as a default, because must be set on an HttpClient instance. |
194 |
// Scheme used for slow HTTP sockets. Cannot be set as a default, because must be set on an HttpClient instance. |
198 |
private static final Scheme SLOW_HTTP; |
195 |
private static final Scheme SLOW_HTTP; |
199 |
|
196 |
|
200 |
// We always want to override the HTTPS scheme, because we want to trust all certificates and hosts |
|
|
201 |
private static final Scheme HTTPS_SCHEME; |
202 |
|
203 |
/* |
197 |
/* |
204 |
* Create a set of default parameters from the ones initially created. |
198 |
* Create a set of default parameters from the ones initially created. |
205 |
* This allows the defaults to be overridden if necessary from the properties file. |
199 |
* This allows the defaults to be overridden if necessary from the properties file. |
Lines 229-252
Link Here
|
229 |
SLOW_HTTP = null; |
223 |
SLOW_HTTP = null; |
230 |
} |
224 |
} |
231 |
|
225 |
|
232 |
// We always want to override the HTTPS scheme |
|
|
233 |
Scheme https = null; |
234 |
if (CPS_HTTPS > 0) { |
235 |
log.info("Setting up HTTPS SlowProtocol, cps="+CPS_HTTPS); |
236 |
try { |
237 |
https = new Scheme(HTTPConstants.PROTOCOL_HTTPS, HTTPConstants.DEFAULT_HTTPS_PORT, new SlowHC4SSLSocketFactory(CPS_HTTPS)); |
238 |
} catch (GeneralSecurityException e) { |
239 |
log.warn("Failed to initialise SLOW_HTTPS scheme, cps="+CPS_HTTPS, e); |
240 |
} |
241 |
} else { |
242 |
log.info("Setting up HTTPS TrustAll scheme"); |
243 |
try { |
244 |
https = new Scheme(HTTPConstants.PROTOCOL_HTTPS, HTTPConstants.DEFAULT_HTTPS_PORT, new HC4TrustAllSSLSocketFactory()); |
245 |
} catch (GeneralSecurityException e) { |
246 |
log.warn("Failed to initialise HTTPS TrustAll scheme", e); |
247 |
} |
248 |
} |
249 |
HTTPS_SCHEME = https; |
250 |
if (localAddress != null){ |
226 |
if (localAddress != null){ |
251 |
DEFAULT_HTTP_PARAMS.setParameter(ConnRoutePNames.LOCAL_ADDRESS, localAddress); |
227 |
DEFAULT_HTTP_PARAMS.setParameter(ConnRoutePNames.LOCAL_ADDRESS, localAddress); |
252 |
} |
228 |
} |
Lines 726-732
Link Here
|
726 |
if (resolver == null) { |
702 |
if (resolver == null) { |
727 |
resolver = new SystemDefaultDnsResolver(); |
703 |
resolver = new SystemDefaultDnsResolver(); |
728 |
} |
704 |
} |
729 |
ClientConnectionManager connManager = new MeasuringConnectionManager(SchemeRegistryFactory.createDefault(), resolver); |
705 |
ClientConnectionManager connManager = new MeasuringConnectionManager(createDefaultSchemeRegistry(), resolver); |
730 |
|
706 |
|
731 |
httpClient = new DefaultHttpClient(connManager, clientParams) { |
707 |
httpClient = new DefaultHttpClient(connManager, clientParams) { |
732 |
@Override |
708 |
@Override |
Lines 751-760
Link Here
|
751 |
schemeRegistry.register(SLOW_HTTP); |
727 |
schemeRegistry.register(SLOW_HTTP); |
752 |
} |
728 |
} |
753 |
|
729 |
|
754 |
if (HTTPS_SCHEME != null){ |
|
|
755 |
schemeRegistry.register(HTTPS_SCHEME); |
756 |
} |
757 |
|
758 |
// Set up proxy details |
730 |
// Set up proxy details |
759 |
if(useProxy) { |
731 |
if(useProxy) { |
760 |
|
732 |
|
Lines 793-798
Link Here
|
793 |
} |
765 |
} |
794 |
|
766 |
|
795 |
/** |
767 |
/** |
|
|
768 |
* Setup LazySchemeSocketFactory |
769 |
*/ |
770 |
private SchemeRegistry createDefaultSchemeRegistry() { |
771 |
final SchemeRegistry registry = new SchemeRegistry(); |
772 |
registry.register( |
773 |
new Scheme("http", 80, PlainSocketFactory.getSocketFactory())); |
774 |
registry.register( |
775 |
new Scheme("https", 443, new LazySchemeSocketFactory())); |
776 |
return registry; |
777 |
} |
778 |
|
779 |
/** |
796 |
* Setup following elements on httpRequest: |
780 |
* Setup following elements on httpRequest: |
797 |
* <ul> |
781 |
* <ul> |
798 |
* <li>ConnRoutePNames.LOCAL_ADDRESS enabling IP-SPOOFING</li> |
782 |
* <li>ConnRoutePNames.LOCAL_ADDRESS enabling IP-SPOOFING</li> |