View | Details | Raw Unified | Return to bug 51380
Collapse All | Expand All

(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java (+7 lines)
Lines 42-45 Link Here
42
            boolean areFollowingRedirect, int depth) {
42
            boolean areFollowingRedirect, int depth) {
43
        return hc.sample(u, method, areFollowingRedirect, depth);
43
        return hc.sample(u, method, areFollowingRedirect, depth);
44
    }
44
    }
45
46
	/** {@inheritDoc} */
47
	@Override
48
	protected void notifySSLContextWasReset() {
49
		// NOOP
50
		hc.notifySSLContextWasReset();
51
	}
45
}
52
}
(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java (+5 lines)
Lines 655-658 Link Here
655
        }
655
        }
656
        return conn != null;
656
        return conn != null;
657
    }
657
    }
658
659
	/** {@inheritDoc} */
660
	public void notifySSLContextWasReset() {
661
		// NOOP
662
	}
658
}
663
}
(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java (+7 lines)
Lines 78-81 Link Here
78
        }
78
        }
79
        return false;
79
        return false;
80
    }
80
    }
81
82
	@Override
83
	protected void notifySSLContextWasReset() {
84
		if (impl != null) {
85
			impl.notifySSLContextWasReset();
86
		}
87
	}
81
}
88
}
(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java (-6 / +31 lines)
Lines 70-75 Link Here
70
import org.apache.jmeter.testelement.property.StringProperty;
70
import org.apache.jmeter.testelement.property.StringProperty;
71
import org.apache.jmeter.testelement.property.TestElementProperty;
71
import org.apache.jmeter.testelement.property.TestElementProperty;
72
import org.apache.jmeter.util.JMeterUtils;
72
import org.apache.jmeter.util.JMeterUtils;
73
import org.apache.jmeter.util.JsseSSLManager;
74
import org.apache.jmeter.util.SSLManager;
73
import org.apache.jorphan.logging.LoggingManager;
75
import org.apache.jorphan.logging.LoggingManager;
74
import org.apache.jorphan.util.JOrphanUtils;
76
import org.apache.jorphan.util.JOrphanUtils;
75
import org.apache.log.Logger;
77
import org.apache.log.Logger;
Lines 233-238 Link Here
233
    private static final String RESPONSE_PARSERS= // list of parsers
235
    private static final String RESPONSE_PARSERS= // list of parsers
234
        JMeterUtils.getProperty("HTTPResponse.parsers");//$NON-NLS-1$
236
        JMeterUtils.getProperty("HTTPResponse.parsers");//$NON-NLS-1$
235
237
238
	// BEGIN 51380
239
	// Control reuse of cached SSL Context in subsequent iterations
240
	private static final boolean USE_CACHED_SSL_CONTEXT = JMeterUtils
241
			.getPropDefault("https.use.cached.ssl.context", true);
242
	// END 51380
243
    
236
    static{
244
    static{
237
        String []parsers = JOrphanUtils.split(RESPONSE_PARSERS, " " , true);// returns empty array for null
245
        String []parsers = JOrphanUtils.split(RESPONSE_PARSERS, " " , true);// returns empty array for null
238
        for (int i=0;i<parsers.length;i++){
246
        for (int i=0;i<parsers.length;i++){
Lines 258-263 Link Here
258
            parsersForType.put("text/html", ""); //$NON-NLS-1$ //$NON-NLS-2$
266
            parsersForType.put("text/html", ""); //$NON-NLS-1$ //$NON-NLS-2$
259
            log.info("No response parsers defined: text/html only will be scanned for embedded resources");
267
            log.info("No response parsers defined: text/html only will be scanned for embedded resources");
260
        }
268
        }
269
        
270
		log.info("Reuse SSL session context on subsequent iterations: "
271
				+ USE_CACHED_SSL_CONTEXT);
261
    }
272
    }
262
273
263
    // Bug 49083
274
    // Bug 49083
Lines 1234-1246 Link Here
1234
        testEnded();
1245
        testEnded();
1235
    }
1246
    }
1236
1247
1237
    /**
1248
	/**
1238
     * {@inheritDoc}
1249
	 * {@inheritDoc}
1239
     */
1250
	 */
1240
    public void testIterationStart(LoopIterationEvent event) {
1251
	public void testIterationStart(LoopIterationEvent event) {
1241
    }
1252
		// BEGIN 51380
1253
		if (!USE_CACHED_SSL_CONTEXT) {
1254
			JsseSSLManager sslMgr = (JsseSSLManager) SSLManager.getInstance();
1255
			sslMgr.resetContext();
1256
			notifySSLContextWasReset();
1257
		}
1258
		// END 51380
1259
	}
1242
1260
1243
    /**
1261
	/**
1262
	 * Free thread connections Related to ISSUE 51380
1263
	 */
1264
	protected void notifySSLContextWasReset() {
1265
		// NOOP
1266
	}
1267
1268
	/**
1244
     * {@inheritDoc}
1269
     * {@inheritDoc}
1245
     */
1270
     */
