Author: sebb Date: Tue Dec 7 14:57:49 2010 New Revision: 1043074 URL: http://svn.apache.org/viewvc?rev=1043074&view=rev Log: Don't allow illegal methods Move Cache check
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1043074&r1=1043073&r2=1043074&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java (original) +++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java Tue Dec 7 14:57:49 2010 @@ -214,18 +214,18 @@ public class HTTPHC3Impl extends HTTPHCA httpMethod = new DeleteMethod(urlStr); } else if (method.equals(GET)){ httpMethod = new GetMethod(urlStr); - final CacheManager cacheManager = getCacheManager(); - if (cacheManager != null && GET.equalsIgnoreCase(method)) { - if (cacheManager.inCache(url)) { - res.sampleEnd(); - res.setResponseNoContent(); - res.setSuccessful(true); - return res; - } - } } else { - log.error("Unexpected method (converted to GET): "+method); - httpMethod = new GetMethod(urlStr); + throw new IllegalArgumentException("Unexpected method: "+method); + } + + final CacheManager cacheManager = getCacheManager(); + if (cacheManager != null && GET.equalsIgnoreCase(method)) { + if (cacheManager.inCache(url)) { + res.sampleEnd(); + res.setResponseNoContent(); + res.setSuccessful(true); + return res; + } } // Set any default request headers @@ -304,7 +304,6 @@ public class HTTPHC3Impl extends HTTPHCA saveConnectionCookies(httpMethod, res.getURL(), getCookieManager()); // Save cache information - final CacheManager cacheManager = getCacheManager(); if (cacheManager != null){ cacheManager.saveDetails(httpMethod, res); } --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@jakarta.apache.org For additional commands, e-mail: notifications-h...@jakarta.apache.org