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

Function download_file_content does not correctly handle headers when a proxy is used. Affects Turnitin.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.9.2
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None
    • Environment:
      Linux
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      Function download_file_content does not correctly handle headers when a proxy is used.
      Displaying variables ($fp, $data, $headers, $results) shows that an extra HTTP header is added by the proxy when the SSL goes via the proxy server (you must setup the web proxy server in the Admin > Server block).

      This affects the installation of Turnitin when performing the setup via the "Site Administration" Block

      • Modules
      • Actitvities
      • Turnitin

      When attempting to parse the XML tags, the following error is encountered:

      Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : Start tag expected, '<' not found in /var/www/html/moodle19/lib/turnitinlib.php on line 178

      Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: HTTP/1.0 200 OK in /var/www/html/moodle19/lib/turnitinlib.php on line 178

      Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /var/www/html/moodle19/lib/turnitinlib.php on line 178

      Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/html/moodle19/lib/turnitinlib.php:178 Stack trace: #0 /var/www/html/moodle19/lib/turnitinlib.php(178): SimpleXMLElement->__construct('HTTP/1.0 200 OK...') #1 /var/www/html/moodle19/lib/turnitinlib.php(220): tii_get_xml('https://api.tur...') #2 /var/www/html/moodle19/admin/turnitin.php(61): tii_post_to_api(Array, 11, 'GET', '', false) #3

      {main}

      thrown in /var/www/html/moodle19/lib/turnitinlib.php on line 178

      Have attached patch to fix the problem which we have tested out.

        Attachments

          Activity

            People

            Assignee:
            danmarsden Dan Marsden
            Reporter:
            ayong Andrew Yong
            Participants:
            Component watchers:
            Jake Dallimore, Jun Pataleta
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: