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.
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.
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.
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.
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
- 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.
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.
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
`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.
Recalculate content digests from the entity replay stream for chunked responses so that chunk framing is not included in WARC-Payload-Digest.
Fixes#769
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.
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
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#714Fixes#717