On 20 November 2012 21:00, Deepak Shetty <[email protected]> wrote:
> even for default ports ?

I was referring to the comment that the query string is lost, not the port.

Further checking shows that JMeter does indeed drop the port if it is
the default for the protocol.
Sorry for the misinformation earlier.

It should not be necessary to fix this - the server should not care -
however (as here) it might be useful sometimes to supply the port.

It may be OK just to fix JMeter so the port is always used if it is provided.
Hopefully that won't break any existing test plans.

>
> On Tue, Nov 20, 2012 at 12:42 PM, sebb <[email protected]> wrote:
>
>> On 20 November 2012 12:58, Taoism <[email protected]> wrote:
>> > The port is specified in the HTTP Sampler.  As is that the protocol is
>> HTTPS.
>> >
>> > The problem is that the "Location:" header includes both HTTPS and :443
>> in
>> > the redirect URL and that the receiving server apparently expects that
>> :443
>> > will be part of the URL even though it is implied by HTTPS (since 443 is
>> the
>> > default port for HTTPS).
>> >
>> > Thus in a BeanShell PostProcessor (in sampler that just ran) or in a
>> > BeanShell PreProcessor (in the next sampler) this happens:
>> >
>> > +-Sampler A
>> > -+-BSH PostProcessor A
>> > +-Sampler B
>> > -+-BSH PreProcessor B
>> >
>> > Sampler A and B both have the port set to 443 and the protocol to HTTPS.
>> > The domain is set in the sampler as well as the path.  Previously I was
>> > dynamically grabbing the redirect location and building it up
>> dynamically in
>> > a preprocessor for the next sampler.  However, to try and solve this
>> problem
>> > I have reverted to hardcoding the values into the sampler fields.  The
>> > problem is when Sampler B executes, it doesn't add the port to the URL:
>> >
>> > //BSH PostProcessor A
>> > url = prev.getRedirectLocation();
>> > //url is: 'https://domain:443/blah/SSO?qsStuff'
>> >
>> > //BSH PreProcessor B
>> > url = sampler.getUrl()
>> > //url is now 'https://domain/blah/SSO?qsStuff'
>> >
>> > So, the sampler when building the URL is leaving out the port.  I assume
>> it
>> > is leaving it out because specifying port 443 AND HTTPS is redundant.
>> >
>> > I have looked through the API thought using the path as the whole URL may
>> > work:
>> >
>> http://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.html#getUrl()
>> > "As a special case, if the path starts with "http[s]://", then the path
>> is
>> > assumed to be the entire URL."
>> >
>> > However, calling setPath() automatically calls parseArguments() and I
>> lose
>> > the query string component.
>> >
>> http://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.html#setPath(java.lang.String)
>> > "Sets the Path attribute of the UrlConfig object Also calls
>> parseArguments
>> > to extract and store any query arguments"
>> >
>> > Which removes that as a possibility....
>> >
>>
>> Just tested using the mirror server, and
>>
>> http://localhost:8081/abcd?def&geh
>>
>> shows up as
>>
>> GET /abcd?def&geh HTTP/1.1
>> Host: localhost:8081
>>
>> in all 3 implementations, so it does work.
>>
>> >
>> >
>> > --
>> > View this message in context:
>> http://jmeter.512774.n5.nabble.com/How-to-force-the-port-to-be-used-in-an-HTTP-Sampler-tp5715344p5715360.html
>> > Sent from the JMeter - User mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [email protected]
>> > For additional commands, e-mail: [email protected]
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to