From be66ec2612e7d7369113dc14cefe792b43fa393c Mon Sep 17 00:00:00 2001 From: Henning Ritter Date: Sun, 28 Mar 2021 11:44:24 +0200 Subject: [PATCH 1/2] added static property CURLOPT_RETURNTRANSFER --- Proxy.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Proxy.php b/Proxy.php index c5b2eef..5041f30 100644 --- a/Proxy.php +++ b/Proxy.php @@ -59,6 +59,12 @@ class Proxy */ public static $DEBUG = false; + /** + * When set to false the fetched result is echoed immediately instead of waiting for the fetch to complete first + * @var bool + */ + public static $CURLOPT_RETURNTRANSFER = true; + /** * Target URL is set via Proxy-Target-URL header. For debugging purposes you might set it directly here. * This value overrides any value specified in Proxy-Target-URL header. @@ -320,7 +326,7 @@ protected static function createRequest($targetURL) curl_setopt_array($request, [ CURLOPT_FOLLOWLOCATION => true, CURLOPT_HEADER => true, - CURLOPT_RETURNTRANSFER => true, + CURLOPT_RETURNTRANSFER => static::$CURLOPT_RETURNTRANSFER, CURLINFO_HEADER_OUT => true, CURLOPT_HTTPHEADER => $headers ]); From b0bfb40612de6d9218a4729bff3cfa8890c38ed4 Mon Sep 17 00:00:00 2001 From: Henning Ritter Date: Sun, 28 Mar 2021 12:31:37 +0200 Subject: [PATCH 2/2] added static property CURLOPT_HEADER --- Proxy.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Proxy.php b/Proxy.php index 5041f30..5691aea 100644 --- a/Proxy.php +++ b/Proxy.php @@ -59,6 +59,12 @@ class Proxy */ public static $DEBUG = false; + /** + * When set to false the fetched header is not included in the result + * @var bool + */ + public static $CURLOPT_HEADER = true; + /** * When set to false the fetched result is echoed immediately instead of waiting for the fetch to complete first * @var bool @@ -325,7 +331,7 @@ protected static function createRequest($targetURL) curl_setopt_array($request, [ CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HEADER => true, + CURLOPT_HEADER => static::$CURLOPT_HEADER, CURLOPT_RETURNTRANSFER => static::$CURLOPT_RETURNTRANSFER, CURLINFO_HEADER_OUT => true, CURLOPT_HTTPHEADER => $headers