mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-07 08:36:32 +02:00
11
CHttpGet.php
11
CHttpGet.php
@@ -62,7 +62,14 @@ class CHttpGet
|
|||||||
*/
|
*/
|
||||||
public function parseHeader()
|
public function parseHeader()
|
||||||
{
|
{
|
||||||
$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
|
//$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
|
||||||
|
|
||||||
|
$rawHeaders = rtrim($this->response['headerRaw'], "\r\n");
|
||||||
|
# Handle multiple responses e.g. with redirections (proxies too)
|
||||||
|
$headerGroups = explode("\r\n\r\n", $rawHeaders);
|
||||||
|
# We're only interested in the last one
|
||||||
|
$header = explode("\r\n", end($headerGroups));
|
||||||
|
|
||||||
$output = array();
|
$output = array();
|
||||||
|
|
||||||
if ('HTTP' === substr($header[0], 0, 4)) {
|
if ('HTTP' === substr($header[0], 0, 4)) {
|
||||||
@@ -99,6 +106,8 @@ class CHttpGet
|
|||||||
CURLINFO_HEADER_OUT => $debug,
|
CURLINFO_HEADER_OUT => $debug,
|
||||||
CURLOPT_CONNECTTIMEOUT => 5,
|
CURLOPT_CONNECTTIMEOUT => 5,
|
||||||
CURLOPT_TIMEOUT => 5,
|
CURLOPT_TIMEOUT => 5,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_MAXREDIRS => 2,
|
||||||
);
|
);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
@@ -8,6 +8,7 @@ Revision history
|
|||||||
v0.7.0.x (latest)
|
v0.7.0.x (latest)
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
* Support redirections for remote images, fix #87, fix #90.
|
||||||
* Improving usage of Travis and Scrutinizer.
|
* Improving usage of Travis and Scrutinizer.
|
||||||
* Naming cache-file using md5 for remote images, fix #86.
|
* Naming cache-file using md5 for remote images, fix #86.
|
||||||
* Loading images without depending on filename extension, fix #85.
|
* Loading images without depending on filename extension, fix #85.
|
||||||
|
@@ -99,7 +99,14 @@ class CHttpGet
|
|||||||
*/
|
*/
|
||||||
public function parseHeader()
|
public function parseHeader()
|
||||||
{
|
{
|
||||||
$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
|
//$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
|
||||||
|
|
||||||
|
$rawHeaders = rtrim($this->response['headerRaw'], "\r\n");
|
||||||
|
# Handle multiple responses e.g. with redirections (proxies too)
|
||||||
|
$headerGroups = explode("\r\n\r\n", $rawHeaders);
|
||||||
|
# We're only interested in the last one
|
||||||
|
$header = explode("\r\n", end($headerGroups));
|
||||||
|
|
||||||
$output = array();
|
$output = array();
|
||||||
|
|
||||||
if ('HTTP' === substr($header[0], 0, 4)) {
|
if ('HTTP' === substr($header[0], 0, 4)) {
|
||||||
@@ -136,6 +143,8 @@ class CHttpGet
|
|||||||
CURLINFO_HEADER_OUT => $debug,
|
CURLINFO_HEADER_OUT => $debug,
|
||||||
CURLOPT_CONNECTTIMEOUT => 5,
|
CURLOPT_CONNECTTIMEOUT => 5,
|
||||||
CURLOPT_TIMEOUT => 5,
|
CURLOPT_TIMEOUT => 5,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_MAXREDIRS => 2,
|
||||||
);
|
);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
@@ -99,7 +99,14 @@ class CHttpGet
|
|||||||
*/
|
*/
|
||||||
public function parseHeader()
|
public function parseHeader()
|
||||||
{
|
{
|
||||||
$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
|
//$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
|
||||||
|
|
||||||
|
$rawHeaders = rtrim($this->response['headerRaw'], "\r\n");
|
||||||
|
# Handle multiple responses e.g. with redirections (proxies too)
|
||||||
|
$headerGroups = explode("\r\n\r\n", $rawHeaders);
|
||||||
|
# We're only interested in the last one
|
||||||
|
$header = explode("\r\n", end($headerGroups));
|
||||||
|
|
||||||
$output = array();
|
$output = array();
|
||||||
|
|
||||||
if ('HTTP' === substr($header[0], 0, 4)) {
|
if ('HTTP' === substr($header[0], 0, 4)) {
|
||||||
@@ -136,6 +143,8 @@ class CHttpGet
|
|||||||
CURLINFO_HEADER_OUT => $debug,
|
CURLINFO_HEADER_OUT => $debug,
|
||||||
CURLOPT_CONNECTTIMEOUT => 5,
|
CURLOPT_CONNECTTIMEOUT => 5,
|
||||||
CURLOPT_TIMEOUT => 5,
|
CURLOPT_TIMEOUT => 5,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_MAXREDIRS => 2,
|
||||||
);
|
);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
@@ -99,7 +99,14 @@ class CHttpGet
|
|||||||
*/
|
*/
|
||||||
public function parseHeader()
|
public function parseHeader()
|
||||||
{
|
{
|
||||||
$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
|
//$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
|
||||||
|
|
||||||
|
$rawHeaders = rtrim($this->response['headerRaw'], "\r\n");
|
||||||
|
# Handle multiple responses e.g. with redirections (proxies too)
|
||||||
|
$headerGroups = explode("\r\n\r\n", $rawHeaders);
|
||||||
|
# We're only interested in the last one
|
||||||
|
$header = explode("\r\n", end($headerGroups));
|
||||||
|
|
||||||
$output = array();
|
$output = array();
|
||||||
|
|
||||||
if ('HTTP' === substr($header[0], 0, 4)) {
|
if ('HTTP' === substr($header[0], 0, 4)) {
|
||||||
@@ -136,6 +143,8 @@ class CHttpGet
|
|||||||
CURLINFO_HEADER_OUT => $debug,
|
CURLINFO_HEADER_OUT => $debug,
|
||||||
CURLOPT_CONNECTTIMEOUT => 5,
|
CURLOPT_CONNECTTIMEOUT => 5,
|
||||||
CURLOPT_TIMEOUT => 5,
|
CURLOPT_TIMEOUT => 5,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_MAXREDIRS => 2,
|
||||||
);
|
);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
Reference in New Issue
Block a user