Author: pmouawad
Date: Sat Jan 28 15:23:59 2017
New Revision: 1780707
URL: http://svn.apache.org/viewvc?rev=1780707&view=rev
Log:
Bug 57242 - HTTP Authorization is not pre-emptively set with HttpClient4
Bugzilla Id: 57242
Added:
jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth-data.csv
jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.csv
jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.jmx
jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.xml (with props)
Modified:
jmeter/trunk/build.xml
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
jmeter/trunk/xdocs/changes.xml
Added: jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth-data.csv
URL:
http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth-data.csv?rev=1780707&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth-data.csv (added)
+++ jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth-data.csv Sat Jan 28
15:23:59 2017
@@ -0,0 +1,2 @@
+toto;password1;dG90bzpwYXNzd29yZDE=
+titi;password2;dGl0aTpwYXNzd29yZDI=
\ No newline at end of file
Added: jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.csv
URL:
http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.csv?rev=1780707&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.csv (added)
+++ jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.csv Sat Jan 28
15:23:59 2017
@@ -0,0 +1,17 @@
+label,responseCode,responseMessage,threadName,dataType,success
+HTTP-Request-WithNoMatchingAuth,200,OK,Thread Group 1-1,text,true
+HTTP-Request-WithNoMatchingAuth,200,OK,Thread Group 1-1,text,true
+HTTPS-Request-WithNoMatchingAuth,200,OK,Thread Group 2-1,text,true
+HTTPS-Request-WithNoMatchingAuth,200,OK,Thread Group 2-1,text,true
+HTTP-Request-NoAuthManager,200,OK,Thread Group 3-1,text,true
+HTTP-Request-NoAuthManager,200,OK,Thread Group 3-2,text,true
+HTTP-Request-NoAuthManager,200,OK,Thread Group 3-1,text,true
+HTTP-Request-NoAuthManager,200,OK,Thread Group 3-2,text,true
+HTTPS-Request-NoAuthManager,200,OK,Thread Group 4-1,text,true
+HTTPS-Request-NoAuthManager,200,OK,Thread Group 4-2,text,true
+HTTPS-Request-NoAuthManager,200,OK,Thread Group 4-2,text,true
+HTTPS-Request-NoAuthManager,200,OK,Thread Group 4-1,text,true
+HTTP-Request-WithMatchingBasicAuth,200,OK,Thread Group 5-1,text,true
+HTTP-Request-WithMatchingBasicAuth,200,OK,Thread Group 5-1,text,true
+HTTPS-Request-WithMatchingBasicAuth,200,OK,Thread Group 6-1,text,true
+HTTPS-Request-WithMatchingBasicAuth,200,OK,Thread Group 6-1,text,true
Added: jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.jmx
URL:
http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.jmx?rev=1780707&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.jmx (added)
+++ jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.jmx Sat Jan 28
15:23:59 2017
@@ -0,0 +1,472 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jmeterTestPlan version="1.2" properties="3.2" jmeter="3.2-SNAPSHOT.20170128">
+ <hashTree>
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan"
enabled="true">
+ <stringProp name="TestPlan.comments"></stringProp>
+ <boolProp name="TestPlan.functional_mode">false</boolProp>
+ <boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
+ <elementProp name="TestPlan.user_defined_variables"
elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments"
testname="User Defined Variables" enabled="true">
+ <collectionProp name="Arguments.arguments">
+ <elementProp name="has_auth_header" elementType="Argument">
+ <stringProp name="Argument.name">has_auth_header</stringProp>
+ <stringProp name="Argument.value">false</stringProp>
+ <stringProp name="Argument.metadata">=</stringProp>
+ </elementProp>
+ </collectionProp>
+ </elementProp>
+ <stringProp name="TestPlan.user_define_classpath"></stringProp>
+ </TestPlan>
+ <hashTree>
+ <ConfigTestElement guiclass="HttpDefaultsGui"
testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain">jmeter.apache.org</stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">/</stringProp>
+ <stringProp name="HTTPSampler.concurrentPool">6</stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </ConfigTestElement>
+ <hashTree/>
+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer"
testname="Constant Timer" enabled="true">
+ <stringProp name="ConstantTimer.delay">200</stringProp>
+ </ConstantTimer>
+ <hashTree/>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
testname="Thread Group" enabled="true">
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <elementProp name="ThreadGroup.main_controller"
elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2</stringProp>
+ </elementProp>
+ <stringProp name="ThreadGroup.num_threads">1</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">0</stringProp>
+ <longProp name="ThreadGroup.start_time">1485612143000</longProp>
+ <longProp name="ThreadGroup.end_time">1485612143000</longProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <AuthManager guiclass="AuthPanel" testclass="AuthManager"
testname="HTTP Authorization Manager" enabled="true">
+ <collectionProp name="AuthManager.auth_list">
+ <elementProp name="" elementType="Authorization">
+ <stringProp
name="Authorization.url">http://localhost:8081/</stringProp>
+ <stringProp name="Authorization.username">${login}</stringProp>
+ <stringProp
name="Authorization.password">${password}</stringProp>
+ <stringProp name="Authorization.domain"></stringProp>
+ <stringProp name="Authorization.realm">*</stringProp>
+ </elementProp>
+ </collectionProp>
+ </AuthManager>
+ <hashTree/>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui"
testclass="HTTPSamplerProxy" testname="HTTP-Request-WithNoMatchingAuth"
enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain"></stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">/</stringProp>
+ <stringProp name="HTTPSampler.method">GET</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet"
testname="CSV Data Set Config" enabled="true">
+ <stringProp name="delimiter">;</stringProp>
+ <stringProp name="fileEncoding"></stringProp>
+ <stringProp
name="filename">Http4ImplPreemptiveBasicAuth-data.csv</stringProp>
+ <boolProp name="ignoreFirstLine">false</boolProp>
+ <boolProp name="quotedData">false</boolProp>
+ <boolProp name="recycle">true</boolProp>
+ <stringProp name="shareMode">shareMode.group</stringProp>
+ <boolProp name="stopThread">false</boolProp>
+ <stringProp name="variableNames">login,password</stringProp>
+ </CSVDataSet>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
testname="Thread Group" enabled="true">
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <elementProp name="ThreadGroup.main_controller"
elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2</stringProp>
+ </elementProp>
+ <stringProp name="ThreadGroup.num_threads">1</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">0</stringProp>
+ <longProp name="ThreadGroup.start_time">1485612143000</longProp>
+ <longProp name="ThreadGroup.end_time">1485612143000</longProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <AuthManager guiclass="AuthPanel" testclass="AuthManager"
testname="HTTP Authorization Manager" enabled="true">
+ <collectionProp name="AuthManager.auth_list">
+ <elementProp name="" elementType="Authorization">
+ <stringProp
name="Authorization.url">http://localhost:8081/</stringProp>
+ <stringProp name="Authorization.username">${login}</stringProp>
+ <stringProp
name="Authorization.password">${password}</stringProp>
+ <stringProp name="Authorization.domain"></stringProp>
+ <stringProp name="Authorization.realm">*</stringProp>
+ </elementProp>
+ </collectionProp>
+ </AuthManager>
+ <hashTree/>
+ <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet"
testname="CSV Data Set Config" enabled="true">
+ <stringProp name="delimiter">;</stringProp>
+ <stringProp name="fileEncoding"></stringProp>
+ <stringProp
name="filename">Http4ImplPreemptiveBasicAuth-data.csv</stringProp>
+ <boolProp name="ignoreFirstLine">false</boolProp>
+ <boolProp name="quotedData">false</boolProp>
+ <boolProp name="recycle">true</boolProp>
+ <stringProp name="shareMode">shareMode.group</stringProp>
+ <boolProp name="stopThread">false</boolProp>
+ <stringProp name="variableNames">login,password</stringProp>
+ </CSVDataSet>
+ <hashTree/>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui"
testclass="HTTPSamplerProxy" testname="HTTPS-Request-WithNoMatchingAuth"
enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain"></stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
+ <stringProp name="HTTPSampler.protocol">https</stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">/</stringProp>
+ <stringProp name="HTTPSampler.method">GET</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
testname="Thread Group" enabled="true">
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <elementProp name="ThreadGroup.main_controller"
elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2</stringProp>
+ </elementProp>
+ <stringProp name="ThreadGroup.num_threads">2</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">0</stringProp>
+ <longProp name="ThreadGroup.start_time">1485612143000</longProp>
+ <longProp name="ThreadGroup.end_time">1485612143000</longProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui"
testclass="HTTPSamplerProxy" testname="HTTP-Request-NoAuthManager"
enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain"></stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
+ <stringProp name="HTTPSampler.protocol">http</stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">/</stringProp>
+ <stringProp name="HTTPSampler.method">GET</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
testname="Thread Group" enabled="true">
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <elementProp name="ThreadGroup.main_controller"
elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2</stringProp>
+ </elementProp>
+ <stringProp name="ThreadGroup.num_threads">2</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">0</stringProp>
+ <longProp name="ThreadGroup.start_time">1485612143000</longProp>
+ <longProp name="ThreadGroup.end_time">1485612143000</longProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui"
testclass="HTTPSamplerProxy" testname="HTTPS-Request-NoAuthManager"
enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain"></stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
+ <stringProp name="HTTPSampler.protocol">https</stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">/</stringProp>
+ <stringProp name="HTTPSampler.method">GET</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
testname="Thread Group" enabled="true">
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <elementProp name="ThreadGroup.main_controller"
elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2</stringProp>
+ </elementProp>
+ <stringProp name="ThreadGroup.num_threads">1</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">0</stringProp>
+ <longProp name="ThreadGroup.start_time">1485612143000</longProp>
+ <longProp name="ThreadGroup.end_time">1485612143000</longProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <UserParameters guiclass="UserParametersGui"
testclass="UserParameters" testname="User Parameters" enabled="true">
+ <collectionProp name="UserParameters.names">
+ <stringProp name="-514937121">has_auth_header</stringProp>
+ </collectionProp>
+ <collectionProp name="UserParameters.thread_values">
+ <collectionProp name="1902774694">
+ <stringProp name="3569038">true</stringProp>
+ </collectionProp>
+ </collectionProp>
+ <boolProp name="UserParameters.per_iteration">false</boolProp>
+ </UserParameters>
+ <hashTree/>
+ <AuthManager guiclass="AuthPanel" testclass="AuthManager"
testname="HTTP Authorization Manager" enabled="true">
+ <collectionProp name="AuthManager.auth_list">
+ <elementProp name="" elementType="Authorization">
+ <stringProp
name="Authorization.url">http://jmeter.apache.org/</stringProp>
+ <stringProp name="Authorization.username">${login}</stringProp>
+ <stringProp
name="Authorization.password">${password}</stringProp>
+ <stringProp name="Authorization.domain"></stringProp>
+ <stringProp name="Authorization.realm">*</stringProp>
+ </elementProp>
+ </collectionProp>
+ </AuthManager>
+ <hashTree/>
+ <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet"
testname="CSV Data Set Config" enabled="true">
+ <stringProp name="delimiter">;</stringProp>
+ <stringProp name="fileEncoding"></stringProp>
+ <stringProp
name="filename">Http4ImplPreemptiveBasicAuth-data.csv</stringProp>
+ <boolProp name="ignoreFirstLine">false</boolProp>
+ <boolProp name="quotedData">false</boolProp>
+ <boolProp name="recycle">true</boolProp>
+ <stringProp name="shareMode">shareMode.group</stringProp>
+ <boolProp name="stopThread">false</boolProp>
+ <stringProp
name="variableNames">login,password,headerValue</stringProp>
+ </CSVDataSet>
+ <hashTree/>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui"
testclass="HTTPSamplerProxy" testname="HTTP-Request-WithMatchingBasicAuth"
enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain"></stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
+ <stringProp name="HTTPSampler.protocol"></stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">/</stringProp>
+ <stringProp name="HTTPSampler.method">GET</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ </hashTree>
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
testname="Thread Group" enabled="true">
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+ <elementProp name="ThreadGroup.main_controller"
elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
+ <boolProp name="LoopController.continue_forever">false</boolProp>
+ <stringProp name="LoopController.loops">2</stringProp>
+ </elementProp>
+ <stringProp name="ThreadGroup.num_threads">1</stringProp>
+ <stringProp name="ThreadGroup.ramp_time">0</stringProp>
+ <longProp name="ThreadGroup.start_time">1485612143000</longProp>
+ <longProp name="ThreadGroup.end_time">1485612143000</longProp>
+ <boolProp name="ThreadGroup.scheduler">false</boolProp>
+ <stringProp name="ThreadGroup.duration"></stringProp>
+ <stringProp name="ThreadGroup.delay"></stringProp>
+ </ThreadGroup>
+ <hashTree>
+ <UserParameters guiclass="UserParametersGui"
testclass="UserParameters" testname="User Parameters" enabled="true">
+ <collectionProp name="UserParameters.names">
+ <stringProp name="-514937121">has_auth_header</stringProp>
+ </collectionProp>
+ <collectionProp name="UserParameters.thread_values">
+ <collectionProp name="1902774694">
+ <stringProp name="3569038">true</stringProp>
+ </collectionProp>
+ </collectionProp>
+ <boolProp name="UserParameters.per_iteration">false</boolProp>
+ </UserParameters>
+ <hashTree/>
+ <AuthManager guiclass="AuthPanel" testclass="AuthManager"
testname="HTTP Authorization Manager" enabled="true">
+ <collectionProp name="AuthManager.auth_list">
+ <elementProp name="" elementType="Authorization">
+ <stringProp
name="Authorization.url">https://jmeter.apache.org/</stringProp>
+ <stringProp name="Authorization.username">${login}</stringProp>
+ <stringProp
name="Authorization.password">${password}</stringProp>
+ <stringProp name="Authorization.domain"></stringProp>
+ <stringProp name="Authorization.realm">*</stringProp>
+ </elementProp>
+ </collectionProp>
+ </AuthManager>
+ <hashTree/>
+ <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet"
testname="CSV Data Set Config" enabled="true">
+ <stringProp name="delimiter">;</stringProp>
+ <stringProp name="fileEncoding"></stringProp>
+ <stringProp
name="filename">Http4ImplPreemptiveBasicAuth-data.csv</stringProp>
+ <boolProp name="ignoreFirstLine">false</boolProp>
+ <boolProp name="quotedData">false</boolProp>
+ <boolProp name="recycle">true</boolProp>
+ <stringProp name="shareMode">shareMode.group</stringProp>
+ <boolProp name="stopThread">false</boolProp>
+ <stringProp
name="variableNames">login,password,headerValue</stringProp>
+ </CSVDataSet>
+ <hashTree/>
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui"
testclass="HTTPSamplerProxy" testname="HTTPS-Request-WithMatchingBasicAuth"
enabled="true">
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
+ <collectionProp name="Arguments.arguments"/>
+ </elementProp>
+ <stringProp name="HTTPSampler.domain"></stringProp>
+ <stringProp name="HTTPSampler.port"></stringProp>
+ <stringProp name="HTTPSampler.protocol">https</stringProp>
+ <stringProp name="HTTPSampler.contentEncoding"></stringProp>
+ <stringProp name="HTTPSampler.path">/</stringProp>
+ <stringProp name="HTTPSampler.method">GET</stringProp>
+ <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+ <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+ <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+ <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
+ <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
+ <stringProp name="HTTPSampler.connect_timeout"></stringProp>
+ <stringProp name="HTTPSampler.response_timeout"></stringProp>
+ </HTTPSamplerProxy>
+ <hashTree/>
+ </hashTree>
+ <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion"
testname="JSA_CheckAuthorization" enabled="true">
+ <stringProp
name="cacheKey">9796e1f7-1b35-434c-b29f-36c589b72ea9</stringProp>
+ <stringProp name="filename"></stringProp>
+ <stringProp name="parameters"></stringProp>
+ <stringProp name="script">boolean mustHaveAuthHeader =
vars["has_auth_header"].toBoolean();
+String requestHeaders = SampleResult.getRequestHeaders();
+if(mustHaveAuthHeader) {
+ if(requestHeaders.contains("Authorization")) {
+ if(requestHeaders.contains("Authorization: Basic
"+vars["headerValue"])) {
+ AssertionResult.setFailure(false);
+ } else {
+ AssertionResult.setFailure(true);
+ AssertionResult.setFailureMessage("Wrong
authorization header value:"+requestHeaders);
+ }
+ } else {
+ AssertionResult.setFailure(true);
+ AssertionResult.setFailureMessage("Request has no
authorization header while it must have:"+requestHeaders);
+ }
+} else {
+ if(requestHeaders.contains("Authorization")) {
+ AssertionResult.setFailure(true);
+ AssertionResult.setFailureMessage("Request has
authorization header while it shouldn't have any:"+requestHeaders);
+ }
+}
+</stringProp>
+ <stringProp name="scriptLanguage">groovy</stringProp>
+ </JSR223Assertion>
+ <hashTree/>
+ <ResultCollector guiclass="ViewResultsFullVisualizer"
testclass="ResultCollector" testname="View Results Tree" enabled="true">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <name>saveConfig</name>
+ <value class="SampleSaveConfiguration">
+ <time>false</time>
+ <latency>false</latency>
+ <timestamp>false</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>false</xml>
+ <fieldNames>true</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ </value>
+ </objProp>
+ <stringProp
name="filename">Http4ImplPreemptiveBasicAuth.csv</stringProp>
+ </ResultCollector>
+ <hashTree/>
+ <ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector"
testname="Simple Data Writer" enabled="true">
+ <boolProp name="ResultCollector.error_logging">false</boolProp>
+ <objProp>
+ <name>saveConfig</name>
+ <value class="SampleSaveConfiguration">
+ <time>false</time>
+ <latency>false</latency>
+ <timestamp>false</timestamp>
+ <success>true</success>
+ <label>true</label>
+ <code>true</code>
+ <message>true</message>
+ <threadName>true</threadName>
+ <dataType>true</dataType>
+ <encoding>false</encoding>
+ <assertions>true</assertions>
+ <subresults>true</subresults>
+ <responseData>false</responseData>
+ <samplerData>false</samplerData>
+ <xml>true</xml>
+ <fieldNames>false</fieldNames>
+ <responseHeaders>false</responseHeaders>
+ <requestHeaders>false</requestHeaders>
+ <responseDataOnError>false</responseDataOnError>
+
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+ <assertionsResultsToSave>0</assertionsResultsToSave>
+ <bytes>true</bytes>
+ </value>
+ </objProp>
+ <stringProp
name="filename">Http4ImplPreemptiveBasicAuth.xml</stringProp>
+ </ResultCollector>
+ <hashTree/>
+ </hashTree>
+ <WorkBench guiclass="WorkBenchGui" testclass="WorkBench"
testname="WorkBench" enabled="true">
+ <boolProp name="WorkBench.save">true</boolProp>
+ </WorkBench>
+ <hashTree>
+ <HttpMirrorControl guiclass="HttpMirrorControlGui"
testclass="HttpMirrorControl" testname="HTTP Mirror Server" enabled="true">
+ <stringProp name="HttpMirrorControlGui.port">8081</stringProp>
+ <stringProp name="HttpMirrorControlGui.maxPoolSize">0</stringProp>
+ <stringProp name="HttpMirrorControlGui.maxQueueSize">25</stringProp>
+ </HttpMirrorControl>
+ <hashTree/>
+ </hashTree>
+ </hashTree>
+</jmeterTestPlan>
Added: jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.xml?rev=1780707&view=auto
==============================================================================
--- jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.xml (added)
+++ jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.xml Sat Jan 28
15:23:59 2017
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testResults version="1.2">
+<httpSample s="true" lb="HTTP-Request-WithNoMatchingAuth" rc="200" rm="OK"
tn="Thread Group 1-1" dt="text" by="12014">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTP-Request-WithNoMatchingAuth" rc="200" rm="OK"
tn="Thread Group 1-1" dt="text" by="12013">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTPS-Request-WithNoMatchingAuth" rc="200" rm="OK"
tn="Thread Group 2-1" dt="text" by="12014">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTPS-Request-WithNoMatchingAuth" rc="200" rm="OK"
tn="Thread Group 2-1" dt="text" by="12013">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTP-Request-NoAuthManager" rc="200" rm="OK"
tn="Thread Group 3-1" dt="text" by="12014">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTP-Request-NoAuthManager" rc="200" rm="OK"
tn="Thread Group 3-2" dt="text" by="12014">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTP-Request-NoAuthManager" rc="200" rm="OK"
tn="Thread Group 3-1" dt="text" by="12013">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTP-Request-NoAuthManager" rc="200" rm="OK"
tn="Thread Group 3-2" dt="text" by="12013">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTPS-Request-NoAuthManager" rc="200" rm="OK"
tn="Thread Group 4-1" dt="text" by="12014">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTPS-Request-NoAuthManager" rc="200" rm="OK"
tn="Thread Group 4-2" dt="text" by="12014">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTPS-Request-NoAuthManager" rc="200" rm="OK"
tn="Thread Group 4-2" dt="text" by="12013">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTPS-Request-NoAuthManager" rc="200" rm="OK"
tn="Thread Group 4-1" dt="text" by="12013">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTP-Request-WithMatchingBasicAuth" rc="200" rm="OK"
tn="Thread Group 5-1" dt="text" by="12014">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTP-Request-WithMatchingBasicAuth" rc="200" rm="OK"
tn="Thread Group 5-1" dt="text" by="12013">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTPS-Request-WithMatchingBasicAuth" rc="200" rm="OK"
tn="Thread Group 6-1" dt="text" by="12014">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+<httpSample s="true" lb="HTTPS-Request-WithMatchingBasicAuth" rc="200" rm="OK"
tn="Thread Group 6-1" dt="text" by="12013">
+ <assertionResult>
+ <name>JSA_CheckAuthorization</name>
+ <failure>false</failure>
+ <error>false</error>
+ </assertionResult>
+</httpSample>
+
+</testResults>
Propchange: jmeter/trunk/bin/testfiles/Http4ImplPreemptiveBasicAuth.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: jmeter/trunk/build.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1780707&r1=1780706&r2=1780707&view=diff
==============================================================================
--- jmeter/trunk/build.xml (original)
+++ jmeter/trunk/build.xml Sat Jan 28 15:23:59 2017
@@ -2717,6 +2717,10 @@ run JMeter unless all the JMeter jars ar
<antcall target="batchtest">
<param name="batchtest.name" value="SlowCharsFeature"/>
</antcall>
+
+ <antcall target="batchtest">
+ <param name="batchtest.name" value="Http4ImplPreemptiveBasicAuth"/>
+ </antcall>
</target>
<!-- Run all batch tests; used by test target -->
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1780707&r1=1780706&r2=1780707&view=diff
==============================================================================
---
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
(original)
+++
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
Sat Jan 28 15:23:59 2017
@@ -58,6 +58,7 @@ import org.apache.http.StatusLine;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.NTCredentials;
+import org.apache.http.client.AuthCache;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.HttpClient;
@@ -93,7 +94,9 @@ import org.apache.http.entity.mime.MIME;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.AbstractHttpClient;
+import org.apache.http.impl.client.BasicAuthCache;
import org.apache.http.impl.client.DefaultClientConnectionReuseStrategy;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.impl.client.DefaultHttpClient;
@@ -114,6 +117,8 @@ import org.apache.http.protocol.HttpCore
import org.apache.http.util.CharArrayBuffer;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.http.control.AuthManager;
+import org.apache.jmeter.protocol.http.control.AuthManager.Mechanism;
+import org.apache.jmeter.protocol.http.control.Authorization;
import org.apache.jmeter.protocol.http.control.CacheManager;
import org.apache.jmeter.protocol.http.control.CookieManager;
import org.apache.jmeter.protocol.http.control.HeaderManager;
@@ -155,6 +160,9 @@ public class HTTPHC4Impl extends HTTPHCA
private static final int TIME_TO_LIVE =
JMeterUtils.getPropDefault("httpclient4.time_to_live", 2000);
+ /** Preemptive Basic Auth */
+ private static final boolean BASIC_AUTH_PREEMPTIVE =
JMeterUtils.getPropDefault("httpclient4.auth.preemptive", true);
+
private static final String CONTEXT_METRICS = "jmeter_metrics"; // TODO
hack for metrics related to HTTPCLIENT-1081, to be removed later
private static final Pattern PORT_PATTERN = Pattern.compile("\\d+"); //
only used in .matches(), no need for anchors
@@ -632,6 +640,21 @@ public class HTTPHC4Impl extends HTTPHCA
throw new RuntimeException("Can't execute httpRequest with
subject:" + subject, e);
}
}
+
+ if(BASIC_AUTH_PREEMPTIVE) {
+ Authorization authorization = authManager.getAuthForURL(url);
+ if(authorization != null &&
Mechanism.BASIC_DIGEST.equals(authorization.getMechanism())) {
+ HttpHost target = new HttpHost(url.getHost(),
url.getPort(), url.getProtocol());
+ // Create AuthCache instance
+ AuthCache authCache = new BasicAuthCache();
+ // Generate BASIC scheme object and
+ // add it to the local auth cache
+ BasicScheme basicAuth = new BasicScheme();
+ authCache.put(target, basicAuth);
+ // Add AuthCache to the execution context
+ localContext.setAttribute(HttpClientContext.AUTH_CACHE,
authCache);
+ }
+ }
}
return httpClient.execute(httpRequest, localContext);
}
Modified: jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1780707&r1=1780706&r2=1780707&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Jan 28 15:23:59 2017
@@ -192,6 +192,7 @@ JMeter now requires Java 8. Ensure you u
<li><bug>60575</bug>HTTP GET Requests could have a content-type header
without a body.</li>
<li><bug>60643</bug>HTTP(S) Test Script Recorder doesn't correctly handle
restart or start after stop. Contributed by Ubik Load Pack (support at
ubikloadpack.com)</li>
<li><bug>60652</bug>PUT might leak file descriptors.</li>
+ <li><bug>57242</bug>HTTP Authorization is not pre-emptively set with
HttpClient4</li>
</ul>
<h3>Other Samplers</h3>