ASF Bugzilla – Attachment 17559 Details for
Bug 38474
HTML Link Parser doesn't follow <frame src="http://www.example.com/"> links
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Adds support for following frame tags to AnchorModifier.java
anchormodifier.txt (text/plain), 2.08 KB, created by
Matthew Buckett
on 2006-02-01 12:02:32 UTC
(
hide
)
Description:
Adds support for following frame tags to AnchorModifier.java
Filename:
MIME Type:
Creator:
Matthew Buckett
Created:
2006-02-01 12:02:32 UTC
Size:
2.08 KB
patch
obsolete
>Index: /home/buckett/workspace/jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java >=================================================================== >--- /home/buckett/workspace/jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java (revision 372904) >+++ /home/buckett/workspace/jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java (working copy) >@@ -99,6 +99,7 @@ > } > addAnchorUrls(html, result, sampler, potentialLinks); > addFormUrls(html, result, sampler, potentialLinks); >+ addFramesetUrls(html, result, sampler, potentialLinks); > if (potentialLinks.size() > 0) { > HTTPSamplerBase url = (HTTPSamplerBase) potentialLinks.get(rand.nextInt(potentialLinks.size())); > sampler.setDomain(url.getDomain()); >@@ -196,6 +197,39 @@ > } > } > } >+ >+ private void addFramesetUrls(Document html, HTTPSampleResult result, >+ HTTPSamplerBase config, List potentialLinks) { >+ String base = ""; >+ NodeList baseList = html.getElementsByTagName("base"); >+ if (baseList.getLength() > 0) { >+ base = baseList.item(0).getAttributes().getNamedItem("href") >+ .getNodeValue(); >+ } >+ NodeList nodeList = html.getElementsByTagName("frame"); >+ for (int i = 0; i < nodeList.getLength(); i++) { >+ Node tempNode = nodeList.item(i); >+ NamedNodeMap nnm = tempNode.getAttributes(); >+ Node namedItem = nnm.getNamedItem("src"); >+ if (namedItem == null) { >+ continue; >+ } >+ String hrefStr = namedItem.getNodeValue(); >+ try { >+ HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor( >+ hrefStr, new URL(result.getURL(), base)); >+ newUrl.setMethod(HTTPSamplerBase.GET); >+ log.debug("possible match: " + newUrl); >+ if (HtmlParsingUtils.isAnchorMatched(newUrl, config)) { >+ log.debug("Is a match! " + newUrl); >+ potentialLinks.add(newUrl); >+ } >+ } catch (MalformedURLException e) { >+ } catch (org.apache.oro.text.regex.MalformedPatternException e) { >+ log.error("Bad pattern", e); >+ } >+ } >+ } > > public static class Test extends JMeterTestCase { > public Test(String name) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 38474
: 17559