jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Young <youn...@gmail.com>
Subject Patch for HTTPSamplerBase to not strip query string when path starts http or https
Date Wed, 21 Nov 2012 17:00:08 GMT
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
+}

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