This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fc29c9494 fix(deps): update org.jodd, skip Internet Explorer 6-9
6fc29c9494 is described below

commit 6fc29c949430a765b4dabf9d729732fc03b96b7f
Author: Vladimir Sitnikov <[email protected]>
AuthorDate: Mon Oct 13 19:52:53 2025 +0300

    fix(deps): update org.jodd, skip Internet Explorer 6-9
    
    Previously, JMeter analyzed conditional commens and it could parse
    HTML pages as if it was Internet Explorer of a specific version.
    However, Internet Explorer 10 no longer supports conditional comments,
    and IE 9 has been unsupported for quite some time already.
    
    See https://github.com/oblac/jodd-lagarto/issues/25
---
 src/bom-thirdparty/build.gradle.kts                |  8 +--
 .../http/parser/LagartoBasedHtmlParser.java        | 58 +-----------------
 .../protocol/http/parser/TestHTMLParser.java       | 71 ++++------------------
 xdocs/changes.xml                                  |  5 ++
 4 files changed, 25 insertions(+), 117 deletions(-)

diff --git a/src/bom-thirdparty/build.gradle.kts 
b/src/bom-thirdparty/build.gradle.kts
index 77232e8bf6..4d54c9168c 100644
--- a/src/bom-thirdparty/build.gradle.kts
+++ b/src/bom-thirdparty/build.gradle.kts
@@ -129,10 +129,10 @@ dependencies {
         api("org.jetbrains.lets-plot:lets-plot-batik:4.1.0")
         api("org.jetbrains.lets-plot:lets-plot-kotlin-jvm:4.5.0")
         api("org.jetbrains:annotations:24.1.0")
-        api("org.jodd:jodd-core:5.0.13")
-        api("org.jodd:jodd-lagarto:5.0.13")
-        api("org.jodd:jodd-log:5.0.13")
-        api("org.jodd:jodd-props:5.0.13")
+        api("org.jodd:jodd-core:5.3.0")
+        api("org.jodd:jodd-lagarto:6.0.6")
+        api("org.jodd:jodd-log:5.1.6")
+        api("org.jodd:jodd-props:6.0.2")
         api("org.jsoup:jsoup:1.17.1")
         api("org.mongodb:mongo-java-driver:2.14.3")
         api("org.mozilla:rhino:1.7.14")
diff --git 
a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java
 
b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java
index 9c30ee8d8f..2338e83f29 100644
--- 
a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java
+++ 
b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java
@@ -19,9 +19,7 @@ package org.apache.jmeter.protocol.http.parser;
 
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayDeque;
 import java.util.Collections;
-import java.util.Deque;
 import java.util.Iterator;
 
 import org.apache.jmeter.protocol.http.util.ConversionUtils;
@@ -34,7 +32,6 @@ import jodd.lagarto.LagartoParser;
 import jodd.lagarto.Tag;
 import jodd.lagarto.TagType;
 import jodd.lagarto.dom.HtmlCCommentExpressionMatcher;
-import jodd.lagarto.dom.LagartoDomBuilderConfig;
 import jodd.log.LoggerFactory;
 import jodd.log.impl.Slf4jLogger;
 import jodd.util.CharSequenceUtil;
@@ -60,21 +57,16 @@ public class LagartoBasedHtmlParser extends HTMLParser {
     }
 
     private static final class JMeterTagVisitor extends EmptyTagVisitor {
-        private HtmlCCommentExpressionMatcher htmlCCommentExpressionMatcher;
         private final URLCollection urls;
         private final URLPointer baseUrl;
-        private final Float ieVersion;
-        private final Deque<Boolean> enabled = new ArrayDeque<>();
 
         /**
          * @param baseUrl base url to add possibly missing information to urls 
found in <code>urls</code>
          * @param urls collection of urls to consider
-         * @param ieVersion version number of IE to emulate
          */
-        public JMeterTagVisitor(final URLPointer baseUrl, URLCollection urls, 
Float ieVersion) {
+        public JMeterTagVisitor(final URLPointer baseUrl, URLCollection urls) {
             this.urls = urls;
             this.baseUrl = baseUrl;
-            this.ieVersion = ieVersion;
         }
 
         private void extractAttribute(Tag tag, String attributeName) {
@@ -93,9 +85,6 @@ public class LagartoBasedHtmlParser extends HTMLParser {
          */
         @Override
         public void script(Tag tag, CharSequence body) {
-            if (!enabled.peek()) {
-                return;
-            }
             extractAttribute(tag, ATT_SRC);
         }
 
@@ -106,9 +95,6 @@ public class LagartoBasedHtmlParser extends HTMLParser {
          */
         @Override
         public void tag(Tag tag) {
-            if (!enabled.peek()) {
-                return;
-            }
             TagType tagType = tag.getType();
             switch (tagType) {
             case START:
@@ -184,54 +170,16 @@ public class LagartoBasedHtmlParser extends HTMLParser {
                 break;
             }
         }
-
-        /* (non-Javadoc)
-         * @see 
jodd.lagarto.EmptyTagVisitor#condComment(java.lang.CharSequence, boolean, 
boolean, boolean)
-         */
-        @Override
-        public void condComment(CharSequence expression, boolean isStartingTag,
-                boolean isHidden, boolean isHiddenEndTag) {
-            // See http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
-            if(!isStartingTag) {
-                enabled.pop();
-            } else {
-                if (htmlCCommentExpressionMatcher == null) {
-                    htmlCCommentExpressionMatcher = new 
HtmlCCommentExpressionMatcher();
-                }
-                String expressionString = expression.toString().trim();
-                enabled.push(htmlCCommentExpressionMatcher.match(ieVersion,
-                        expressionString));
-            }
-        }
-
-        /* (non-Javadoc)
-         * @see jodd.lagarto.EmptyTagVisitor#start()
-         */
-        @Override
-        public void start() {
-            super.start();
-            enabled.clear();
-            enabled.push(Boolean.TRUE);
-        }
     }
 
     @Override
     public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] 
html, URL baseUrl,
             URLCollection coll, String encoding) throws HTMLParseException {
         try {
-            Float ieVersion = extractIEVersion(userAgent);
-
             String contents = new String(html,encoding);
             LagartoParser lagartoParser = new 
LagartoParser(contents.toCharArray());
-            LagartoDomBuilderConfig config = new LagartoDomBuilderConfig();
-            config.setCaseSensitive(false);
-            // Conditional comments only apply for IE < 10
-            
config.setEnableConditionalComments(isEnableConditionalComments(ieVersion));
-            if(ieVersion != null) {
-                config.setCondCommentIEVersion(ieVersion);
-            }
-            lagartoParser.setConfig(config);
-            JMeterTagVisitor tagVisitor = new JMeterTagVisitor(new 
URLPointer(baseUrl), coll, ieVersion);
+            lagartoParser.getConfig().setCaseSensitive(false);
+            JMeterTagVisitor tagVisitor = new JMeterTagVisitor(new 
URLPointer(baseUrl), coll);
             lagartoParser.parse(tagVisitor);
             return coll.iterator();
         } catch (LagartoException e) {
diff --git 
a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
 
b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
index 9f94e49eb6..9f61d454c9 100644
--- 
a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
+++ 
b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
@@ -30,6 +30,7 @@ import java.io.Reader;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
@@ -61,12 +62,6 @@ public class TestHTMLParser extends JMeterTestCase {
 
     private static final String DEFAULT_UA  = "Apache-HttpClient/4.2.6";
     private static final String UA_FF       = "Mozilla/5.0 (Windows NT 5.1; 
rv:31.0) Gecko/20100101 Firefox/31.0";
-    private static final String UA_IE55     = "Mozilla/4.0 (compatible;MSIE 
5.5; Windows 98)";
-    private static final String UA_IE6      = "Mozilla/5.0 (Windows; U; MSIE 
6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)";
-    private static final String UA_IE7      = "Mozilla/5.0 (Windows; U; MSIE 
7.0; Windows NT 6.0; en-US)";
-    private static final String UA_IE8      = "Mozilla/5.0 (compatible; MSIE 
8.0; Windows NT 6.1; Trident/4.0; "
-            + "GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)";
-    private static final String UA_IE9      = "Mozilla/5.0 (Windows; U; MSIE 
9.0; WIndows NT 9.0; en-US))";
     private static final String UA_IE10     = "Mozilla/5.0 (compatible; MSIE 
10.0; Windows NT 6.1; Trident/6.0)";
 
     private static class StaticTestClass // Can't instantiate
