From 1a6d7d93a3b2d68b7d25f2106e017daa671ce939 Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Wed, 11 May 2016 16:53:44 +0800
Subject: [PATCH] #1489132 - fix http/https caused permission restrictions deny
 issue.

---
 linkchecker.module | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/linkchecker.module b/linkchecker.module
index cb3a8ac..8f3c729 100644
--- a/linkchecker.module
+++ b/linkchecker.module
@@ -258,7 +258,22 @@ function _linkchecker_link_node_ids($link, $node_author_account = NULL) {
     if (!isset($fields_with_node_links[$node->nid])) {
       $fields_with_node_links[$node->nid] = _linkchecker_extract_node_links($node, TRUE);
     }
-    if (empty($fields_with_node_links[$node->nid][$link->url])) {
+
+    // When the link is extracted from http/https which is different from
+    // current protocal will have permission restrictions deny message.
+    // See also in issue #1489132.
+    //
+    // Remove protocal and test for both http and https.
+    if ($protocal_relative_url = preg_replace('/\\s*[^:]+:/', '', $link->url)) {
+      if (isset($fields_with_node_links[$node->nid]['http:' . $protocal_relative_url])) {
+        $protocal_relative_url = 'http:' . $protocal_relative_url;
+      }
+      else {
+        $protocal_relative_url = 'https:' . $protocal_relative_url;
+      }
+    }
+
+    if (empty($fields_with_node_links[$node->nid][$protocal_relative_url])) {
       continue;
     }
     // If the link appears in fields and a field access module is being used,
-- 
2.7.4

