From a6baf778e31514241f45d6884c8152cd882cd9f4 Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 26 Jun 2019 14:22:03 +0100 Subject: [PATCH 1/2] DD-1397 : fix protocol neutral urls --- src/Dennis/Link/Checker/Analyzer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Dennis/Link/Checker/Analyzer.php b/src/Dennis/Link/Checker/Analyzer.php index 3241885..c4b2da8 100644 --- a/src/Dennis/Link/Checker/Analyzer.php +++ b/src/Dennis/Link/Checker/Analyzer.php @@ -194,6 +194,11 @@ public function getInfo($url) { * @throws ResourceFailException */ protected function doInfoRequest($url) { + // If url is protocol neutral, force it to use https. + if (substr( $url, 0, 2 ) === "//") { + $url = ltrim($url, '//'); + $url = 'https://' . $url; + } // Only redirect 301's so cannot use CURLOPT_FOLLOWLOCATION $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); From ba35dd21c7f1993a6ea7da6a97cb76ee53f2eb5d Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 26 Jun 2019 14:24:26 +0100 Subject: [PATCH 2/2] DD-1423 : improve logs --- src/Dennis/Link/Checker/Logger.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Dennis/Link/Checker/Logger.php b/src/Dennis/Link/Checker/Logger.php index 2bc75f6..ae2beee 100644 --- a/src/Dennis/Link/Checker/Logger.php +++ b/src/Dennis/Link/Checker/Logger.php @@ -145,6 +145,7 @@ public function critical($message, array $context = array()) { */ public function error($message, array $context = array()) { $this->addRecord(self::ERROR, (string) $message, $context); + watchdog('dennis_link_checker_seo', $message); } /** @@ -161,6 +162,7 @@ public function warning($message, array $context = array()) { */ public function notice($message, array $context = array()) { $this->addRecord(self::NOTICE, (string) $message, $context); + watchdog('dennis_link_checker_seo', $message); } /** @@ -168,6 +170,7 @@ public function notice($message, array $context = array()) { */ public function info($message, array $context = array()) { $this->addRecord(self::INFO, (string) $message, $context); + watchdog('dennis_link_checker_seo', $message); } /**