Permalink
Browse files

MDL-39664 allowed mdeploy to follow redirection (http 302) and added …

…some extra logging info
  • Loading branch information...
1 parent 2d5303c commit cb97a97794ed448117a3268300053af886420f1e @nebgor nebgor committed May 14, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 mdeploy.php
View
@@ -757,7 +757,7 @@ public function execute() {
$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 @@ protected function download_file($source, $target) {
// 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 @@ protected function download_file($source, $target) {
$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;
}

0 comments on commit cb97a97

Please sign in to comment.