svn commit: r901727 - in /jakarta/jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java xdocs/changes.xml

[email protected]
Newsgroups gmane.comp.jakarta.jmeter.devel
Message-ID <[email protected]>
Author: sebb
Date: Thu Jan 21 14:45:57 2010
New Revision: 901727

URL: http://svn.apache.org/viewvc?rev=901727&view=rev
Log:
Bug 48570 - AjpSampler doesn't support query parameters (GET/POST)

Modified:
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java?rev=901727&r1=901726&r2=901727&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java Thu Jan 21 14:45:57 2010
@@ -31,6 +31,7 @@
 import org.apache.jmeter.protocol.http.control.CookieManager;
 import org.apache.jmeter.protocol.http.control.Header;
 import org.apache.jmeter.protocol.http.control.HeaderManager;
+import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.testelement.property.CollectionProperty;
 import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.PropertyIterator;
@@ -91,6 +92,7 @@
     private transient ByteArrayOutputStream responseData = new ByteArrayOutputStream();
     private int inpos = 0;
     private int outpos = 0;
+    private transient String stringBody = null;
     private transient InputStream body = null;
 
     public AjpSampler() {
@@ -131,6 +133,7 @@
         }
         channel = null;
         body = null;
+        stringBody = null;
     }
 
     private void setupConnection(URL url, 
@@ -171,7 +174,7 @@
         } else {
             setString(HTTP_1_1);
         }
-        setString(url.getFile());
+        setString(url.getPath());
         setString(localAddress);
         setString(localName);
         setString(host);
@@ -181,7 +184,12 @@
         String hdr = setConnectionHeaders(url, host, method);
         res.setRequestHeaders(hdr);
         res.setCookies(setConnectionCookies(url, getCookieManager()));
-        setByte((byte)0xff); // Attributes not supported
+        String query = url.getQuery();
+        if (query != null) {
+            setByte((byte)0x05); // Marker for query string attribute
+            setString(query);
+        }
+        setByte((byte)0xff); // More general attributes not supported
     }
 
     private int getHeaderSize(String method, URL url) {
@@ -267,9 +275,10 @@
                     } else {
                         sb.append('&');
                     }
-                    sb.append(arg.getName()).append('=').append(arg.getStringValue());
+                    sb.append(arg.getStringValue());
                 }
-                byte [] sbody = sb.toString().getBytes(); //FIXME - encoding
+                stringBody = sb.toString();
+                byte [] sbody = stringBody.getBytes(); //FIXME - encoding
                 cl = sbody.length;
                 body = new ByteArrayInputStream(sbody);
             }
@@ -364,6 +373,7 @@
     throws IOException {
         send();
         if(method.equals(POST)) {
+            res.setQueryString(stringBody);
             sendPostBody();
         }
         handshake(res);

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=901727&r1=901726&r2=901727&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Jan 21 14:45:57 2010
@@ -76,6 +76,7 @@
 <li>Bug 48451 - Error in: SoapSampler.setPostHeaders(PostMethod post) in the else branch</li>
 <li>Bug 48542 - SoapSampler uses wrong response header field to decide if response is gzip encoded</li>
 <li>Bug 48568 - CookieManager broken for AjpSampler</li>
+<li>Bug 48570 - AjpSampler doesn't support query parameters (GET/POST)</li>
 </ul>
 
 <h3>Other Samplers</h3>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.