ruby-link-checker 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/LICENSE.md +0 -0
- data/README.md +227 -19
- data/UPGRADING.md +46 -0
- data/lib/ruby-link-checker/async/http/checker.rb +46 -7
- data/lib/ruby-link-checker/async/http/config.rb +4 -0
- data/lib/ruby-link-checker/async/http/result.rb +5 -1
- data/lib/ruby-link-checker/async/http.rb +0 -0
- data/lib/ruby-link-checker/cache.rb +170 -0
- data/lib/ruby-link-checker/callbacks.rb +0 -0
- data/lib/ruby-link-checker/checker.rb +200 -5
- data/lib/ruby-link-checker/config.rb +141 -0
- data/lib/ruby-link-checker/errors/base_error.rb +0 -0
- data/lib/ruby-link-checker/errors/connection_error.rb +23 -0
- data/lib/ruby-link-checker/errors/redirect_limit_error.rb +15 -0
- data/lib/ruby-link-checker/errors/redirect_loop_error.rb +0 -0
- data/lib/ruby-link-checker/errors.rb +2 -0
- data/lib/ruby-link-checker/logger.rb +0 -0
- data/lib/ruby-link-checker/net/http/checker.rb +5 -3
- data/lib/ruby-link-checker/net/http/config.rb +0 -0
- data/lib/ruby-link-checker/net/http/result.rb +5 -1
- data/lib/ruby-link-checker/net/http.rb +0 -0
- data/lib/ruby-link-checker/redirect.rb +11 -0
- data/lib/ruby-link-checker/result.rb +120 -0
- data/lib/ruby-link-checker/task.rb +2 -0
- data/lib/ruby-link-checker/tasks.rb +53 -7
- data/lib/ruby-link-checker/typhoeus/hydra/checker.rb +79 -9
- data/lib/ruby-link-checker/typhoeus/hydra/config.rb +0 -0
- data/lib/ruby-link-checker/typhoeus/hydra/result.rb +5 -1
- data/lib/ruby-link-checker/typhoeus/hydra.rb +0 -0
- data/lib/ruby-link-checker/version.rb +1 -1
- data/lib/ruby-link-checker.rb +2 -0
- data/lib/ruby_link_checker.rb +0 -0
- metadata +26 -72
- data/CONTRIBUTING.md +0 -125
- data/Dangerfile +0 -6
- data/Gemfile +0 -24
- data/Gemfile.lock +0 -334
- data/RELEASING.md +0 -60
- data/Rakefile +0 -18
- data/benchmarks/check.rb +0 -38
- data/benchmarks/data/opensearch.org/links.txt +0 -4270
- data/benchmarks/data/opensearch.org/small.txt +0 -100
- data/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coverage/assets/0.13.2/application.css +0 -1
- data/coverage/assets/0.13.2/application.js +0 -7
- data/coverage/assets/0.13.2/colorbox/border.png +0 -0
- data/coverage/assets/0.13.2/colorbox/controls.png +0 -0
- data/coverage/assets/0.13.2/colorbox/loading.gif +0 -0
- data/coverage/assets/0.13.2/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.13.2/favicon_green.png +0 -0
- data/coverage/assets/0.13.2/favicon_red.png +0 -0
- data/coverage/assets/0.13.2/favicon_yellow.png +0 -0
- data/coverage/assets/0.13.2/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.13.2/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.13.2/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.13.2/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.13.2/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.13.2/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.13.2/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.13.2/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.13.2/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.13.2/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.13.2/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.13.2/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.13.2/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/assets/0.13.2/loading.gif +0 -0
- data/coverage/assets/0.13.2/magnify.png +0 -0
- data/coverage/index.html +0 -10746
- data/ruby-link-checker.gemspec +0 -22
- data/spec/fixtures/200.yml +0 -65
- data/spec/fixtures/301_200.yml +0 -102
- data/spec/fixtures/301_301.yml +0 -114
- data/spec/fixtures/301_400_301_200.yml +0 -185
- data/spec/fixtures/301_403.yml +0 -78
- data/spec/fixtures/308_429.yml +0 -108
- data/spec/fixtures/404.yml +0 -57
- data/spec/fixtures/404_200.yml +0 -89
- data/spec/fixtures/404_404.yml +0 -81
- data/spec/fixtures/429_200.yml +0 -135
- data/spec/fixtures/429_429_200.yml +0 -201
- data/spec/ruby-link-checker/async/http/checker_spec.rb +0 -99
- data/spec/ruby-link-checker/callbacks_spec.rb +0 -76
- data/spec/ruby-link-checker/checker_spec.rb +0 -10
- data/spec/ruby-link-checker/config_spec.rb +0 -39
- data/spec/ruby-link-checker/errors/redirect_loop_error_spec.rb +0 -18
- data/spec/ruby-link-checker/net/http/checker_spec.rb +0 -78
- data/spec/ruby-link-checker/result_error_spec.rb +0 -17
- data/spec/ruby-link-checker/result_spec.rb +0 -41
- data/spec/ruby-link-checker/task_spec.rb +0 -20
- data/spec/ruby-link-checker/tasks_spec.rb +0 -47
- data/spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb +0 -93
- data/spec/ruby-link-checker/version_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -19
- data/spec/support/config.rb +0 -8
- data/spec/support/link_checker.rb +0 -369
- data/spec/support/vcr.rb +0 -13
- data/spec/support/with_result.rb +0 -15
- data/spec/support/with_url.rb +0 -14
data/spec/fixtures/404.yml
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: get
|
|
5
|
-
uri: https://www.example.org/
|
|
6
|
-
body:
|
|
7
|
-
encoding: US-ASCII
|
|
8
|
-
string: ''
|
|
9
|
-
headers:
|
|
10
|
-
Accept-Encoding:
|
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
12
|
-
Accept:
|
|
13
|
-
- "*/*"
|
|
14
|
-
User-Agent:
|
|
15
|
-
- Ruby
|
|
16
|
-
Host:
|
|
17
|
-
- www.example.org
|
|
18
|
-
response:
|
|
19
|
-
status:
|
|
20
|
-
code: 404
|
|
21
|
-
message: Not Found
|
|
22
|
-
headers:
|
|
23
|
-
Cache-Control:
|
|
24
|
-
- max-age=604800
|
|
25
|
-
Content-Type:
|
|
26
|
-
- text/html; charset=UTF-8
|
|
27
|
-
Date:
|
|
28
|
-
- Wed, 29 Mar 2023 17:44:18 GMT
|
|
29
|
-
Expires:
|
|
30
|
-
- Wed, 05 Apr 2023 17:44:18 GMT
|
|
31
|
-
Server:
|
|
32
|
-
- Example.org
|
|
33
|
-
Vary:
|
|
34
|
-
- Accept-Encoding
|
|
35
|
-
Content-Length:
|
|
36
|
-
- '648'
|
|
37
|
-
body:
|
|
38
|
-
encoding: UTF-8
|
|
39
|
-
string: "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
|
40
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
|
41
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
|
42
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
|
43
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system,
|
|
44
|
-
system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\",
|
|
45
|
-
Helvetica, Arial, sans-serif;\n \n }\n div {\n width:
|
|
46
|
-
600px;\n margin: 5em auto;\n padding: 2em;\n background-color:
|
|
47
|
-
#fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px
|
|
48
|
-
rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n
|
|
49
|
-
\ text-decoration: none;\n }\n @media (max-width: 700px) {\n div
|
|
50
|
-
{\n margin: 0 auto;\n width: auto;\n }\n }\n
|
|
51
|
-
\ </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
|
52
|
-
\ <p>This domain is for use in illustrative examples in documents. You may
|
|
53
|
-
use this\n domain in literature without prior coordination or asking for
|
|
54
|
-
permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More
|
|
55
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
|
56
|
-
recorded_at: Wed, 29 Mar 2023 17:44:18 GMT
|
|
57
|
-
recorded_with: VCR 6.1.0
|
data/spec/fixtures/404_200.yml
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: head
|
|
5
|
-
uri: https://www.example.org
|
|
6
|
-
body:
|
|
7
|
-
encoding: US-ASCII
|
|
8
|
-
string: ''
|
|
9
|
-
headers:
|
|
10
|
-
Accept-Encoding:
|
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
12
|
-
Accept:
|
|
13
|
-
- "*/*"
|
|
14
|
-
User-Agent:
|
|
15
|
-
- Ruby
|
|
16
|
-
Host:
|
|
17
|
-
- www.example.org
|
|
18
|
-
response:
|
|
19
|
-
status:
|
|
20
|
-
code: 404
|
|
21
|
-
message: Not Found
|
|
22
|
-
headers:
|
|
23
|
-
Cache-Control:
|
|
24
|
-
- private
|
|
25
|
-
Transfer-Encoding:
|
|
26
|
-
- chunked
|
|
27
|
-
Content-Type:
|
|
28
|
-
- text/html; charset=utf-8
|
|
29
|
-
Access-Control-Expose-Headers:
|
|
30
|
-
- Request-Context
|
|
31
|
-
Date:
|
|
32
|
-
- Wed, 29 Mar 2023 17:48:06 GMT
|
|
33
|
-
body:
|
|
34
|
-
encoding: UTF-8
|
|
35
|
-
string: ''
|
|
36
|
-
recorded_at: Wed, 29 Mar 2023 17:48:06 GMT
|
|
37
|
-
- request:
|
|
38
|
-
method: get
|
|
39
|
-
uri: https://www.example.org/
|
|
40
|
-
body:
|
|
41
|
-
encoding: US-ASCII
|
|
42
|
-
string: ''
|
|
43
|
-
headers:
|
|
44
|
-
Accept-Encoding:
|
|
45
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
46
|
-
Accept:
|
|
47
|
-
- "*/*"
|
|
48
|
-
User-Agent:
|
|
49
|
-
- Ruby
|
|
50
|
-
Host:
|
|
51
|
-
- www.example.org
|
|
52
|
-
response:
|
|
53
|
-
status:
|
|
54
|
-
code: 200
|
|
55
|
-
message: OK
|
|
56
|
-
headers:
|
|
57
|
-
Cache-Control:
|
|
58
|
-
- private
|
|
59
|
-
Transfer-Encoding:
|
|
60
|
-
- chunked
|
|
61
|
-
Content-Type:
|
|
62
|
-
- text/html; charset=utf-8
|
|
63
|
-
Vary:
|
|
64
|
-
- Accept-Encoding
|
|
65
|
-
Access-Control-Expose-Headers:
|
|
66
|
-
- Request-Context
|
|
67
|
-
Date:
|
|
68
|
-
- Wed, 29 Mar 2023 17:48:06 GMT
|
|
69
|
-
body:
|
|
70
|
-
encoding: UTF-8
|
|
71
|
-
string: "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
|
72
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
|
73
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
|
74
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
|
75
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system,
|
|
76
|
-
system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\",
|
|
77
|
-
Helvetica, Arial, sans-serif;\n \n }\n div {\n width:
|
|
78
|
-
600px;\n margin: 5em auto;\n padding: 2em;\n background-color:
|
|
79
|
-
#fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px
|
|
80
|
-
rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n
|
|
81
|
-
\ text-decoration: none;\n }\n @media (max-width: 700px) {\n div
|
|
82
|
-
{\n margin: 0 auto;\n width: auto;\n }\n }\n
|
|
83
|
-
\ </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
|
84
|
-
\ <p>This domain is for use in illustrative examples in documents. You may
|
|
85
|
-
use this\n domain in literature without prior coordination or asking for
|
|
86
|
-
permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More
|
|
87
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
|
88
|
-
recorded_at: Wed, 29 Mar 2023 17:48:07 GMT
|
|
89
|
-
recorded_with: VCR 6.1.0
|
data/spec/fixtures/404_404.yml
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: head
|
|
5
|
-
uri: https://www.example.org
|
|
6
|
-
body:
|
|
7
|
-
encoding: US-ASCII
|
|
8
|
-
string: ''
|
|
9
|
-
headers:
|
|
10
|
-
Accept-Encoding:
|
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
12
|
-
Accept:
|
|
13
|
-
- "*/*"
|
|
14
|
-
User-Agent:
|
|
15
|
-
- Ruby
|
|
16
|
-
Host:
|
|
17
|
-
- www.example.org
|
|
18
|
-
response:
|
|
19
|
-
status:
|
|
20
|
-
code: 404
|
|
21
|
-
message: Not Found
|
|
22
|
-
headers:
|
|
23
|
-
Transfer-Encoding:
|
|
24
|
-
- chunked
|
|
25
|
-
Content-Type:
|
|
26
|
-
- text/html; charset=utf-8
|
|
27
|
-
Date:
|
|
28
|
-
- Wed, 29 Mar 2023 17:48:07 GMT
|
|
29
|
-
body:
|
|
30
|
-
encoding: UTF-8
|
|
31
|
-
string: ''
|
|
32
|
-
recorded_at: Wed, 29 Mar 2023 17:48:07 GMT
|
|
33
|
-
- request:
|
|
34
|
-
method: get
|
|
35
|
-
uri: https://www.example.org/
|
|
36
|
-
body:
|
|
37
|
-
encoding: US-ASCII
|
|
38
|
-
string: ''
|
|
39
|
-
headers:
|
|
40
|
-
Accept-Encoding:
|
|
41
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
42
|
-
Accept:
|
|
43
|
-
- "*/*"
|
|
44
|
-
User-Agent:
|
|
45
|
-
- Ruby
|
|
46
|
-
Host:
|
|
47
|
-
- www.example.org
|
|
48
|
-
response:
|
|
49
|
-
status:
|
|
50
|
-
code: 404
|
|
51
|
-
message: Not Found
|
|
52
|
-
headers:
|
|
53
|
-
Cache-Control:
|
|
54
|
-
- private
|
|
55
|
-
Transfer-Encoding:
|
|
56
|
-
- chunked
|
|
57
|
-
Content-Type:
|
|
58
|
-
- text/html; charset=utf-8
|
|
59
|
-
Date:
|
|
60
|
-
- Wed, 29 Mar 2023 17:48:07 GMT
|
|
61
|
-
body:
|
|
62
|
-
encoding: UTF-8
|
|
63
|
-
string: "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
|
64
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
|
65
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
|
66
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
|
67
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system,
|
|
68
|
-
system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\",
|
|
69
|
-
Helvetica, Arial, sans-serif;\n \n }\n div {\n width:
|
|
70
|
-
600px;\n margin: 5em auto;\n padding: 2em;\n background-color:
|
|
71
|
-
#fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px
|
|
72
|
-
rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n
|
|
73
|
-
\ text-decoration: none;\n }\n @media (max-width: 700px) {\n div
|
|
74
|
-
{\n margin: 0 auto;\n width: auto;\n }\n }\n
|
|
75
|
-
\ </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
|
76
|
-
\ <p>This domain is for use in illustrative examples in documents. You may
|
|
77
|
-
use this\n domain in literature without prior coordination or asking for
|
|
78
|
-
permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More
|
|
79
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
|
80
|
-
recorded_at: Wed, 29 Mar 2023 17:48:07 GMT
|
|
81
|
-
recorded_with: VCR 6.1.0
|
data/spec/fixtures/429_200.yml
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: get
|
|
5
|
-
uri: https://www.example.org/
|
|
6
|
-
body:
|
|
7
|
-
encoding: US-ASCII
|
|
8
|
-
string: ''
|
|
9
|
-
headers:
|
|
10
|
-
Index:
|
|
11
|
-
- 1
|
|
12
|
-
Accept-Encoding:
|
|
13
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
14
|
-
Accept:
|
|
15
|
-
- "*/*"
|
|
16
|
-
User-Agent:
|
|
17
|
-
- Ruby Link Checker/0.1.0
|
|
18
|
-
Host:
|
|
19
|
-
- www.example.org
|
|
20
|
-
response:
|
|
21
|
-
status:
|
|
22
|
-
code: 429
|
|
23
|
-
message: OK
|
|
24
|
-
headers:
|
|
25
|
-
Accept-Ranges:
|
|
26
|
-
- bytes
|
|
27
|
-
Age:
|
|
28
|
-
- '100798'
|
|
29
|
-
Cache-Control:
|
|
30
|
-
- max-age=604800
|
|
31
|
-
Content-Type:
|
|
32
|
-
- text/html; charset=UTF-8
|
|
33
|
-
Date:
|
|
34
|
-
- Sat, 01 Apr 2023 12:57:11 GMT
|
|
35
|
-
Etag:
|
|
36
|
-
- '"3147526947"'
|
|
37
|
-
Expires:
|
|
38
|
-
- Sat, 08 Apr 2023 12:57:11 GMT
|
|
39
|
-
Last-Modified:
|
|
40
|
-
- Thu, 17 Oct 2019 07:18:26 GMT
|
|
41
|
-
Server:
|
|
42
|
-
- ECS (nyb/1D2E)
|
|
43
|
-
Vary:
|
|
44
|
-
- Accept-Encoding
|
|
45
|
-
X-Cache:
|
|
46
|
-
- HIT
|
|
47
|
-
Content-Length:
|
|
48
|
-
- '648'
|
|
49
|
-
body:
|
|
50
|
-
encoding: UTF-8
|
|
51
|
-
string: "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
|
52
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
|
53
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
|
54
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
|
55
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system,
|
|
56
|
-
system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\",
|
|
57
|
-
Helvetica, Arial, sans-serif;\n \n }\n div {\n width:
|
|
58
|
-
600px;\n margin: 5em auto;\n padding: 2em;\n background-color:
|
|
59
|
-
#fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px
|
|
60
|
-
rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n
|
|
61
|
-
\ text-decoration: none;\n }\n @media (max-width: 700px) {\n div
|
|
62
|
-
{\n margin: 0 auto;\n width: auto;\n }\n }\n
|
|
63
|
-
\ </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
|
64
|
-
\ <p>This domain is for use in illustrative examples in documents. You may
|
|
65
|
-
use this\n domain in literature without prior coordination or asking for
|
|
66
|
-
permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More
|
|
67
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
|
68
|
-
recorded_at: Sat, 01 Apr 2023 12:57:11 GMT
|
|
69
|
-
- request:
|
|
70
|
-
method: get
|
|
71
|
-
uri: https://www.example.org/
|
|
72
|
-
body:
|
|
73
|
-
encoding: US-ASCII
|
|
74
|
-
string: ''
|
|
75
|
-
headers:
|
|
76
|
-
Index:
|
|
77
|
-
- 2
|
|
78
|
-
Accept-Encoding:
|
|
79
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
80
|
-
Accept:
|
|
81
|
-
- "*/*"
|
|
82
|
-
User-Agent:
|
|
83
|
-
- Ruby Link Checker/0.1.0
|
|
84
|
-
Host:
|
|
85
|
-
- www.example.org
|
|
86
|
-
response:
|
|
87
|
-
status:
|
|
88
|
-
code: 200
|
|
89
|
-
message: OK
|
|
90
|
-
headers:
|
|
91
|
-
Accept-Ranges:
|
|
92
|
-
- bytes
|
|
93
|
-
Age:
|
|
94
|
-
- '100798'
|
|
95
|
-
Cache-Control:
|
|
96
|
-
- max-age=604800
|
|
97
|
-
Content-Type:
|
|
98
|
-
- text/html; charset=UTF-8
|
|
99
|
-
Date:
|
|
100
|
-
- Sat, 01 Apr 2023 12:57:11 GMT
|
|
101
|
-
Etag:
|
|
102
|
-
- '"3147526947"'
|
|
103
|
-
Expires:
|
|
104
|
-
- Sat, 08 Apr 2023 12:57:11 GMT
|
|
105
|
-
Last-Modified:
|
|
106
|
-
- Thu, 17 Oct 2019 07:18:26 GMT
|
|
107
|
-
Server:
|
|
108
|
-
- ECS (nyb/1D2E)
|
|
109
|
-
Vary:
|
|
110
|
-
- Accept-Encoding
|
|
111
|
-
X-Cache:
|
|
112
|
-
- HIT
|
|
113
|
-
Content-Length:
|
|
114
|
-
- '648'
|
|
115
|
-
body:
|
|
116
|
-
encoding: UTF-8
|
|
117
|
-
string: "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
|
118
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
|
119
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
|
120
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
|
121
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system,
|
|
122
|
-
system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\",
|
|
123
|
-
Helvetica, Arial, sans-serif;\n \n }\n div {\n width:
|
|
124
|
-
600px;\n margin: 5em auto;\n padding: 2em;\n background-color:
|
|
125
|
-
#fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px
|
|
126
|
-
rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n
|
|
127
|
-
\ text-decoration: none;\n }\n @media (max-width: 700px) {\n div
|
|
128
|
-
{\n margin: 0 auto;\n width: auto;\n }\n }\n
|
|
129
|
-
\ </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
|
130
|
-
\ <p>This domain is for use in illustrative examples in documents. You may
|
|
131
|
-
use this\n domain in literature without prior coordination or asking for
|
|
132
|
-
permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More
|
|
133
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
|
134
|
-
recorded_at: Sat, 01 Apr 2023 12:57:11 GMT
|
|
135
|
-
recorded_with: VCR 6.1.0
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: head
|
|
5
|
-
uri: https://www.example.org/
|
|
6
|
-
body:
|
|
7
|
-
encoding: US-ASCII
|
|
8
|
-
string: ''
|
|
9
|
-
headers:
|
|
10
|
-
Index:
|
|
11
|
-
- 1
|
|
12
|
-
Accept-Encoding:
|
|
13
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
14
|
-
Accept:
|
|
15
|
-
- "*/*"
|
|
16
|
-
User-Agent:
|
|
17
|
-
- Ruby Link Checker/0.1.0
|
|
18
|
-
Host:
|
|
19
|
-
- www.example.org
|
|
20
|
-
response:
|
|
21
|
-
status:
|
|
22
|
-
code: 429
|
|
23
|
-
message: OK
|
|
24
|
-
headers:
|
|
25
|
-
Accept-Ranges:
|
|
26
|
-
- bytes
|
|
27
|
-
Age:
|
|
28
|
-
- '100798'
|
|
29
|
-
Cache-Control:
|
|
30
|
-
- max-age=604800
|
|
31
|
-
Content-Type:
|
|
32
|
-
- text/html; charset=UTF-8
|
|
33
|
-
Date:
|
|
34
|
-
- Sat, 01 Apr 2023 12:57:11 GMT
|
|
35
|
-
Etag:
|
|
36
|
-
- '"3147526947"'
|
|
37
|
-
Expires:
|
|
38
|
-
- Sat, 08 Apr 2023 12:57:11 GMT
|
|
39
|
-
Last-Modified:
|
|
40
|
-
- Thu, 17 Oct 2019 07:18:26 GMT
|
|
41
|
-
Server:
|
|
42
|
-
- ECS (nyb/1D2E)
|
|
43
|
-
Vary:
|
|
44
|
-
- Accept-Encoding
|
|
45
|
-
X-Cache:
|
|
46
|
-
- HIT
|
|
47
|
-
Content-Length:
|
|
48
|
-
- '648'
|
|
49
|
-
body:
|
|
50
|
-
encoding: UTF-8
|
|
51
|
-
string: "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
|
52
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
|
53
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
|
54
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
|
55
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system,
|
|
56
|
-
system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\",
|
|
57
|
-
Helvetica, Arial, sans-serif;\n \n }\n div {\n width:
|
|
58
|
-
600px;\n margin: 5em auto;\n padding: 2em;\n background-color:
|
|
59
|
-
#fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px
|
|
60
|
-
rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n
|
|
61
|
-
\ text-decoration: none;\n }\n @media (max-width: 700px) {\n div
|
|
62
|
-
{\n margin: 0 auto;\n width: auto;\n }\n }\n
|
|
63
|
-
\ </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
|
64
|
-
\ <p>This domain is for use in illustrative examples in documents. You may
|
|
65
|
-
use this\n domain in literature without prior coordination or asking for
|
|
66
|
-
permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More
|
|
67
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
|
68
|
-
recorded_at: Sat, 01 Apr 2023 12:57:11 GMT
|
|
69
|
-
- request:
|
|
70
|
-
method: head
|
|
71
|
-
uri: https://www.example.org/
|
|
72
|
-
body:
|
|
73
|
-
encoding: US-ASCII
|
|
74
|
-
string: ''
|
|
75
|
-
headers:
|
|
76
|
-
Index:
|
|
77
|
-
- 2
|
|
78
|
-
Accept-Encoding:
|
|
79
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
80
|
-
Accept:
|
|
81
|
-
- "*/*"
|
|
82
|
-
User-Agent:
|
|
83
|
-
- Ruby Link Checker/0.1.0
|
|
84
|
-
Host:
|
|
85
|
-
- www.example.org
|
|
86
|
-
response:
|
|
87
|
-
status:
|
|
88
|
-
code: 429
|
|
89
|
-
message: OK
|
|
90
|
-
headers:
|
|
91
|
-
Accept-Ranges:
|
|
92
|
-
- bytes
|
|
93
|
-
Age:
|
|
94
|
-
- '100798'
|
|
95
|
-
Cache-Control:
|
|
96
|
-
- max-age=604800
|
|
97
|
-
Content-Type:
|
|
98
|
-
- text/html; charset=UTF-8
|
|
99
|
-
Date:
|
|
100
|
-
- Sat, 01 Apr 2023 12:57:11 GMT
|
|
101
|
-
Etag:
|
|
102
|
-
- '"3147526947"'
|
|
103
|
-
Expires:
|
|
104
|
-
- Sat, 08 Apr 2023 12:57:11 GMT
|
|
105
|
-
Last-Modified:
|
|
106
|
-
- Thu, 17 Oct 2019 07:18:26 GMT
|
|
107
|
-
Server:
|
|
108
|
-
- ECS (nyb/1D2E)
|
|
109
|
-
Vary:
|
|
110
|
-
- Accept-Encoding
|
|
111
|
-
X-Cache:
|
|
112
|
-
- HIT
|
|
113
|
-
Content-Length:
|
|
114
|
-
- '648'
|
|
115
|
-
body:
|
|
116
|
-
encoding: UTF-8
|
|
117
|
-
string: "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
|
118
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
|
119
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
|
120
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
|
121
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system,
|
|
122
|
-
system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\",
|
|
123
|
-
Helvetica, Arial, sans-serif;\n \n }\n div {\n width:
|
|
124
|
-
600px;\n margin: 5em auto;\n padding: 2em;\n background-color:
|
|
125
|
-
#fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px
|
|
126
|
-
rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n
|
|
127
|
-
\ text-decoration: none;\n }\n @media (max-width: 700px) {\n div
|
|
128
|
-
{\n margin: 0 auto;\n width: auto;\n }\n }\n
|
|
129
|
-
\ </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
|
130
|
-
\ <p>This domain is for use in illustrative examples in documents. You may
|
|
131
|
-
use this\n domain in literature without prior coordination or asking for
|
|
132
|
-
permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More
|
|
133
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
|
134
|
-
recorded_at: Sat, 01 Apr 2023 12:57:11 GMT
|
|
135
|
-
- request:
|
|
136
|
-
method: get
|
|
137
|
-
uri: https://www.example.org/
|
|
138
|
-
body:
|
|
139
|
-
encoding: US-ASCII
|
|
140
|
-
string: ''
|
|
141
|
-
headers:
|
|
142
|
-
Index:
|
|
143
|
-
- 3
|
|
144
|
-
Accept-Encoding:
|
|
145
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
146
|
-
Accept:
|
|
147
|
-
- "*/*"
|
|
148
|
-
User-Agent:
|
|
149
|
-
- Ruby Link Checker/0.1.0
|
|
150
|
-
Host:
|
|
151
|
-
- www.example.org
|
|
152
|
-
response:
|
|
153
|
-
status:
|
|
154
|
-
code: 200
|
|
155
|
-
message: OK
|
|
156
|
-
headers:
|
|
157
|
-
Accept-Ranges:
|
|
158
|
-
- bytes
|
|
159
|
-
Age:
|
|
160
|
-
- '100798'
|
|
161
|
-
Cache-Control:
|
|
162
|
-
- max-age=604800
|
|
163
|
-
Content-Type:
|
|
164
|
-
- text/html; charset=UTF-8
|
|
165
|
-
Date:
|
|
166
|
-
- Sat, 01 Apr 2023 12:57:11 GMT
|
|
167
|
-
Etag:
|
|
168
|
-
- '"3147526947"'
|
|
169
|
-
Expires:
|
|
170
|
-
- Sat, 08 Apr 2023 12:57:11 GMT
|
|
171
|
-
Last-Modified:
|
|
172
|
-
- Thu, 17 Oct 2019 07:18:26 GMT
|
|
173
|
-
Server:
|
|
174
|
-
- ECS (nyb/1D2E)
|
|
175
|
-
Vary:
|
|
176
|
-
- Accept-Encoding
|
|
177
|
-
X-Cache:
|
|
178
|
-
- HIT
|
|
179
|
-
Content-Length:
|
|
180
|
-
- '648'
|
|
181
|
-
body:
|
|
182
|
-
encoding: UTF-8
|
|
183
|
-
string: "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
|
184
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
|
185
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
|
186
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
|
187
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system,
|
|
188
|
-
system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\",
|
|
189
|
-
Helvetica, Arial, sans-serif;\n \n }\n div {\n width:
|
|
190
|
-
600px;\n margin: 5em auto;\n padding: 2em;\n background-color:
|
|
191
|
-
#fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px
|
|
192
|
-
rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n
|
|
193
|
-
\ text-decoration: none;\n }\n @media (max-width: 700px) {\n div
|
|
194
|
-
{\n margin: 0 auto;\n width: auto;\n }\n }\n
|
|
195
|
-
\ </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
|
196
|
-
\ <p>This domain is for use in illustrative examples in documents. You may
|
|
197
|
-
use this\n domain in literature without prior coordination or asking for
|
|
198
|
-
permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More
|
|
199
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
|
200
|
-
recorded_at: Sat, 01 Apr 2023 12:57:11 GMT
|
|
201
|
-
recorded_with: VCR 6.1.0
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
require 'async'
|
|
5
|
-
require 'async/http'
|
|
6
|
-
|
|
7
|
-
describe LinkChecker::Async::HTTP::Checker do
|
|
8
|
-
module AsyncTestLinkChecker
|
|
9
|
-
class Task < LinkChecker::Async::HTTP::Task; end
|
|
10
|
-
|
|
11
|
-
class LinkChecker < LinkChecker::Async::HTTP::Checker
|
|
12
|
-
def check(url, options = {})
|
|
13
|
-
super
|
|
14
|
-
run
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
before :all do
|
|
20
|
-
VCR.configure do |config|
|
|
21
|
-
config.hook_into :webmock
|
|
22
|
-
# async-http's WebMock adapter replays responses through a real HTTP/1
|
|
23
|
-
# parser, which rejects a Transfer-Encoding header alongside a
|
|
24
|
-
# Content-Length or an empty body, unlike the other checkers' adapters.
|
|
25
|
-
config.before_playback do |interaction|
|
|
26
|
-
interaction.response.headers.delete('Transfer-Encoding')
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
after do
|
|
32
|
-
LinkChecker::Async::HTTP::Config.reset
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe AsyncTestLinkChecker::LinkChecker do
|
|
36
|
-
it_behaves_like 'a link checker'
|
|
37
|
-
|
|
38
|
-
describe '.config' do
|
|
39
|
-
it 'returns the Config module' do
|
|
40
|
-
expect(LinkChecker::Async::HTTP.config).to eq LinkChecker::Async::HTTP::Config
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
context 'with timeout options', vcr: { cassette_name: '200' } do
|
|
45
|
-
before do
|
|
46
|
-
LinkChecker::Async::HTTP.configure do |config|
|
|
47
|
-
config.read_timeout = 5
|
|
48
|
-
config.open_timeout = 10
|
|
49
|
-
end
|
|
50
|
-
expect(Async::HTTP::Endpoint).to receive(:parse).with(
|
|
51
|
-
URI(url).to_s,
|
|
52
|
-
hash_including(timeout: 10)
|
|
53
|
-
).and_call_original
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
include_context 'with url'
|
|
57
|
-
|
|
58
|
-
it 'creates requests with a default timeout' do
|
|
59
|
-
expect(result.success?).to be true
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
context 'timeout' do
|
|
64
|
-
before do
|
|
65
|
-
stub_request(:get, 'https://www.example.org/').to_timeout
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
include_context 'with url'
|
|
69
|
-
|
|
70
|
-
around do |example|
|
|
71
|
-
VCR.turned_off { example.run }
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it 'times out' do
|
|
75
|
-
expect(result.success?).to be false
|
|
76
|
-
expect(result.error?).to be true
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
context 'with metadata' do
|
|
80
|
-
let(:options) { { foo: :bar } }
|
|
81
|
-
|
|
82
|
-
it 'times out' do
|
|
83
|
-
expect(result.error?).to be true
|
|
84
|
-
expect(result.options).to eq(foo: :bar)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
describe LinkChecker::Async::HTTP::Result do
|
|
91
|
-
describe '#code' do
|
|
92
|
-
it 'returns -1 when there is no response' do
|
|
93
|
-
request = instance_double(Protocol::HTTP::Request)
|
|
94
|
-
result = described_class.new(URI('https://www.example.org'), 'GET', nil, request, nil, {})
|
|
95
|
-
expect(result.code).to eq(-1)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|