]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 11 Sep 2023 18:59:11 +0000 (20:59 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 11 Sep 2023 18:59:11 +0000 (20:59 +0200)
- some url.netloc may contain port number which needs to be split off

fba/commands.py
fba/http/federation.py
fba/http/nodeinfo.py

index 52401ffcfaca79da14f5c62a2aab5c264e3bfc11..9089cd3e34d1dcc7ec0dff3f14c7e111fe24dd39 100644 (file)
@@ -770,13 +770,15 @@ def fetch_fba_rss(args: argparse.Namespace) -> int:
     locking.acquire()
 
     components = urlparse(args.feed)
+    domain = components.netloc.lower().split(":")[0]
 
-    if sources.is_recent(components.netloc):
-        logger.info("API from components.netloc='%s' has recently being accessed - EXIT!", components.netloc)
+    logger.debug("domain='%s'", domain)
+    if sources.is_recent(domain):
+        logger.info("API from domain='%s' has recently being accessed - EXIT!", domain)
         return 0
     else:
-        logger.debug("components.netloc='%s' has not been recently used, marking ...", components.netloc)
-        sources.update(components.netloc)
+        logger.debug("domain='%s' has not been recently used, marking ...", domain)
+        sources.update(domain)
 
     logger.info("Fetch FBA-specific RSS args.feed='%s' ...", args.feed)
     response = utils.fetch_url(args.feed, network.web_headers, (config.get("connection_timeout"), config.get("read_timeout")))
@@ -2004,7 +2006,7 @@ def fetch_relays(args: argparse.Namespace) -> int:
                     continue
 
                 components = urlparse(link["href"])
-                domain = components.netloc.lower()
+                domain = components.netloc.lower().split(":")[0]
 
                 logger.debug("domain='%s' - BEFORE!", domain)
                 domain = tidyup.domain(domain) if domain != None and domain != "" else None
index 49f5c52020a1b154864d39d5b49637f994cb67d6..eeed806f729ff9e55c728e1eb7fadeeee12f08b2 100644 (file)
@@ -317,11 +317,12 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
         logger.warning("domain='%s' doesn't match response.url='%s', maybe redirect to other domain?", domain, response.url)
 
         components = urlparse(response.url)
+        domain2 = components.netloc.lower().split(":")[0]
 
-        logger.debug("components[]='%s'", type(components))
-        if not instances.is_registered(components.netloc):
+        logger.debug("domain2='%s'", domain2)
+        if not instances.is_registered(domain2):
             logger.info("components.netloc='%s' is not registered, adding ...", components.netloc)
-            fetch_instances(components.netloc, domain, None, "fetch_generator")
+            fetch_instances(domain2, domain, None, "fetch_generator")
 
         message = f"Redirect from domain='{domain}' to response.url='{response.url}'"
         instances.set_last_error(domain, message)
index 274575ef4843c32481438734e4aefc1b2594b41c..e18daff75e513381a5561be327e822ef79f8e353 100644 (file)
@@ -210,9 +210,10 @@ def fetch_wellknown_nodeinfo(domain: str) -> dict:
                     url = f"{components.scheme}://{domain}{components.path}"
                     components = urlparse(url)
 
-                logger.debug("components.netloc[]='%s'", type(components.netloc))
-                if not domain_helper.is_wanted(components.netloc):
-                    logger.debug("components.netloc='%s' is not wanted - SKIPPED!", components.netloc)
+                domain2 = components.netloc.lower().split(":")[0]
+                logger.debug("domain2='%s'", domain2)
+                if not domain_helper.is_wanted(domain2):
+                    logger.debug("domain2='%s' is not wanted - SKIPPED!", domain2)
                     continue
 
                 logger.debug("Fetching nodeinfo from url='%s' ...", url)