Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.9.2
-
Fix Version/s: STABLE backlog
-
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.
Hi Petr,
would you mind checking this out? - I'm not sure if I like the patch - obviously it will work for the reporter, but I'm unsure if it will work for all proxies - is there a better way of checking to make sure there aren't any extra headers?
thanks!