jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Taoism <>
Subject Re: How to force the port to be used in an HTTP Sampler?
Date Tue, 20 Nov 2012 12:58:50 GMT
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
"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.
"Sets the Path attribute of the UrlConfig object Also calls parseArguments
to extract and store any query arguments"

Which removes that as a possibility....

View this message in context:
Sent from the JMeter - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message