Author: sebb
Date: Mon Apr 30 15:51:05 2007
New Revision: 533872

URL: http://svn.apache.org/viewvc?view=rev&rev=533872
Log:
Bug 39808 - Invalid redirect causes incorrect sample time

Modified:
    
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml

Modified: 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?view=diff&rev=533872&r1=533871&r2=533872
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
 Mon Apr 30 15:51:05 2007
@@ -1051,22 +1051,30 @@
 
                int redirect;
                for (redirect = 0; redirect < MAX_REDIRECTS; redirect++) {
-                       String location = 
encodeSpaces(lastRes.getRedirectLocation());
+                       boolean invalidRedirectUrl = false;
                        // Browsers seem to tolerate Location headers with 
spaces,
                        // replacing them automatically with %20. We want to 
emulate
                        // this behaviour.
+                       String location = 
encodeSpaces(lastRes.getRedirectLocation());
                        try {
                                lastRes = sample(new URL(lastRes.getURL(), 
location), GET, true, frameDepth);
                        } catch (MalformedURLException e) {
                                lastRes = errorResult(e, lastRes);
+                               // The redirect URL we got was not a valid URL
+                               invalidRedirectUrl = true;
                        }
                        if (lastRes.getSubResults() != null && 
lastRes.getSubResults().length > 0) {
                                SampleResult[] subs = lastRes.getSubResults();
                                for (int i = 0; i < subs.length; i++) {
                                        totalRes.addSubResult(subs[i]);
                                }
-                       } else
-                               totalRes.addSubResult(lastRes);
+                       } else {
+                               // Only add sample if it is a sample of valid 
url redirect, i.e. that
+                               // we have actually sampled the URL
+                               if(!invalidRedirectUrl) {
+                                       totalRes.addSubResult(lastRes);
+                               }
+                       }
 
                        if (!lastRes.isRedirect()) {
                                break;

Modified: jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml?view=diff&rev=533872&r1=533871&r2=533872
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml (original)
+++ jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml Mon Apr 30 15:51:05 2007
@@ -216,6 +216,7 @@
 <li>Bug 42156 - HTTPRequest HTTPClient incorrectly urlencodes parameter value 
in POST</li>
 <li>Bug 42184 - Number of bytes for subsamples not added to sample when sub 
samples are added</li>
 <li>Bug 42185 - If a HTTP Sampler follows a redirect, and is set up to 
download images, then images are downloaded multiple times</li>
+<li>Bug 39808 - Invalid redirect causes incorrect sample time</li>
 </ul>
 
 <h3>Version 2.2</h3>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to