Bug 62784 - Add download of embedded resources using HTML5 tags in HTTP Requests
Summary: Add download of embedded resources using HTML5 tags in HTTP Requests
Status: NEEDINFO
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 4.0
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-01 08:46 UTC by juergen.plasser
Modified: 2018-10-01 15:08 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description juergen.plasser 2018-10-01 08:46:18 UTC
Currently it is not possible to download HTML5 embedded resources eg. <picture> in HTTP Requests. Please add this functionality.

Or is it possible to use a different HTML parser to gain more functionality? And if yes, which one is recommended by you guys?

Regards
Jürgen
Comment 1 Philippe Mouawad 2018-10-01 12:03:23 UTC
(In reply to juergen.plasser from comment #0)
> Currently it is not possible to download HTML5 embedded resources eg.
> <picture> in HTTP Requests. Please add this functionality.
> 
> Or is it possible to use a different HTML parser to gain more functionality?
> And if yes, which one is recommended by you guys?

The default one LagartoBasedHtmlParser is the best and more up to date one.

Regarding picture, how would you specify the browser definition to match the media query ?

Also regarding load, since <img> is mandatory, you would end up anyway downloading 1 resources, potentially not the one associated to the browser definition.


Feel free to propose a patch :
https://github.com/apache/jmeter/blob/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/LagartoBasedHtmlParser.java


> 
> Regards
> Jürgen
Comment 2 juergen.plasser 2018-10-01 15:01:25 UTC
Since the load depends on the size of the img we will need a setting to define the media properties. This is an example of the source I have, different media sizes and one fallback image:

<figure class="...">
  <div class="...">
    <picture>
      <source media="(min-width: 1220px)" srcset="/...png 1x, /...png 2x">
      <source media="(min-width: 768px) and (max-width: 1219px)" srcset="/...png 1x, /...png 2x">
      <source media="(min-width: 576px) and (max-width: 767px)" srcset="/...png 1x, /...png 2x">
      <img src="data:image/gif;base64,...==" srcset="/...png 1x, /...png 2x" alt="Alt">
    </picture>
  </div>
</figure>

In this case I do not see any <img> tag (the fallback image) being downloaded, surely because it's embedded (?). From my understanding JMeter has to implement a flexible and versatile parallel download mechanism that follows the HTML5 spec. As the image size depends on the media attribute, I think it's a good start to have some media regex to filter the sources and always download the first match or the fallback, if nothing matches.

But speaking for this case above, JMeter does not recognize the srcset attribute and therefore not any download is processed. That's imho not a parser issue, it's an issue of the "embedded resource download" function of the HTTP Requests sampler.

How can I propose new features for JMeter? Is this the right place to go?

-Jürgen
Comment 3 Philippe Mouawad 2018-10-01 15:08:08 UTC
(In reply to juergen.plasser from comment #2)
> Since the load depends on the size of the img we will need a setting to
> define the media properties. This is an example of the source I have,
> different media sizes and one fallback image:
> 
> <figure class="...">
>   <div class="...">
>     <picture>
>       <source media="(min-width: 1220px)" srcset="/...png 1x, /...png 2x">
>       <source media="(min-width: 768px) and (max-width: 1219px)"
> srcset="/...png 1x, /...png 2x">
>       <source media="(min-width: 576px) and (max-width: 767px)"
> srcset="/...png 1x, /...png 2x">
>       <img src="data:image/gif;base64,...==" srcset="/...png 1x, /...png 2x"
> alt="Alt">
>     </picture>
>   </div>
> </figure>
> 
> In this case I do not see any <img> tag (the fallback image) being
> downloaded, surely because it's embedded (?).

Yes as it's embedded in img no download occurs

> From my understanding JMeter
> has to implement a flexible and versatile parallel download mechanism that
> follows the HTML5 spec. As the image size depends on the media attribute, I
> think it's a good start to have some media regex to filter the sources and
> always download the first match or the fallback, if nothing matches.
> 
> But speaking for this case above, JMeter does not recognize the srcset
> attribute and therefore not any download is processed. That's imho not a
> parser issue, it's an issue of the "embedded resource download" function of
> the HTTP Requests sampler.


The parser currently ignores picture
And indeed there should be a place to indicate what media regex to use (or browser definition)

> 
> How can I propose new features for JMeter? Is this the right place to go?

Yes, you can also use jmeter mailing list:
https://jmeter.apache.org/mail2.html

> 
> -Jürgen