jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Young <youn...@gmail.com>
Subject Re: Patch for HTTPSamplerBase to not strip query string when path starts http or https
Date Wed, 21 Nov 2012 18:55:53 GMT
I was calling setPath() from a BSH PreProcessor. (which triggers the
argument parsing even when the path starts with HTTP/HTTPS).

>From the API:
"As a special case, if the path starts with "http[s]://", then the path is
assumed to be the entire URL."

The problem is that any query string is parsed out, and not included.
 That's what this patch changes.

I will submit the patch to Bugzilla for consideration.

Cheers!


On 21 November 2012 12:39, sebb <sebbaz@gmail.com> wrote:

> On 21 November 2012 17:00, Keith Young <youngka@gmail.com> wrote:
> > I ran into a situation where an authorization server needed to have the
> > default port for https included as part of the URL.  Since the default
> > behaviour is to suppress default ports from being included in the
> generated
> > URL I decided to leverage the behaviour of the path property to treat any
> > path that starts with HTTP or HTTPS as the whole URL.  Unfortunately this
> > doesn't stop parseArguments() from being called.  The patch below changes
> > the behaviour to not call parseArguments if the path starts with HTTP or
> > HTTPS (thus allowing query strings to be included as part of the
> "complete"
> > URL as per the API).
> >
> > --- HTTPSamplerBase.java        2012-05-24 15:16:39.000000000 -0400
> > +++ HTTPSamplerBase-ky.java     2012-11-21 09:18:12.555413728 -0500
> > @@ -400,7 +400,10 @@
> >      public void setPath(String path, String contentEncoding) {
> >          if (GET.equals(getMethod()) || DELETE.equals(getMethod())) {
> >              int index = path.indexOf(QRY_PFX);
> > -            if (index > -1) {
> > +            if (path.startsWith(HTTP_PREFIX)
> > +                 || path.startsWith(HTTPS_PREFIX)){
> > +                setProperty(PATH, path);
> > +            } else if (index > -1) {
> >                  setProperty(PATH, path.substring(0, index));
> >                  // Parse the arguments in querystring, assuming
> specified
> > encoding for values
> >                  parseArguments(path.substring(index + 1),
> contentEncoding);
> > @@ -1859,4 +1862,4 @@
> >          String guiClass =
> > configElement.getProperty(TestElement.GUI_CLASS).getStringValue();
> >          return APPLIABLE_CONFIG_CLASSES.contains(guiClass);
> >      }
> > -}
> > \ No newline at end of file
> > +}
>
> Please use Bugzilla for enhancement requests; it's easier to keep track of
> them.
>
> Having said that, I have just tried, and AFAICT the setProperty()
> method is not actually called when running a test with a full URL in
> the path field, so I don't see how the change can help.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message