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

download_file_content $timeout option is only a connect timeout in url mode

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9.1
    • Component/s: Libraries
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      download_file_content has a $timeout parameter. When in emulation (Snoopy) mode, this is the 'read timeout', but in Curl mode it only sets CURLOPT_CONNECTTIMEOUT, the connection timeout, and not CURLOPT_TIMEOUT, the hard timeout.

      I have made a patch. Some notes about it:

      1) I made the current timeout parameter control the read timeout. This makes Snoopy/curl behaviour consistent (changing curl to do what snoopy did).

      2) I changed the default to 5 minutes (300) in case people are using it to download largeish files.

      3) I added an extra 'connect timeout' which defaults to 20.

      The reason for making the normal, first timeout parameter the read timeout one is that you probably won't need to change the connect timeout unless you want to make things really short e.g. link checker, (ii) current code probably expects the timeout parameter to work, which it won't in many cases at present.

      Connect timeout doesn't do anything if using a proxy (well unless your proxy is down), this is documented. [Another reason for focusing on 'real' timeout.]

      I'd suggest fixing this in 1.9x if possible.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/May/08