@@ -119,6 +114,10 @@ public class TestHTMLParser extends JMeterTestCase {
             this.userAgent = userAgent;
         }
 
+        @Override
+        public String toString() {
+            return "TestData [userAgent=" + userAgent + ", htmlFileName=" + 
fileName + ", expectedList=" + expectedList + "]";
+        }
     }
 
     private static final String DEFAULT_JMETER_PARSER =
@@ -183,26 +182,6 @@ public class TestHTMLParser extends JMeterTestCase {
                 null,
                 "testfiles/HTMLParserTestCaseWithConditional1_FF.all",
                 UA_FF),
-        new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional1_IE6.all",
-                UA_IE6),
-        new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional1_IE7.all",
-                UA_IE7),
-        new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional1_IE8.all",
-                UA_IE8),
-        new TestData("testfiles/HTMLParserTestCaseWithConditional1.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional1_IE8.all",
-                UA_IE8),
 
         // FF gets mixed up by nested comments
         new TestData("testfiles/HTMLParserTestCaseWithConditional2.html",
@@ -211,41 +190,17 @@ public class TestHTMLParser extends JMeterTestCase {
                 "testfiles/HTMLParserTestCaseWithConditional2_FF.all",
                 UA_FF),
 
-        new TestData("testfiles/HTMLParserTestCaseWithConditional2.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional2_IE7.all",
-                UA_IE7),
-        new TestData("testfiles/HTMLParserTestCaseWithConditional2.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional2_IE8.all",
-                UA_IE8),
-        new TestData("testfiles/HTMLParserTestCaseWithConditional2.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional2_IE9.all",
-                UA_IE9),
         new TestData("testfiles/HTMLParserTestCaseWithConditional3.html",
                 "http://localhost/mydir/myfile.html";,
                 null,
                 "testfiles/HTMLParserTestCaseWithConditional3_FF.all",
                 UA_FF),
+
         new TestData("testfiles/HTMLParserTestCaseWithConditional3.html",
                 "http://localhost/mydir/myfile.html";,
                 null,
                 "testfiles/HTMLParserTestCaseWithConditional3_IE10.all",
                 UA_IE10),
-        new TestData("testfiles/HTMLParserTestCaseWithConditional3.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional3_IE55.all",
-                UA_IE55),
-        new TestData("testfiles/HTMLParserTestCaseWithConditional3.html",
-                "http://localhost/mydir/myfile.html";,
-                null,
-                "testfiles/HTMLParserTestCaseWithConditional3_IE6.all",
-                UA_IE6)
     };
 
     static Stream<Arguments> parsersAndTestNumbers() {
@@ -255,8 +210,8 @@ public class TestHTMLParser extends JMeterTestCase {
     }
 
     static Stream<Arguments> specificParserTests() {
-        return IntStream.range(0, SPECIFIC_PARSER_TESTS.length)
-                        .mapToObj(testNumber -> 
arguments(DEFAULT_JMETER_PARSER, testNumber));
+        return Arrays.stream(SPECIFIC_PARSER_TESTS)
+                .map(testData -> arguments(DEFAULT_JMETER_PARSER, testData));
     }
 
     // Test if can instantiate parser using property name
@@ -354,13 +309,13 @@ public class TestHTMLParser extends JMeterTestCase {
 
     @ParameterizedTest
     @MethodSource("specificParserTests")
-    public void testSpecificParserList(String parserName, int testNumber) 
throws Exception {
+    public void testSpecificParserList(String parserName, TestData testData) 
throws Exception {
         HTMLParser p = (HTMLParser) BaseParser.getParser(parserName);
-        filetest(p, SPECIFIC_PARSER_TESTS[testNumber].fileName,
-                SPECIFIC_PARSER_TESTS[testNumber].baseUrl,
-                SPECIFIC_PARSER_TESTS[testNumber].expectedList,
+        filetest(p, testData.fileName,
+                testData.baseUrl,
+                testData.expectedList,
                 new ArrayList<>(), true,
-                SPECIFIC_PARSER_TESTS[testNumber].userAgent);
+                testData.userAgent);
     }
 
 
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index f50ac08b50..eea3c92ab0 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -70,6 +70,11 @@ Summary
     <li><issue>6357</issue><pr>6358</pr> Ensure writable directories when 
copying template files while report generation.</li>
   </ul>
 
+  <h3>HTTP Samplers and Test Script Recorder</h3>
+  <ul>
+    <li><pr>5891</pr>Skip Internet Explorer 6-9 conditional comment processing 
when fetching resource links</li>
+  </ul>
+
  <!--  =================== Thanks =================== -->
 
 <ch_section>Thanks</ch_section>

Reply via email to