Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-39832

Send strong ETags for partial content

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.3.9, 2.4.6, 2.5.2, 2.6
    • Component/s: Files API
    • Labels:
    • Testing Instructions:
      Hide

      Apply the same testing instruction described in MDL-39688 except for:

      1. Now ETag header must be always present, in the form of Etag: "<content hash>". Please note that the case Moodle adopted for the ETag header is with T being in lower case.
      2. Chrome must be used first, especially to check the combination with $CFG->xsendfile: the issue has been found when playing MP4 files in Chrome under some combinations of web deployments where X-SendFile was used for performance reasons. The most simple combination is: Apache/2 + mod_xsendfile + $CFG->xsendfile = 'X-Sendfile'; in config.php
      3. In order to verify that caching capabilities work as expected you could use one of the MP4 files used to investigate the issue e.g.:
      4. Do not launch them directly to perform the tests by means of using the File resource link (e.g.: http://vm-centos5/moodle-master/mod/resource/view.php?id=51) but discover the file that will be served by the Files API looking for this URL http://hostname/path/to/moodle/pluginfile.php/<id>/mod_resource/content/<courseid>/<filename> in the media plugin HTML code block (look at the HTML source), e.g.: http://vm-centos5/moodle-master/pluginfile.php/78/mod_resource/content/1/mi2_vorbis51.mp4
      5. Before launching the URL above, please open Fiddler and press F12 to start "capturing" the network traffic
      6. Open the browser, Chrome, press F12 and select the Network tab
      7. Copy the URL above to let Chrome play the content 'till the end: you'll see in both Fiddler and Network tab the full and partial request according with your eventual playing with the slider, Content-Length will change according with Range requested in case of HTTP 206. In case of testing a local instance, the bigger (> 10MB) the movie the higher the chance to see many different HTTP partial requests when moving the slider forward, over the buffered content and then back again, untill the file will be fully buffered (then cached)
      8. Cleanup Fiddler capturing
      9. Close Chrome and then reopen it, press F12, select the Network tab, paste the URL, press ENTER
      10. Move the slider up and down to see the partial request being performed and the content being shown from that point of the slider. When the content will be cached, subsequent request will be served from browser cache instead of making requests to the server i.e. Fiddler will register nothing and the Network tab in Chrome will report request being served from the cache
      Show
      Apply the same testing instruction described in MDL-39688 except for: Now ETag header must be always present, in the form of Etag: "<content hash>" . Please note that the case Moodle adopted for the ETag header is with T being in lower case. Chrome must be used first, especially to check the combination with $CFG->xsendfile : the issue has been found when playing MP4 files in Chrome under some combinations of web deployments where X-SendFile was used for performance reasons. The most simple combination is: Apache/2 + mod_xsendfile + $CFG->xsendfile = 'X-Sendfile'; in config.php In order to verify that caching capabilities work as expected you could use one of the MP4 files used to investigate the issue e.g.: http://samples.mplayerhq.hu/MPEG-4/vorbis-in-mp4/mi2_vorbis51.mp4 http://www.tools4movies.com/dvd_catalyst_profile_samples/The%20Amazing%20Spiderman%20bionic%20hq.mp4 Download them e.g. using wget and upload each of them in Moodle as a File resource . Do not launch them directly to perform the tests by means of using the File resource link (e.g.: http://vm-centos5/moodle-master/mod/resource/view.php?id=51 ) but discover the file that will be served by the Files API looking for this URL http://hostname/path/to/moodle/pluginfile.php/ <id>/mod_resource/content/<courseid>/<filename> in the media plugin HTML code block (look at the HTML source), e.g.: http://vm-centos5/moodle-master/pluginfile.php/78/mod_resource/content/1/mi2_vorbis51.mp4 Before launching the URL above, please open Fiddler and press F12 to start "capturing" the network traffic Open the browser, Chrome, press F12 and select the Network tab Copy the URL above to let Chrome play the content 'till the end: you'll see in both Fiddler and Network tab the full and partial request according with your eventual playing with the slider, Content-Length will change according with Range requested in case of HTTP 206 . In case of testing a local instance, the bigger (> 10MB) the movie the higher the chance to see many different HTTP partial requests when moving the slider forward, over the buffered content and then back again, untill the file will be fully buffered (then cached) Cleanup Fiddler capturing Close Chrome and then reopen it, press F12, select the Network tab, paste the URL, press ENTER Move the slider up and down to see the partial request being performed and the content being shown from that point of the slider. When the content will be cached, subsequent request will be served from browser cache instead of making requests to the server i.e. Fiddler will register nothing and the Network tab in Chrome will report request being served from the cache
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      m26_MDL-39832_Fix_Chrome_Issues_ETag_XSendfile_2ndRound

      Description

      See MDL-39688, this patch started to implement ETag headers based on HTTP ranges.

      Further investigations have driven to another solution which should be applied to the branches where MDL-39688 has been applied because of the ETag header added by Moodle is content driven, helping browser caching mechanisms to work as expected even in cluster deployments where e.g. ETag being added by Apache+X-Sendifle could be built on top of file inodes, probably dependent on the web server serving the request even if files are shared ($CFG->dataroot) someway between all the nodes.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    9/Sep/13