svn commit: r897739 - /jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java

[email protected]
Newsgroups gmane.comp.jakarta.jmeter.devel
Message-ID <[email protected]>
Author: sebb
Date: Mon Jan 11 00:29:30 2010
New Revision: 897739

URL: http://svn.apache.org/viewvc?rev=897739&view=rev
Log:
Set latency in error cases

Modified:
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java

Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java?rev=897739&r1=897738&r2=897739&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java Mon Jan 11 00:29:30 2010
@@ -59,6 +59,9 @@
  *
  */
 public class HTTPSampler extends HTTPSamplerBase implements Interruptible {
+    private static final boolean OBEY_CONTENT_LENGTH = 
+        JMeterUtils.getPropDefault("httpsampler.obey_contentlength", false); // $NON-NLS-1$
+
     private static final long serialVersionUID = 233L;
 
     private static final Logger log = LoggingManager.getLoggerForClass();
@@ -233,10 +236,10 @@
 
         final int contentLength = conn.getContentLength();
         if ((contentLength == 0)
-            && JMeterUtils.getPropDefault("httpsampler.obey_contentlength", // $NON-NLS-1$
-            false)) {
+            && OBEY_CONTENT_LENGTH) {
             log.info("Content-Length: 0, not reading http-body");
             res.setResponseHeaders(getResponseHeaders(conn));
+            res.latencyEnd();
             return NULL_BA;
         }
 
@@ -263,6 +266,7 @@
             if (errorStream == null) {
                 log.info("Error Response Code: "+conn.getResponseCode()+", Server sent no Errorpage");
                 res.setResponseHeaders(getResponseHeaders(conn));
+                res.latencyEnd();
                 return NULL_BA;
             }
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.