Bug 56772 - Handle IE Conditional comments when parsing embedded resources
Summary: Handle IE Conditional comments when parsing embedded resources
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.10
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-25 10:03 UTC by Irshad Ahmad
Modified: 2014-08-24 21:27 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Irshad Ahmad 2014-07-25 10:03:11 UTC
Hi Team,

Jmeter is downloading sub requests wihci is if IE 8 only javascript , even though User-Agent is Chrome 30.
Comment 1 Sebb 2014-07-25 22:32:01 UTC
Please provide sample URL that exhibits the problem.
Comment 2 Philippe Mouawad 2014-08-03 13:45:32 UTC
I think what is being reported here relates to embedded resources download.
In this case I suppose there is javascript in conditional block dedicated to IE8 browser.
Is the download feature supposed to handle this ?
Comment 3 Sebb 2014-08-03 22:06:17 UTC
(In reply to Philippe Mouawad from comment #2)
> I think what is being reported here relates to embedded resources download.
> In this case I suppose there is javascript in conditional block dedicated to
> IE8 browser.

Looks like it

> Is the download feature supposed to handle this ?

JMeter does not interpret javascript so almost certainly it cannot detect this.

I wonder if all browsers detect it?
Without a test sample it's hard to know.
Comment 4 Irshad Ahmad 2014-08-04 04:45:36 UTC
Hi Team,

Sorry for Late reply and Due to Security issues I cannot share the Application URL, Below is the explanation, let me know If you require anything else.

@Philippe Mouawad   : Yes this is about the embedded URL, Actually in Chrome browser this Specific IE8 only js is not downloading, Jmeter User-Agent is set to Chrome 30, but Jmeter is downloading this js file and which is leading to 404 Error. Since 404 error is the issue for Load Test and we are unable to supress the same.

I have below queries.
1. Is there any way in Jmeter we can avoid specific embedded resources?
2. Is there any problem with User-Agent settings?

and this is happening only in Jmeter 10 & 11, but Jmeter 9 works fine:)
Comment 5 Sebb 2014-08-04 10:21:34 UTC
(In reply to Irshad Ahmad from comment #4)
> Hi Team,
> 
> Sorry for Late reply and Due to Security issues I cannot share the
> Application URL, Below is the explanation, let me know If you require
> anything else.

Can you share the offending HTML?
The URLs and any other content can be redacted so long as the syntax/structure is retained.

> @Philippe Mouawad   : Yes this is about the embedded URL, Actually in Chrome
> browser this Specific IE8 only js is not downloading, Jmeter User-Agent is
> set to Chrome 30, but Jmeter is downloading this js file and which is
> leading to 404 Error. Since 404 error is the issue for Load Test and we are
> unable to supress the same.
> 
> I have below queries.
> 1. Is there any way in Jmeter we can avoid specific embedded resources?

http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request
See "Embedded URLs must match"

It looks like the following RE should match all but your URL:

^(?!regex)

where regex matches the URL.

> 2. Is there any problem with User-Agent settings?

JMeter does not change its behaviour based on the User Agent, but your server might.
 
> and this is happening only in Jmeter 10 & 11, but Jmeter 9 works fine:)

Probably JMeter 2.9 fails to extract the embedded URL, but without the sample HTML it's impossible to say.
Comment 6 Philippe Mouawad 2014-08-08 14:41:01 UTC
@Ahmad, can you provide request elements by sebb ?
Otherwise we won't be able to fix bug

Thanks
Comment 7 Philippe Mouawad 2014-08-22 22:13:48 UTC
I reproduced issue.
In fact the issue comes from switching :
htmlParser.className=org.apache.jmeter.protocol.http.parser.HtmlParserHTMLParser
to
htmlParser.className=org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser

since JMeter 2.10.

What happens is that HtmlParserHTMLParser simply ignored or was not able to parse correctly this kind of html:
<!--[if lte IE 8]>
	<link rel="stylesheet" type="text/css" href="./ie8-and-down.css" />
<![endif]-->


So it didn't extract the link.
New parser knows how to extract it.

As a workaround you can switch to :
htmlParser.className=org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser


