From e0eefb43ba4c4181317966fd52f240a63d56cadb Mon Sep 17 00:00:00 2001 From: Web Addicto Date: Sat, 6 May 2017 13:31:18 +0200 Subject: [PATCH 1/2] Return "text/plain" content without replacing URLs --- src/Plugin/ProxifyPlugin.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Plugin/ProxifyPlugin.php b/src/Plugin/ProxifyPlugin.php index a5ef491..94a3cc7 100644 --- a/src/Plugin/ProxifyPlugin.php +++ b/src/Plugin/ProxifyPlugin.php @@ -163,6 +163,12 @@ public function onCompleted(ProxyEvent $event){ } } + // Return plain text content without replacing URLs + if(stripos($content_type, "text/plain") === 0){ + $response->setContent($str); + return; + } + // add html.no-js // let's remove all frames?? does not protect against the frames created dynamically via javascript @@ -182,4 +188,4 @@ public function onCompleted(ProxyEvent $event){ } -?> \ No newline at end of file +?> From b6b8695c6864bb1c731b1da643e1eef9fe479bd6 Mon Sep 17 00:00:00 2001 From: Web Addicto Date: Thu, 11 May 2017 22:46:52 +0200 Subject: [PATCH 2/2] Moved check for text/plain below "/ DO NOT do any proxification" --- src/Plugin/ProxifyPlugin.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Plugin/ProxifyPlugin.php b/src/Plugin/ProxifyPlugin.php index 94a3cc7..0d29cdf 100644 --- a/src/Plugin/ProxifyPlugin.php +++ b/src/Plugin/ProxifyPlugin.php @@ -146,8 +146,8 @@ public function onCompleted(ProxyEvent $event){ $str = $response->getContent(); - // DO NOT do any proxification on .js files - if($content_type == 'text/javascript' || $content_type == 'application/javascript' || $content_type == 'application/x-javascript'){ + // DO NOT do any proxification on .js files and text/plain content type + if($content_type == 'text/javascript' || $content_type == 'application/javascript' || $content_type == 'application/x-javascript' || $content_type == 'text/plain'){ return; } @@ -163,12 +163,6 @@ public function onCompleted(ProxyEvent $event){ } } - // Return plain text content without replacing URLs - if(stripos($content_type, "text/plain") === 0){ - $response->setContent($str); - return; - } - // add html.no-js // let's remove all frames?? does not protect against the frames created dynamically via javascript