Page MenuHomeIn-Portal Phabricator

D278.id1082.diff
No OneTemporary

File Metadata

Created
Wed, Feb 26, 9:00 AM

D278.id1082.diff

Index: core/units/helpers/curl_helper.php
===================================================================
--- core/units/helpers/curl_helper.php
+++ core/units/helpers/curl_helper.php
@@ -148,6 +148,11 @@
parent::__construct();
$this->debugMode = kUtil::constOn('DBG_CURL');
+
+ // Happens, when cURL binding version is below v7.18.2.
+ if ( !defined('CURLINFO_REDIRECT_URL') ) {
+ define('CURLINFO_REDIRECT_URL', 1048607);
+ }
}
/**
@@ -494,6 +499,20 @@
return $this->lastRedirectCount;
}
+ if ( $info_type == CURLINFO_REDIRECT_URL ) {
+ if ( $this->followLocation ) {
+ return '';
+ }
+
+ foreach ( $this->responseHeaders as $header ) {
+ if ( preg_match('/^location: (.*)$/i', $header, $matches) ) {
+ return $matches[1];
+ }
+ }
+
+ return '';
+ }
+
return curl_getinfo($this->connectionID, $info_type);
}
@@ -570,4 +589,4 @@
return ($this->lastHTTPCode == 200) || ($this->lastHTTPCode >= 300 && $this->lastHTTPCode < 310);
}
- }
\ No newline at end of file
+ }

Event Timeline