ExtractorSVG parses SVG with the JDK's StAX parser and extracts hrefs
from elements like <image>, <use> and <script> as embeds and from <a>
as links, along with <?xml-stylesheet?>, url() in presentation
attributes, <style>, <script>, animated hrefs and HTML in
<foreignObject>. Like browsers it requires the SVG namespace, decides
by the root element whether text/xml and application/xml responses
are SVG, and keeps the links found before any XML error. It's added
to the default profile before extractorHtml.
ExtractorHTML and JerichoExtractorHTML now treat hrefs on those inline
SVG elements as embeds rather than links, and extract url() from
presentation attributes like fill. ExtractorCSS now ignores
same-document references like url(#gradient).
Fixes#796
Replaces startsWith() prefix checks, which also matched longer subtypes,
e.g. "application/vnd.wap.wml" matched the binary
"application/vnd.wap.wmlc". The truncated "application/xhtml" and
"application/vnd.wap.xhtml" checks now name the full "+xml" types. Also
fixes case-sensitive comparisons in ExtractorPDF and ExtractorPDFContent,
and drops BotBlockDetector's private equivalent.
Substring heuristics like ExtractorJS's indexOf("javascript") and
ExtractorXML's indexOf("xml") are intentionally left as they are.
Compares the content type's type/subtype with the given media type,
ignoring case and any parameters, so "Text/HTML; charset=utf-8" matches
"text/html" but "text/htmlfoo" doesn't. This replaces ad hoc checks like
toLowerCase().startsWith(...), which also match longer subtypes.
Previously a '>' inside a quoted attribute value, e.g.
onclick="if (a > b) ..." or an iframe srcdoc, ended the tag early and
any attributes after it were lost. Quotes are now only treated as value
delimiters directly after '=', as in browsers.
Only extracted when formmethod=get or extractOnlyFormGets is disabled,
since without formmethod the form's own method applies and would
require tracking state between tags.
An Alt-Svc header without an ma parameter set the HTTP/3 expiry to
the current time, so the alternative was discarded straight away and
HTTP/3 was never used for that server. RFC 7838 defines the default
freshness lifetime as 24 hours, which the code comment already
states.
Add S_MIDFETCH_ABORTED (-5005) and set it in FetchHTTP when
shouldFetchBodyRule rejects a response, in place of S_OUT_OF_SCOPE.
The code means something distinct from a scope rejection, so crawl logs
and reports can now tell the two apart. AbstractFrontier.isDisregarded()
treats it as disregarded, CrawlURI gives it a readable string and the
glossary lists it.
A rejection by shouldFetchBodyRule now sets S_OUT_OF_SCOPE, causing the
frontier to disregard the URI without charging the queue budget or
retrying it, and skipping extraction and WARC writing. Tests cover
rejected responses and preserve successful handling for accepted or
disabled rules, prerequisites, size limits, and timeouts.
Fixes#455
Abort connections and channels before replacing them, and in stop(), so
the client stops recovering what this producer no longer references.
Automatic recovery stays enabled here, unlike AMQPUrlReceiver: connect()
runs on the publishing thread under a lock, so making it the only recovery
path would block every ToeThread while the broker is down.
getting-started:
- Use a Java 17 path in the JAVA_HOME example (17 is the minimum)
- Link to the local Configuring Jobs page instead of the wiki
- Fix typos
operating:
- Correct --jobs-dir option name and explain its default
- Document --proxy-host, --proxy-port and --sni-host-check
- Fix option list formatting that broke rendering (-c, --web-auth)
- Remove contradictory note about credentials in heritrix_out.log
- crawl.log fetch duration is separated by '+', not ';'
- Renumber progress-statistics.log fields (field 3 was duplicated)
- Fix sourceTagSeeds property name in the XML example
- ActionDirectory is already in the default profile
- Use the correct frontier.recover.gz file name throughout
- The action directory is inside the job directory, not beside bin/
configuring-jobs:
- Fix maxDocumentsDownload, obeyRelNofollow and logger class names
- Replace removed/renamed decide rules with their current names
- Fix javadoc links for decide rules in subpackages and in engine
- Fix malformed useHTTP3 XML example and FTP/SFTP seed examples
- Replace dead Confluence glossary link
- Drop DoH caveats that only applied to Java 11 / DisableExplicitGC
api:
- Fix Create Job field list not rendering (missing blank line)
- Script engines: list Groovy/BeanShell; js and AppleScript are not
available on supported Java versions
- Make JSON sample response consistent with the XML one
glossary:
- SHA-1 is used for content digests, not encryption
- Fix garbled Host entry (logical vs physical host)
- Fix SURT and SURT prefix examples
- Status -6 refers to DNS, not WHOIS; add -9, 1001, 2001, 2002
- Link status codes to RFC 9110 instead of RFC 2616
We're seeing occasional random test failures. I think it may be because we're changing the CrawlController scratchDir before each test, which means the profile of a running browser can get wiped out.
Restlet's Directory gives every file an Expires header 10 minutes in the
future. Job files (logs, reports, crawler-beans.cxml) change constantly, so
browsers could show stale copies. Worst case, the config editor loads a
cached crawler-beans.cxml and saving it silently reverts newer changes.
Clear the expiration date and send Cache-Control: no-cache instead, so
browsers revalidate against Last-Modified on each use.
Disable the client's automatic recovery and leave StarterRestarter as the
sole owner of the consumer lifecycle, so only one mechanism re-registers a
consumer after a failure.
Abort dead connections and channels before replacing them, so they cannot
go on consuming once the bean has stopped referencing them.
Catch everything in handleDelivery, including the json parsing and the ack,
so one bad message or one dead channel cannot close the channel out from
under every other consumer on it.
Hold consumerTag in an AtomicReference and clear it with compareAndSet, so a
late shutdown signal cannot clear a newer consumer's tag. A lock would risk
deadlocking against stop().
Add CrossSiteRequestFilter in front of the web UI's router to protect
against cross-site request forgery. POST, PUT and DELETE requests are
rejected with 403 when the browser's Sec-Fetch-Site header says they
came from another site.
Sec-Fetch-Site is set by the browser from its own view of the page and
target URL, so unlike comparing Origin with Host it isn't affected by
reverse proxies rewriting the host or scheme. Requests without the
header, such as from curl and other API clients, are allowed.
Origins listed in the heritrix.trustedOrigins system property (comma
separated) are allowed to send cross-site requests.
Only write heritrix_dmesg.log when requested
Heritrix.java always created heritrix_dmesg.log in $HERITRIX_HOME, even
though only the bin/heritrix script reads it, and only when it starts
Heritrix in the background. This got in the way of making
$HERITRIX_HOME read-only for Docker and systemd setups.
The startup log is now written only when the heritrix.dmesg system
property gives its path. bin/heritrix sets this property in background
mode and keeps the file in the same place as before.
Also fix a typo in bin/heritrix ($startmessage) that stopped it
removing a heritrix_dmesg.log left over from a previous start.
Set -Dheritrix.dmesg in heritrix.cmd too.
The paged log viewer gains a search box taking a search-engine style
query, passed as the q parameter:
status:4xx host:example.com -type:image size>1MB duration>10s
- Terms are ANDed; '-' negates; double quotes allow spaces.
- 'field:value' is a case-insensitive substring match with '*'
wildcards, 'field=value' is exact and 'field~regex' is a Java regex.
Numeric fields take the same values with ':' or '=', and no regex;
a comparison needs no operator, as in size>1MB.
- Bare words and the 'line' field search the whole line in any log.
crawl.log also supports status (404, 4xx, <0, 500..599, 404,410),
size (>1MB, 100KB..10MB; units are powers of 1024), duration (>10s,
500..2000 in ms), depth (hops from the seed: 0, >5), hops (the hop
path, e.g. hops:*E), url, host (includes subdomains), via and viahost
(the URI it was discovered from, and its host), type and annot.
- Bare words and line terms are highlighted in the results.
Filtering keeps the viewer's stateless, byte-position paging and works
across checkpoint logs: each request scans forward or backward from pos
until it has enough matches or reaches the start or end, streaming a
progress bar to the browser. A scan stops after 5 minutes, offering a
link to continue from where it stopped, or as soon as the client
disconnects. Regex matching is aborted at the same deadline to guard against
catastrophic backtracking. The query is carried through all navigation links.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checkpointing renames each log in place (crawl.log becomes
crawl.log.cp00001-<timestamp>) and starts a new one, so earlier entries
could only be viewed one file at a time. The paged viewer now offers an
"include N checkpoint logs" link (all=y) that shows the log and its
rotated generations in the current launch as one virtual file, oldest
first, with each run of lines labelled with its file.
Positions in the virtual file stay valid across checkpoints, since a
rotated file keeps its place and the new log continues after it, and
they are converted when toggling so the view stays where it was.
Gzipped generations can't be read at arbitrary positions and are
left out.
LogSeries opens the files and fixes their lengths up front, so a
rotation mid-request doesn't change what is read. Paging uses a new
FilteredLineScanner over a LogSeries instead of FileUtils.pagedLines,
which can only read a single file. Results are the same for every
position the navigation links generate; a hand-edited pos in the
middle of a line now starts at that line rather than the next one.
Lines are capped at 256 KiB so a file with few or no newlines can't
exhaust the heap.
Also fixes in the crawl.log rendering: a rotated crawl.log gets the
same status highlighting, status codes unknown to Jetty (e.g. 999) and
numbers too long to be a status no longer fail the page, and the file
name, status titles and navigation links are HTML escaped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>