@JMeter Dev Team:
To fix issue we need to add user agent as a parameter of HTMLParser#getEmbeddedResourceURLs
And then for example with Lagarto :
- Implement condComment callback in a way similar to what is done here:
https://github.com/oblac/jodd/blob/master/jodd-lagarto/src/main/java/jodd/lagarto/dom/LagartoDOMBuilderTagVisitor.java

where enabled controls wether addition to list of urls to parse should occur or not
Comment 8 Philippe Mouawad 2014-08-24 21:26:34 UTC
Date: Sun Aug 24 21:09:04 2014
New Revision: 1620188

URL: http://svn.apache.org/r1620188
Log:
Bug 56772 - Handle IE Conditional comments when parsing embedded resources
Bugzilla Id: 56772

Added:
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1.html   (with props)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_FF.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE6.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE7.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE8.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2.html   (with props)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_FF.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE7.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE8.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE9.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3.html   (with props)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_FF.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE10.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE55.all
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE6.all
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/JsoupBasedHtmlParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/RegexpHTMLParser.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
    jmeter/trunk/xdocs/changes.xml
    
Date: Sun Aug 24 21:18:30 2014
New Revision: 1620189

URL: http://svn.apache.org/r1620189
Log:
Bug 56772 - Handle IE Conditional comments when parsing embedded resources
Upgrade to Jodd 3.6.0-BETA2 as conditional comments have been introduced in BETA1 (some useful extra classes like HtmlCCommentExpressionMatcher)
Bugzilla Id: 56772

Added:
    jmeter/trunk/licenses/bin/jodd-core-3.6.0-BETA2.txt   (contents, props changed)
      - copied, changed from r1613729, jmeter/trunk/licenses/bin/jodd-core-3.5.2.txt
    jmeter/trunk/licenses/bin/jodd-lagarto-3.6.0-BETA2.txt   (contents, props changed)
      - copied, changed from r1613729, jmeter/trunk/licenses/bin/jodd-lagarto-3.5.2.txt
    jmeter/trunk/licenses/bin/jodd-log-3.6.0-BETA2.txt   (props changed)
      - copied unchanged from r1613729, jmeter/trunk/licenses/bin/jodd-log-3.5.2.txt
Removed:
    jmeter/trunk/licenses/bin/jodd-core-3.5.2.txt
    jmeter/trunk/licenses/bin/jodd-lagarto-3.5.2.txt
    jmeter/trunk/licenses/bin/jodd-log-3.5.2.txt
Modified:
    jmeter/trunk/build.properties
    jmeter/trunk/eclipse.classpath
    jmeter/trunk/res/maven/ApacheJMeter_parent.pom
    jmeter/trunk/xdocs/changes.xml
    
Date: Sun Aug 24 21:20:16 2014
New Revision: 1620190

URL: http://svn.apache.org/r1620190
Log:
Bug 56772 - Handle IE Conditional comments when parsing embedded resources
svn eol
Bugzilla Id: 56772

Modified:
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1.html   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_FF.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE6.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE7.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional1_IE8.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2.html   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_FF.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE7.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE8.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional2_IE9.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3.html   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_FF.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE10.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE55.all   (props changed)
    jmeter/trunk/bin/testfiles/HTMLParserTestCaseWithConditional3_IE6.all   (props changed)
    
Date: Sun Aug 24 21:25:16 2014
New Revision: 1620191

URL: http://svn.apache.org/r1620191
Log:
Bug 56772 - Handle IE Conditional comments when parsing embedded resources
Upgrade to Jodd 3.6.0-BETA2
Bugzilla Id: 56772

Added:
    jmeter/trunk/lib/mongo-java-driver-2.12.3.jar   (with props)
    jmeter/trunk/lib/xstream-1.4.6.jar   (with props)
Modified:
    jmeter/trunk/lib/   (props changed)
    jmeter/trunk/lib/aareadme.txt
Comment 9 Philippe Mouawad 2014-08-24 21:27:28 UTC
Resolved for Lagarto implementation.
For JSoup waiting for answers from group.
For other implementation not sure it is useful to implement this feature.