MDL-39664 allowed mdeploy to follow redirection (http 302) and added some extra logging info

This commit is contained in:
Aparup Banerjee 2013-05-14 11:56:05 +08:00
parent 2d5303cbe7
commit cb97a97794

View File

@ -757,7 +757,7 @@ class worker extends singleton_pattern {
$this->log('Package downloaded into '.$target);
} else {
$this->log('cURL error ' . $this->curlerrno . ' ' . $this->curlerror);
$this->log('Unable to download the file');
$this->log('Unable to download the file from ' . $source . ' into ' . $target);
throw new download_file_exception('Unable to download the package');
}
@ -1059,6 +1059,8 @@ class worker extends singleton_pattern {
// use this CA cert to verify the ZIP provider.
$this->log('Using custom CA certificate '.$cacertfile);
curl_setopt($ch, CURLOPT_CAINFO, $cacertfile);
} else {
$this->log('Warning: '.$cacertfile.' not found');
}
$proxy = $this->input->get_option('proxy', false);
@ -1105,9 +1107,12 @@ class worker extends singleton_pattern {
$this->curlinfo = curl_getinfo($ch);
if (!$result or $this->curlerrno) {
$this->log('Curl Error.');
return false;
} else if (is_array($this->curlinfo) and (empty($this->curlinfo['http_code']) or $this->curlinfo['http_code'] != 200)) {
} else if (is_array($this->curlinfo) && (empty($this->curlinfo['http_code']) or (($this->curlinfo['http_code'] != 200) && $this->curlinfo['http_code'] != 302))) {
$this->log('Curl remote error.');
$this->log(print_r($this->curlinfo,true));
return false;
}