Summary: | retieve all embeded resources from html pages for CSS images | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Cristian Olaru <colaru> |
Component: | Main | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | other | ||
URL: | http://www.nabble.com/retieve-all-embeded-resources-from-html-pages-tf2395397.html |
Description
Cristian Olaru
2006-10-06 06:56:14 UTC
The problem is not that the response is not valid xhtml. The reason is that the parser that parses the response and looks for embedded resources, does not look for constructs like <anytag style="background:url('someurl')"/>. I am not sure if the parser should look for such embedded resources. If the stylesheet file references any resources, those will not be downloaded by jmeter, because jmeter only downloads any stylesheet files referenced, it does not parse the downloaded stylesheet files and then download all resources referenced by the stylesheet file. So if there should be no difference between resources mentioned inside stylesheet files and resouces mentioned in inline style of the actual document, then I think this bug should be closed as "invalid". If you want resources mentioned in inline styling of the document, then the following code could be added to the bottom of the "parseNodes" method of the "HtmlParserHTMLParser" seems to do the work : String styleTagStr = tag.getAttribute("STYLE"); if(styleTagStr != null) { PatternCompiler compiler = new Perl5Compiler(); PatternMatcher matcher = new Perl5Matcher(); Pattern pattern = null; PatternMatcherInput input = null; try { pattern = compiler.compile("URL\\(('|\")(.*)('|\")\\)", Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK | Perl5Compiler.READ_ONLY_MASK); input = new PatternMatcherInput(styleTagStr); while (matcher.contains(input, pattern)) { MatchResult match = matcher.getMatch(); // The value is in the second group String styleUrl = match.group(2); urls.addURL(styleUrl, baseUrl.url); } } catch (MalformedPatternException mpe) { log.warn("Malformed pattern for getting url of style attribute of a tag"); } } Agreed that JMeter should not parse the content of CSS files when looking for embedded resources. [This could be quite tricky, as the CSS file can contain definitions that are not used.] However, if the background image is part of a style attribute in the HTML page itself, then it seems sensible to treat this the same as other background images. I'll see about adding this. Note: there are two related issues: bug 40933 and bug 40945. Now fixed in SVN. It will be in the next release and the next nightly build at: http://people.apache.org/builds/jakarta-jmeter/nightly/ This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1805 |