1246
    public void testStarted() {
1271
    public void testStarted() {
(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java (+5 lines)
Lines 140-145 Link Here
140
        body = null;
140
        body = null;
141
        stringBody = null;
141
        stringBody = null;
142
    }
142
    }
143
    
144
    @Override
145
    public void notifySSLContextWasReset() {
146
        // NOOP
147
    }
143
148
144
    private void setupConnection(URL url,
149
    private void setupConnection(URL url,
145
                 String method,
150
                 String method,
(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (-3 / +15 lines)
Lines 1047-1053 Link Here
1047
    @Override
1047
    @Override
1048
    public void threadFinished() {
1048
    public void threadFinished() {
1049
        log.debug("Thread Finished");
1049
        log.debug("Thread Finished");
1050
        // Does not need to be synchronised, as all access is from same thread
1050
        closeThreadLocalConnections();
1051
    }
1052
1053
	/**
1054
	 * 
1055
	 */
1056
	private void closeThreadLocalConnections() {
1057
		// Does not need to be synchronised, as all access is from same thread
1051
        Map<HttpClientKey, HttpClient> map = HTTPCLIENTS.get();
1058
        Map<HttpClientKey, HttpClient> map = HTTPCLIENTS.get();
1052
        if ( map != null ) {
1059
        if ( map != null ) {
1053
            for ( HttpClient cl : map.values() ) {
1060
            for ( HttpClient cl : map.values() ) {
Lines 1055-1061 Link Here
1055
            }
1062
            }
1056
            map.clear();
1063
            map.clear();
1057
        }
1064
        }
1058
    }
1065
	}
1059
1066
1060
    public boolean interrupt() {
1067
    public boolean interrupt() {
1061
        HttpUriRequest request = currentRequest;
1068
        HttpUriRequest request = currentRequest;
Lines 1069-1073 Link Here
1069
        }
1076
        }
1070
        return request != null;
1077
        return request != null;
1071
    }
1078
    }
1072
1079
    
1080
    /** {@inheritDoc} */
1081
	public void notifySSLContextWasReset() {
1082
		log.debug("closeThreadLocalConnections called");
1083
		closeThreadLocalConnections();
1084
	}
1073
}
1085
}
(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java (-2 / +15 lines)
Lines 1071-1077 Link Here
1071
    public void threadFinished() {
1071
    public void threadFinished() {
1072
        log.debug("Thread Finished");
1072
        log.debug("Thread Finished");
1073
1073
1074
        // Does not need to be synchronised, as all access is from same thread
1074
        closeThreadLocalConnections();
1075
    }
1076
1077
1078
	/**
1079
	 * 
1080
	 */
1081
	private void closeThreadLocalConnections() {
1082
		// Does not need to be synchronised, as all access is from same thread
1075
        Map<HostConfiguration, HttpClient> map = httpClients.get();
1083
        Map<HostConfiguration, HttpClient> map = httpClients.get();
1076
1084
1077
        if ( map != null ) {
1085
        if ( map != null ) {
Lines 1084-1090 Link Here
1084
            }
1092
            }
1085
            map.clear();
1093
            map.clear();
1086
        }
1094
        }
1087
    }
1095
	}
1088
1096
1089
    /** {@inheritDoc} */
1097
    /** {@inheritDoc} */
1090
    public boolean interrupt() {
1098
    public boolean interrupt() {
Lines 1100-1103 Link Here
1100
        return client != null;
1108
        return client != null;
1101
    }
1109
    }
1102
1110
1111
	/** {@inheritDoc} */
1112
	public void notifySSLContextWasReset() {
1113
		log.debug("freeThreadConnections called");
1114
		closeThreadLocalConnections();
1115
	}
1103
}
1116
}
(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java (+4 lines)
Lines 251-254 Link Here
251
        testElement.setUseKeepAlive(b);
251
        testElement.setUseKeepAlive(b);
252
    }
252
    }
253
253
254
	/**
255
	 * Close thread connection
256
	 */
257
	public abstract void notifySSLContextWasReset();
254
}
258
}
(-)src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java (+6 lines)
Lines 73-76 Link Here
73
    protected void setSavedClient(HttpClient savedClient) {
73
    protected void setSavedClient(HttpClient savedClient) {
74
        hc.savedClient = savedClient;
74
        hc.savedClient = savedClient;
75
    }
75
    }
76
77
	/** {@inheritDoc} */
78
	@Override
79
	protected void notifySSLContextWasReset() {
80
		hc.notifySSLContextWasReset();
81
	}
76
}
82
}
(-)bin/jmeter.properties (-1 / +3 lines)
Lines 74-79 Link Here
74
# List of protocols to enable (unlikely to be needed):
74
# List of protocols to enable (unlikely to be needed):
75
#https.socket.protocols=SSLv2Hello SSLv3 TLSv1
75
#https.socket.protocols=SSLv2Hello SSLv3 TLSv1
76
76
77
# Control if we allow reuse of cached SSL context between iterations
78
https.use.cached.ssl.context=false
77
#---------------------------------------------------------------------------
79
#---------------------------------------------------------------------------
78
# Look and Feel configuration
80
# Look and Feel configuration
79
#---------------------------------------------------------------------------
81
#---------------------------------------------------------------------------
Lines 186-192 Link Here
186
# log_level.[package_name].[classname]=[PRIORITY_LEVEL]
188
# log_level.[package_name].[classname]=[PRIORITY_LEVEL]
187
# But omit "org.apache" from the package name.  The classname is optional.  Further examples below.
189
# But omit "org.apache" from the package name.  The classname is optional.  Further examples below.
188
190
189
log_level.jmeter=INFO
191
log_level.jmeter=DEBUG
190
log_level.jmeter.junit=DEBUG
192
log_level.jmeter.junit=DEBUG
191
#log_level.jmeter.control=DEBUG
193
#log_level.jmeter.control=DEBUG
192
#log_level.jmeter.testbeans=DEBUG
194
#log_level.jmeter.testbeans=DEBUG

Return to bug 51380