Commit Graph
976 Commits
Author SHA1 Message Date
Alex Osborne c05bf8194f Treat link rel=prefetch and rel=prerender as navlinks
These are generally used for likely navigation targets rather than resources the current page needs.
2026-11-18 17:21:25 +09:00
Alex Osborne 48a3a6cb20 Treat link rel=preload as an embed
Fixes #824
2026-11-18 17:19:56 +09:00
Alex Osborne aa4dd213df Merge pull request #814 from internetarchive/soft404-detector
Soft404Detector: detect soft 404s and optionally skip extraction
2026-11-18 16:35:14 +09:00
Alex Osborne b7ce8f9782 Fix ExtractorJSTest for commons-lang3 3.22.0
The webarchive-commons 3.0.6 bump pulls in commons-lang3 3.22.0, whose
UnicodeUnescaper no longer throws on malformed \u escapes. Only test
the invalid code points ExtractorJS rejects itself.
2026-11-17 15:32:33 +09:00
Alex Osborne a8cd8190ea Soft404Detector: count a redirected probe as its target's probe
Otherwise the target server scheduled the same probe again.
2026-11-17 14:36:59 +09:00
Alex Osborne ee7f2c694c Soft404Detector: also remove echoes without a trailing slash
A canonical link to /a/b on the page /a/b/ prevented a match.
2026-11-17 14:36:52 +09:00
Alex Osborne c3d062bee2 Soft404Detector: only probe servers reached by seeds or links
Servers reached by a redirect or speculative link, such as other sites a
crawled site redirects to, got a probe too.
2026-11-17 14:36:46 +09:00
Alex Osborne 82e1c5ad59 Soft404Detector: drop the content length check
It compared raw lengths, but echoes of the probe path and the page's own
path make those differ, so pages that repeat their path often were
missed even with matching fingerprints.
2026-11-17 14:36:38 +09:00
Alex Osborne e1c61d3fe8 Soft404Detector: only collapse URL-like tokens containing digits
Tokens were runs of anything but whitespace, quotes and angle brackets,
so a meta refresh's "0;url=..." or a paragraph of CJK text containing
a digit collapsed to "0", making unrelated pages match.
2026-11-17 14:36:32 +09:00
Alex Osborne fb3452a6af Behaviors: log unparseable links through the Page instead of a constructor argument
ExtractLinksBehavior and PaginationBehavior took the UriErrorLoggerModule as a
constructor argument, so they had to be Spring beans to get it. That meant the
Groovy config couldn't create them inline in the behaviors list, as Spring's
Groovy reader doesn't turn inner beans in a list into beans, and had to declare
each one as a named bean and refer to it. BrowserProcessor already has the
logger module, so it now passes it to behaviors through the page and they can
be plain objects.
2026-11-13 16:08:36 +09:00
Alex Osborne dec91bca04 Merge pull request #803 from RaphaelFakhri/fix-alt-svc-default-max-age
FetchHTTP2: Default Alt-Svc max age to 24 hours
2026-11-07 09:04:07 +09:00
Raphael Fakhri 1a120ea3c2 FetchHTTP2Test: Check the Alt-Svc expiry instead of sleeping 2026-11-06 20:36:21 +00:00
Alex Osborne 5838dbf1f9 ExtractorSVG: obey ExtractorHTML obeyRelNofollow setting 2026-11-05 16:17:28 +09:00
Alex Osborne 9d79ef7372 Add ExtractorSVG and extract links from inline SVG
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
2026-11-05 16:17:28 +09:00
Alex Osborne a1f7103d12 Soft404Detector: tighten probe handling and only check HTML
- Generate one probe path per crawl (saved in checkpoints) and only
  treat URLs ending in it as the probe, so relative links from the
  probe page aren't mistaken for probes.
- Never extract links from the probe itself unless it's a redirect.
- Only check HTML responses, using CrawlURI.hasContentType(). Minified
  JSON could otherwise normalize to the same fingerprint.
