Small fixes

This commit is contained in:
RainLoop Team 2014-09-12 19:25:37 +04:00
parent cdf812ae9a
commit 1d309979b8
3 changed files with 15 additions and 11 deletions

View file

@ -522,11 +522,12 @@ class Http
* @param string $sProxy = ''
* @param string $sProxyAuth = ''
* @param array $aHttpHeaders = array()
* @param bool $bFollowLocation = true
*
* @return bool
*/
public function SaveUrlToFile($sUrl, $rFile, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array())
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array(), $bFollowLocation = true)
{
if (null === $sCustomUserAgent)
{
@ -549,7 +550,7 @@ class Http
CURLOPT_FAILONERROR => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_FOLLOWLOCATION => !!$bFollowLocation,
CURLOPT_MAXREDIRS => 7,
CURLOPT_FILE => $rFile,
CURLOPT_TIMEOUT => (int) $iTimeout
@ -620,14 +621,15 @@ class Http
* @param string $sProxy = ''
* @param string $sProxyAuth = ''
* @param array $aHttpHeaders = array()
* @param bool $bFollowLocation = true
*
* @return string|bool
*/
public function GetUrlAsString($sUrl, $sCustomUserAgent = 'MailSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0,
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array())
$oLogger = null, $iTimeout = 10, $sProxy = '', $sProxyAuth = '', $aHttpHeaders = array(), $bFollowLocation = true)
{
$rMemFile = \MailSo\Base\ResourceRegistry::CreateMemoryResource();
if ($this->SaveUrlToFile($sUrl, $rMemFile, $sCustomUserAgent, $sContentType, $iCode, $oLogger, $iTimeout, $sProxy, $sProxyAuth, $aHttpHeaders) && \is_resource($rMemFile))
if ($this->SaveUrlToFile($sUrl, $rMemFile, $sCustomUserAgent, $sContentType, $iCode, $oLogger, $iTimeout, $sProxy, $sProxyAuth, $aHttpHeaders, $bFollowLocation) && \is_resource($rMemFile))
{
\rewind($rMemFile);
return \stream_get_contents($rMemFile);

View file

@ -2529,7 +2529,9 @@ class Actions
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'status/'.\urlencode($sDomain),
'RainLoop', $sContentType, $iCode, $this->Logger(), 10,
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''));
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
array(), false
);
if (200 !== $iCode)
{
@ -2599,7 +2601,9 @@ class Actions
\sleep(1);
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'activate/'.\urlencode($sDomain).'/'.\urlencode($sKey),
'RainLoop', $sContentType, $iCode, $this->Logger(), 10,
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''));
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
array(), false
);
if (200 !== $iCode)
{