- Timestamp:
- Jun 25, 2017 7:12:54 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r606 r607 1467 1467 curl_setopt($ch, CURLOPT_BUFFERSIZE, 128); // Frequent progress function calls. 1468 1468 curl_setopt($ch, CURLOPT_NOPROGRESS, false); // Required to use CURLOPT_PROGRESSFUNCTION. 1469 curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($ch, $dltot, $dlcur, $ultot, $ulcur){ 1470 // Return a non-zero value to abort the transfer. In which case, the transfer will set a CURLE_ABORTED_BY_CALLBACK error 1471 // 10KB should be enough to catch a few 302 redirect headers and get to the actual content. 1472 return ($dlcur > 10*1024) ? 1 : 0; 1473 }); 1474 1469 // Function arguments for CURLOPT_PROGRESSFUNCTION changed with php 5.5.0. 1470 if (version_compare(PHP_VERSION, '5.5.0', '>=')) { 1471 curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($ch, $dltot, $dlcur, $ultot, $ulcur){ 1472 // Return a non-zero value to abort the transfer. In which case, the transfer will set a CURLE_ABORTED_BY_CALLBACK error 1473 // 10KB should be enough to catch a few 302 redirect headers and get to the actual content. 1474 return ($dlcur > 10*1024) ? 1 : 0; 1475 }); 1476 } else { 1477 curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($dltot, $dlcur, $ultot, $ulcur){ 1478 // Return a non-zero value to abort the transfer. In which case, the transfer will set a CURLE_ABORTED_BY_CALLBACK error 1479 // 10KB should be enough to catch a few 302 redirect headers and get to the actual content. 1480 return ($dlcur > 10*1024) ? 1 : 0; 1481 }); 1482 } 1475 1483 curl_exec($ch); 1476 1484 $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
Note: See TracChangeset
for help on using the changeset viewer.