- Schedule the probe with an inferred hop rather than a prerequisite
  hop, so the crawl scope's reject rules apply to it, and don't probe
  servers reached via an embed.
- Store the fingerprint as an immutable record and keep the first one
  recorded, so a probe redirected to another server doesn't overwrite
  it or count that server twice.
2026-11-05 16:12:17 +09:00
Alex Osborne d614ea3b34 Soft404Detector: detect soft 404s and optionally skip extraction
Sites that return 200 for nonexistent URLs, combined with relative
links, can generate an endless series of fake URLs (#729).

The first time a server returns a successful response, a probe for a
random two-segment path on it is scheduled. If the probe gets a 200,
its content is fingerprinted, and later 200 responses from that server
with the same fingerprint are annotated "soft404". The fingerprint is a
hash of the content after removing echoes of the requested path and
replacing tokens that contain digits, so nonces and timestamps don't
prevent a match. Seeds and the root path are exempt, and a probe
redirect that keeps the probe path is treated as the probe.

With skipExtraction (the default) the rest of the fetch chain is
skipped for matching pages, so neither the extractors nor the browser
processor see them. The default profiles enable the detector with
skipExtraction=false for now, so it only annotates and counts soft
404s until it has seen more real-world use.

Per-server probe state is stored on CrawlServer.
2026-11-05 16:12:17 +09:00
Alex Osborne 7a9e2689b4 Use CrawlURI.hasContentType() for exact media type checks
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.
2026-11-05 09:58:58 +09:00
Alex Osborne 5b1f492cc2 CrawlURI: add hasContentType() for media type comparison
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.
2026-11-05 09:53:25 +09:00
Alex Osborne a6f69a4473 Merge pull request #808 from internetarchive/extractorjs-es-module-imports
ExtractorJS: resolve ES module imports relative to script's URL
2026-11-04 16:41:13 +09:00
Alex Osborne b8c22606b6 ExtractorHTML: extract links from iframe srcdoc 2026-11-04 15:16:19 +09:00
Alex Osborne 889a6b0082 JerichoExtractorHTML: parse sequentially to ignore tags inside attribute values 2026-11-04 15:10:48 +09:00
Alex Osborne 65621b48d4 ExtractorHTML: don't end tags at '>' inside quoted attribute values
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.
2026-11-04 15:08:46 +09:00
Alex Osborne 91d41c2084 ExtractorHTML: extract formaction attribute
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.
2026-11-04 14:54:34 +09:00
Alex Osborne a356bc477d ExtractorHTML: extract link imagesrcset attribute as embed 2026-11-04 14:43:12 +09:00
Alex Osborne a76e5221cc ExtractorHTML: extract poster attribute as embed 2026-11-04 14:40:36 +09:00
Raphael Fakhri 4cfc68cda3 FetchHTTP2: Default Alt-Svc max age to 24 hours
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.
2026-11-03 13:54:10 +00:00
Matt Van Horn a769651bf5 fix: give midfetch aborts their own fetch status code
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.
2026-11-02 06:01:06 -08:00
Matt Van Horn 1c27e2e7b0 fix: disregard HTTP responses rejected before body fetching
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
2026-11-02 00:32:19 -08:00
Alex Osborne f4f88a4335 BotBlockDetector: add azure-waf and vercel (#784) 2026-10-09 08:32:00 +09:00
Alex Osborne a19bd61a33 BotBlockDetector: add aws-waf, kasada, lua-anti-ddos, perimeterx 2026-10-02 08:25:52 +09:00
Shubham Padkonde 16deaaf4eb Decode JavaScript Unicode code-point escapes in extracted URLs (#772)
Signed-off-by: Shubham Padkonde <shubhampadkonde12@gmail.com>
2026-09-22 17:21:42 +09:00
Francesco Marinoni Moretto ed2805f6b7 Extract URIs nested inside JSON arrays (#771)
`parse()` called `propertyStream()` on array nodes, which Jackson returns empty
for anything that is not an object, so URIs inside an array held as an object
property value were never extracted. Those array elements now go through the same
value handling as object values, which is also what lets a bare URI string inside
an array be extracted and not only an object holding one.

A known limit this does not change: `parse()` still starts from
`rootNode.properties()`, so a document whose root is itself an array yields no
links.
2026-09-22 17:16:43 +09:00
Alex Osborne 6c32aaa8c1 FetchHTTP: digest chunked responses after transfer decoding
Recalculate content digests from the entity replay stream for chunked responses so that chunk framing is not included in WARC-Payload-Digest.

Fixes #769
2026-09-15 10:13:56 +09:00
Leslie Bellony 33984a68d2 Issue #752 new Heritrix status for SSLHandshakeException 2026-09-08 10:56:57 +02:00
Alex Osborne b5f32616c8 Fix javadoc warnings 2026-08-25 11:02:15 +09:00
Alex Osborne cd4f910c57 BotBlockDetector: Look for cf-mitigated without server header
Might catch unusual cases where something else is in front of Cloudflare.
2026-08-19 10:49:55 +09:00
Alex Osborne 9973a9f2f0 BotBlockDetector: Add DataDome 2026-08-19 10:49:55 +09:00
Alex Osborne cec6cfbb64 Add BotBlockDetector
Detects responses produced by common bot-blocking services and adds a "botblock:service" annotation. This is intended for reporting and troubleshooting but may also be useful as a signal to stop crawling or to skip writing WARC records.
2026-08-18 16:11:35 +09:00
Adam Miller fa4184928f fix: Add null check to curi.getVia() before isNotBlank() check 2026-07-13 16:57:06 -07:00
Alex Osborne 4cb48ec5dc BrowserProcessor: fix content digest and recording limits for subresources 2026-06-18 23:18:23 +09:00
Alex Osborne 709ac00dd2 Add PaginationBehavior: repeatedly clicks next-page and extracts links 2026-06-11 13:34:55 +09:00
Adam Miller e09b33069a fix: cap dynamic attribute names to avoid pathological loop. 2026-05-15 11:29:31 -07:00
Alex Osborne 7490998843 Merge pull request #721 from simons-hub/fix/warn-on-precedence-clipping
Log warning when URI precedence exceeds maximum 127
2026-04-06 16:54:56 +09:00
Simon 47632eb4c4 Log warning when URI precedence exceeds maximum 127
BdbMultipleWorkQueues.calculateInsertKey() silently clips precedence
values to 127 for queue ordering. This can cause unexpected behavior
for custom cost assignment policies that return values above 127.

Log a warning when clipping occurs and fix the misleading comment in
CrawlURI.holderCost that said "should not exceed 255" (the actual
limit is 127, not 255).

Fixes #502
2026-03-31 00:37:36 -07:00
Alex Osborne 3c3ae15a7c Fix test failures due to missing bdb close 2026-03-10 11:37:22 +09:00
Alex Osborne 5b3117644b FetchHTTP2: Fix IllegalArgumentException when host contains underscores
Fixes #718
2026-03-10 11:22:32 +09:00
Alex Osborne 9af99add3c FetchHTTP2: Remove HttpClient default auth protocol handlers
WWWAuthenticationProtocolHandler and ProxyAuthenticationProtocolHandler unhelpfully throw exceptions if a 401 or 407 response has a larger than 16KB body or is missing the appropriate -Authenticate header.

FetchHTTP2 doesn't yet support HTTP auth, thus they aren't currently being used, so let's just remove them for now. This also adds regression tests so that if in the future we implement auth support, we don't accidentally reintroduce this.

Fixes #714
Fixes #717
2026-03-09 22:44:57 +09:00
Alex Osborne d2562577b1 FetchHTTP2: Add SOCKS5 proxy support 2026-02-05 09:29:24 +09:00
Leslie Bellony 4d6735f7c7 Add ExtractorJson from BL (#698) 2025-12-09 17:33:18 +01:00
Leslie Bellony 771452ee83 when skipping too long value, move matcher pointer to the end of value 2025-12-08 17:01:03 +01:00