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

download_file_content fails under certain conditions

XMLWordPrintable

    • Any
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • MDL-38268-master
    • Hide

      Set the global config setting curltimeoutkbitrate to zero and the SCORM will be created successfully.

      Show
      Set the global config setting curltimeoutkbitrate to zero and the SCORM will be created successfully.
    • Hide
      1. Go to SCORM package settings (Site administration ► Plugins ► Activity modules ► SCORM package), and enable "downloaded package type" (scorm | allowtypelocalsync)
      2. Verify you have the default value of 56 set for "curltimeoutkbitrate" in Performance settings (Site administration ► Server ► Performance).
      3. Create a new SCORM module, choosing "Downloaded package" as the Type and entering a remote URL for downloading from
      4. Enter the following URL – http://www.ostyn.com/standards/scorm/samples/proddingsco.zip
      5. Save
      Show
      Go to SCORM package settings ( Site administration ► Plugins ► Activity modules ► SCORM package ), and enable "downloaded package type" (scorm | allowtypelocalsync) Verify you have the default value of 56 set for "curltimeoutkbitrate" in Performance settings ( Site administration ► Server ► Performance ). Create a new SCORM module, choosing "Downloaded package" as the Type and entering a remote URL for downloading from Enter the following URL – http://www.ostyn.com/standards/scorm/samples/proddingsco.zip Save

      Steps to reproduce::
      1) Go to SCORM package settings, and enable "downloaded package type" (scorm | allowtypelocalsync)
      2) Verify you have the default value of 56 set for "curltimeoutkbitrate" in Settings.
      3) Create a new SCORM module, choosing "Downloaded package" as the Type and entering a remote URL for downloading from
      4) Save

      Now you can set curltimeoutkbitrate to zero and the SCORM will be created successfully. I'm attaching my screenshot. I believe Heather was receiving a slightly different error, but having a similar outcome.

      The problem seems to be in lib/filelib.php around line 1230:

             curl_setopt_array ($ch, array(
                  CURLOPT_RETURNTRANSFER => true,
                  CURLOPT_NOBODY         => false)
              );
      

      The problem here is that simply setting CURLOPT_NOBODY to false is insufficient.

      From the PHP documentation:
      CURLOPT_NOBODY - TRUE to exclude the body from the output. Request method is then set to HEAD. Changing this to FALSE does not change it to GET.

      CURLOPT_HTTPGET - TRUE to reset the HTTP request method to GET. Since GET is the default, this is only necessary if the request method has been changed.

      Changing as such allowed the file to successfully download if the curltimeoutkbitrate value was set:

              curl_setopt_array ($ch, array(
                  CURLOPT_RETURNTRANSFER => true,
                  CURLOPT_NOBODY         => false,
                  CURLOPT_HTTPGET        => true)
              );
      

      It may be worthwhile to check for this in other areas of Moodle also?

            jfilip Justin Filip
            dakota.duff Dakota Duff
            Andrew Davis Andrew Davis
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rossiani Wijaya Rossiani Wijaya
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.