Author: sebb
Date: Tue May 17 19:56:24 2011
New Revision: 1104502

URL: http://svn.apache.org/viewvc?rev=1104502&view=rev
Log:
Bug 50544 - In Apache Common Log the HEAD requests cause problems.

Modified:
    
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java
    
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestTCLogParser.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java?rev=1104502&r1=1104501&r2=1104502&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java
 (original)
+++ 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java
 Tue May 17 19:56:24 2011
@@ -82,6 +82,8 @@ public class TCLogParser implements LogP
 
     public static final String POST = "POST";
 
+    public static final String HEAD = "HEAD";
+
     /** protected members * */
     protected String RMETHOD = null;
 
@@ -213,7 +215,7 @@ public class TCLogParser implements LogP
     /**
      * parse a set number of lines from the access log. Keep in mind the number
      * of lines parsed will depend the filter and number of lines in the log.
-     * The method returns the actual lines parsed.
+     * The method returns the actual number of lines parsed.
      *
      * @param count
      * @return lines parsed
@@ -361,6 +363,8 @@ public class TCLogParser implements LogP
                             RMETHOD = GET;
                         } else if (t.equalsIgnoreCase(POST)) {
                             RMETHOD = POST;
+                        } else if (t.equalsIgnoreCase(HEAD)) {
+                            RMETHOD = HEAD;
                         }
                         // there should only be one token
                         // that starts with slash character
@@ -392,6 +396,9 @@ public class TCLogParser implements LogP
         } else if (text.indexOf("POST") > -1) {
             this.RMETHOD = POST;
             return true;
+        } else if (text.indexOf("HEAD") > -1) {
+            this.RMETHOD = HEAD;
+            return true;
         } else {
             return false;
         }

Modified: 
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestTCLogParser.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestTCLogParser.java?rev=1104502&r1=1104501&r2=1104502&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestTCLogParser.java
 (original)
+++ 
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestTCLogParser.java
 Tue May 17 19:56:24 2011
@@ -30,6 +30,8 @@ public class TestTCLogParser  extends JM
 
         private static final String URL2 = "127.0.0.1 - - 
[08/Jan/2003:07:03:54 -0500] \"GET /addrbook?x=y HTTP/1.1\" 200 1981";
 
+        private static final String TEST3 = "127.0.0.1 - - 
[08/Jan/2003:07:03:54 -0500] \"HEAD /addrbook/ HTTP/1.1\" 200 1981";
+
         public void testConstruct() throws Exception {
             TCLogParser tcp;
             tcp = new TCLogParser();
@@ -47,7 +49,14 @@ public class TestTCLogParser  extends JM
         }
 
         public void testcheckURL() throws Exception {
-            assertFalse("URL is not have a query", tclp.checkURL(URL1));
+            assertFalse("URL does not have a query", tclp.checkURL(URL1));
             assertTrue("URL is a query", tclp.checkURL(URL2));
         }
+
+        public void testHEAD() throws Exception {
+            String res = tclp.cleanURL(TEST3);
+            assertEquals("/addrbook/", res);
+            assertNull(tclp.stripFile(res, new HTTPNullSampler()));
+        }
+
 }
\ No newline at end of file

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1104502&r1=1104501&r2=1104502&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Tue May 17 19:56:24 2011
@@ -100,6 +100,7 @@ This is internal to the workings of the 
 <li>Bug 50686 - HeaderManager logging too verbose when merging instances</li>
 <li>Bug 50963 - AjpSampler throws 
java.lang.StringIndexOutOfBoundsException</li>
 <li>Bug 50516 - "Host" header in HTTP Header Manager is not included in 
generated HTTP request</li>
+<li>Bug 50544 - In Apache Common Log the HEAD requests cause problems.</li>
 </ul>
 
 <h3>Other Samplers</h3>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to