aboutsummaryrefslogtreecommitdiff
path: root/brokenlinks/testdata
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-06-21 15:20:01 +0700
committerShulhan <ms@kilabit.info>2025-06-27 12:19:23 +0700
commit1ca561ed0ecfa59b70a10191ac8e58cde90d126e (patch)
tree80f0c65f7e9321ad92dfc1a53a444226cee4be3d /brokenlinks/testdata
parent8bc8fce1bd80b5a25c452ac5a24b1a1e3f5a4feb (diff)
downloadjarink-1ca561ed0ecfa59b70a10191ac8e58cde90d126e.tar.xz
brokenlinks: implement caching for external URLs
Any succesful fetch on external URLs, will be recorded into jarink cache file, located in user's home cache directory. For example, in Linux it would be `$HOME/.cache/jarink/cache.json`. This help improve the future rescanning on the same or different target URL, minimizing network requests.
Diffstat (limited to 'brokenlinks/testdata')
-rw-r--r--brokenlinks/testdata/exp_cache.json19
-rw-r--r--brokenlinks/testdata/exp_cache.json.license2
-rw-r--r--brokenlinks/testdata/web/index.html5
3 files changed, 26 insertions, 0 deletions
diff --git a/brokenlinks/testdata/exp_cache.json b/brokenlinks/testdata/exp_cache.json
new file mode 100644
index 0000000..563164d
--- /dev/null
+++ b/brokenlinks/testdata/exp_cache.json
@@ -0,0 +1,19 @@
+{
+ "scanned_links": {
+ "http://127.0.0.1:11900": {
+ "url": "http://127.0.0.1:11900",
+ "size": 976,
+ "response_code": 200
+ },
+ "http://127.0.0.1:11900/page2": {
+ "url": "http://127.0.0.1:11900/page2",
+ "size": 410,
+ "response_code": 200
+ },
+ "https://127.0.0.1:11838": {
+ "url": "https://127.0.0.1:11838",
+ "size": 976,
+ "response_code": 200
+ }
+ }
+}
diff --git a/brokenlinks/testdata/exp_cache.json.license b/brokenlinks/testdata/exp_cache.json.license
new file mode 100644
index 0000000..22616a9
--- /dev/null
+++ b/brokenlinks/testdata/exp_cache.json.license
@@ -0,0 +1,2 @@
+SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
+SPDX-License-Identifier: GPL-3.0-only
diff --git a/brokenlinks/testdata/web/index.html b/brokenlinks/testdata/web/index.html
index 7b9101c..596d374 100644
--- a/brokenlinks/testdata/web/index.html
+++ b/brokenlinks/testdata/web/index.html
@@ -10,11 +10,16 @@ SPDX-License-Identifier: GPL-3.0-only
<img width="200" src="" />
<a href="/page2">Page 2</a>
<a href="/broken.html">Broken HTML</a>
+
+ <!-- External link -->
<a href="http://127.0.0.1:11900">External URL</a>
+
<!-- Error when fetching with GET -->
<a href="http:/127.0.0.1:11836">Invalid external URL</a>
+
<!-- Error when parsing URL -->
<a href="http://127.0.0.1:abc">Invalid URL port</a>
+
<!-- Fragment should be skipped and cleaned up -->
<a href="#goto_a">Same with href to "/"</a>
<a href="/page2#goto_a">Same with href to "/page2"</a>