You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2013/03/02 22:29:48 UTC
svn commit: r1451946 - in /jmeter/trunk:
src/protocol/http/org/apache/jmeter/protocol/http/parser/ xdocs/
Author: pmouawad
Date: Sat Mar 2 21:29:48 2013
New Revision: 1451946
URL: http://svn.apache.org/r1451946
Log:
Bug 54629 - HTMLParser does not extract <object> tag urls
Bugzilla Id: 54629
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java?rev=1451946&r1=1451945&r2=1451946&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HTMLParser.java Sat Mar 2 21:29:48 2013
@@ -53,6 +53,7 @@ public abstract class HTMLParser {
protected static final String TAG_IMAGE = "img";// $NON-NLS-1$
protected static final String TAG_INPUT = "input";// $NON-NLS-1$
protected static final String TAG_LINK = "link";// $NON-NLS-1$
+ protected static final String TAG_OBJECT = "object";// $NON-NLS-1$
protected static final String TAG_SCRIPT = "script";// $NON-NLS-1$
protected static final String STYLESHEET = "stylesheet";// $NON-NLS-1$
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java?rev=1451946&r1=1451945&r2=1451946&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParserHTMLParser.java Sat Mar 2 21:29:48 2013
@@ -22,6 +22,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
+import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.protocol.http.util.ConversionUtils;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
@@ -35,6 +36,7 @@ import org.htmlparser.tags.CompositeTag;
import org.htmlparser.tags.FrameTag;
import org.htmlparser.tags.ImageTag;
import org.htmlparser.tags.InputTag;
+import org.htmlparser.tags.ObjectTag;
import org.htmlparser.tags.ScriptTag;
import org.htmlparser.util.NodeIterator;
import org.htmlparser.util.ParserException;
@@ -146,6 +148,19 @@ class HtmlParserHTMLParser extends HTMLP
// and archives (.jar and .zip) files as well.
AppletTag applet = (AppletTag) tag;
binUrlStr = applet.getAppletClass();
+ } else if (tag instanceof ObjectTag) {
+ // look for Objects
+ ObjectTag applet = (ObjectTag) tag;
+ String data = applet.getAttribute("codebase");
+ if(!StringUtils.isEmpty(data)) {
+ binUrlStr = data;
+ }
+
+ data = applet.getAttribute("data");
+ if(!StringUtils.isEmpty(data)) {
+ binUrlStr = data;
+ }
+
} else if (tag instanceof InputTag) {
// we check the input tag type for image
if (ATT_IS_IMAGE.equalsIgnoreCase(tag.getAttribute(ATT_TYPE))) {
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java?rev=1451946&r1=1451945&r2=1451946&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java Sat Mar 2 21:29:48 2013
@@ -23,6 +23,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
+import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.protocol.http.util.ConversionUtils;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
@@ -119,6 +120,20 @@ class JTidyHTMLParser extends HTMLParser
urls.addURL(getValue(attrs, "code"), baseUrl);
break;
}
+
+ if (name.equalsIgnoreCase(TAG_OBJECT)) {
+ String data = getValue(attrs, "codebase");
+ if(!StringUtils.isEmpty(data)) {
+ urls.addURL(data, baseUrl);
+ }
+
+ data = getValue(attrs, "data");
+ if(!StringUtils.isEmpty(data)) {
+ urls.addURL(data, baseUrl);
+ }
+ break;
+ }
+
if (name.equalsIgnoreCase(TAG_INPUT)) {
String src = getValue(attrs, ATT_SRC);
String typ = getValue(attrs, ATT_TYPE);
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java?rev=1451946&r1=1451945&r2=1451946&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java Sat Mar 2 21:29:48 2013
@@ -98,7 +98,7 @@ class RegexpHTMLParser extends HTMLParse
+ "|BASE" + SEP + "HREF" + VALUE
+ "|(?:IMG|SCRIPT|FRAME|IFRAME|BGSOUND)" + SEP + "SRC" + VALUE
+ "|APPLET" + SEP + "CODE(?:BASE)?" + VALUE
- + "|(?:EMBED|OBJECT)" + SEP + "(?:SRC|CODEBASE)" + VALUE
+ + "|(?:EMBED|OBJECT)" + SEP + "(?:SRC|CODEBASE|DATA)" + VALUE
+ "|(?:BODY|TABLE|TR|TD)" + SEP + "BACKGROUND" + VALUE
+ "|[^<]+?STYLE\\s*=['\"].*?URL\\(\\s*['\"](.+?)['\"]\\s*\\)"
+ "|INPUT(?:" + SEP + "(?:SRC" + VALUE
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1451946&r1=1451945&r2=1451946&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sat Mar 2 21:29:48 2013
@@ -94,6 +94,7 @@ This does not affect JMeter operation.
<li><bugzilla>54293</bugzilla> - JMeter rejects html tags '<' in query params as invalid when they are accepted by the browser</li>
<li><bugzilla>54142</bugzilla> - HTTP Proxy Server throws an exception when path contains "|" character </li>
<li><bugzilla>54627</bugzilla> - JMeter Proxy GUI: Type of sampler settings takes the whole screen with when there are samplers with long name</li>
+<li><bugzilla>54629</bugzilla> 54629 - HTMLParser does not extract <object> tag urls</li>
</ul>
<h3>Other Samplers</h3>