class

Deadfinder::Runner

Inherits Reference < Object

Constants

ERROR_STATUS = -1

Sentinel stored in the status cache when a URL could not be fetched (connection refused, timeout, TLS failure, …). Real HTTP status codes are always >= 0, so -1 unambiguously marks a connection error.

LINK_SELECTORS = {"anchor" => {"a", "href"}, "script" => {"script", "src"}, "link" => {"link", "href"}, "iframe" => {"iframe", "src"}, "form" => {"form", "action"}, "object" => {"object", "data"}, "embed" => {"embed", "src"}, "image" => {"img", "src"}, "source" => {"source", "src"}, "video" => {"video", "src"}, "video-poster" => {"video", "poster"}, "audio" => {"audio", "src"}, "track" => {"track", "src"}, "area" => {"area", "href"}}
RETRY_BASE_DELAY = 200.milliseconds

First backoff step for --retry. Doubles per attempt (200ms, 400ms, 800ms, …) and is jittered, so a burst of workers that all trip the same rate limiter does not come back in lockstep and trip it again.

RETRY_JITTER = 0.25

Fraction of the computed backoff that jitter may add or remove.

SRCSET_SELECTORS = {"image-srcset" => {"img", "srcset"}, "source-srcset" => {"source", "srcset"}}

srcset holds a list of candidates with optional descriptors (img-480.png 480w, img-2x.png 2x), so it is expanded by parse_srcset rather than read verbatim like the single-URL attributes above.

TOP_FRAGMENT = "top"

Fragments that address the top of the document rather than an element. # (empty) and #top are valid by definition (HTML spec, "scroll to the fragment"), so --check-anchors must never report them as broken.

Class methods

permits(size : Int32) : RequestPermits

Sized lazily from the run's -c. Runner is instantiated in several places (and per target on some paths), so the budget cannot live on an instance — every target has to draw from the same pool for the cap to mean anything.

Source
reset_shared_state

Drops any in-flight bookkeeping left over from a previous run. Only relevant to back-to-back runs in one process (tests, embedded usage).

Source

Instance methods

run(target : String, options : Options, output : Hash(String, Array(String)), coverage_data : Hash(String, TargetCoverage), status_cache : Hash(String, Int32), mutex : Mutex)
Source
worker(id : Int32, jobs : Channel(Tuple(String, Array(String))), results : Channel(Nil), target : String, options : Options, output : Hash(String, Array(String)), coverage_data : Hash(String, TargetCoverage), status_cache : Hash(String, Int32), mutex : Mutex)
Source

Nested types