New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Host header gets ignored when doing basic authentication in HC4 #3902
Comments
@pmouawad (migrated from Bugzilla): Thanks |
@FSchumacher (migrated from Bugzilla): What I think is the expected behaviour: Java client is working with 3.1 (it is asking for localhost, though) (This whole business of specifying a host header by hand to simulate virtual hosts seems wrong. We should be looking at giving a dns resolver, that resolves "example.com" to localhost (don't know how to change the port)) Created attachment bug-59174.jmx: Test case demonstrating the behaviour with 3.1 bug-59174.jmx<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="3.1" jmeter="3.1.20170128">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Testplan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="Benutzer definierte Variablen" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread-Gruppe" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Schleifen-Controller (Loop Controller)" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1485635958000</longProp>
<longProp name="ThreadGroup.end_time">1485635958000</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 Authorisierungs Manager" enabled="true">
<collectionProp name="AuthManager.auth_list">
<elementProp name="" elementType="Authorization">
<stringProp name="Authorization.url">http://localhost</stringProp>
<stringProp name="Authorization.username">tomcat</stringProp>
<stringProp name="Authorization.password">secret</stringProp>
<stringProp name="Authorization.domain"></stringProp>
<stringProp name="Authorization.realm">Tomcat Manager Application</stringProp>
</elementProp>
</collectionProp>
</AuthManager>
<hashTree/>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="Simulate virtual host" enabled="true">
<collectionProp name="HeaderManager.headers">
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Host</stringProp>
<stringProp name="Header.value">example.com:80</stringProp>
</elementProp>
</collectionProp>
</HeaderManager>
<hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Java works" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Benutzer definierte Variablen" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">localhost</stringProp>
<stringProp name="HTTPSampler.port">8080</stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/manager/html</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>
<boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">true</boolProp>
<stringProp name="HTTPSampler.implementation">Java</stringProp>
<boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy>
<hashTree/>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTPClient 4.x fails" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="Benutzer definierte Variablen" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">localhost</stringProp>
<stringProp name="HTTPSampler.port">8080</stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/manager/html</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>
<boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">true</boolProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy>
<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>true</time>
<latency>true</latency>
<timestamp>true</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>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
<WorkBench guiclass="WorkBenchGui" testclass="WorkBench" testname="WorkBench" enabled="true">
<boolProp name="WorkBench.save">true</boolProp>
</WorkBench>
<hashTree/>
</hashTree>
</jmeterTestPlan> |
@pmouawad (migrated from Bugzilla):
Thanks
So is this a real problem or is it due to the host hack ? |
@pmouawad (migrated from Bugzilla): While HC4: If I comment element Simulate virtual host, it works for HC4. What exactly is the bug for you in this case ? Is it that HC4 has port 8080 ? |
@FSchumacher (migrated from Bugzilla): Now to the problem originally discussed here. This problem was discussed on the mailing list, so it seems that at least for someone it was a real problem. The usual workaround is to set a host header manually. That works for java client, only. But this setup has a few drawbacks.
Therefore I think the way to go is to add a way to setup a fake dns resolver, so that one can use the desired hostname while speaking to the real server name. |
@pmouawad (migrated from Bugzilla):
Thanks for fixing it.
I still don't get the use case. Anyway ok for your idea which will be useful in other areas. thanks |
@FSchumacher (migrated from Bugzilla):
Right, that was the use case. Say, for example, you wanted to test, if your newly setup server works as expected, without exposing it to the public.
|
@FSchumacher (migrated from Bugzilla): This patch needs documentation, test cases and review. Created attachment 0001-Add-static-hosts-to-DNSCacheManager.patch: Add a table with static hosts to DNSCacheManager |
@pmouawad (migrated from Bugzilla): Maybe there should be in GUI a mode to enable one of the 2 modes no ? I committed some changes to avoid NPE if init of resolver fails and added a new test methods to check as much cases as possible for current implementation. Regards |
@FSchumacher (migrated from Bugzilla):
I think that both modes are balls at the same time. You might have a custom resolver, but still want to change one or two hosts to other addresses. At the moment the lookup for static hosts is awkward, but we could include results in the global cache, if we clear it on every edit. That way it should have no performance impact on the usual use case.
|
@pmouawad (migrated from Bugzilla):
Sounds good to me.
|
@FSchumacher (migrated from Bugzilla): URL: http://svn.apache.org/viewvc?rev=1782622&view=rev Added: |
@pmouawad (migrated from Bugzilla): I understand ,that in first column you could have many hostnames and in second column 1 static host entry.
|
@pmouawad (migrated from Bugzilla): URL: http://svn.apache.org/viewvc?rev=1783471&view=rev Modified: |
@FSchumacher (migrated from Bugzilla): URL: http://svn.apache.org/viewvc?rev=1783565&view=rev Modified: |
@FSchumacher (Bug 59174):
When using a host header together with basic authentication in HC4, the authorization context gets set based on the url in jmeter, while HC4 seems to expect the authorization context to be set based on the host header.
As a result we can't use basic authentication with a custom host header in HC4 at the moment.
Java implementation works.
Severity: normal
OS: All
The text was updated successfully, but these errors were encountered: