253 Commits

Author SHA1 Message Date
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 305204af8b Issue #689 unit tests for image attributes 2025-12-04 17:10:43 +01:00
Leslie Bellony fb791e2b0c Issue #688 ignore extracted strings longer than 2048 characters 2025-12-04 14:54:06 +01:00
Alex Osborne 219139e4e9 FetchDNS: Treat 0.0.0.0 as resolution failure
If there are multiple addresses then ignore 0.0.0.0. If the only address is 0.0.0.0 treat it as a DNS resolution failure. This should prevent us from throwing IllegalStateException later in DefaultServerCache.getHostFor().

Fixes #428
2025-08-21 09:47:48 +09:00
Alex Osborne 9b5900b528 FetchHTTP2: Avoid silently decoding gzip
Fixes `Recorder getContentReplayInputStream
WARNING: gzip problem; using raw entity instead`.
2025-06-12 21:36:14 +09:00
Alex Osborne cc50af72be FetchHTTP2: Add HTTP proxy support 2025-06-09 22:28:49 +09:00
Alex Osborne c7b7ee1842 Support * and $ wildcards in robots.txt 2025-06-07 10:37:11 +09:00
Alex Osborne 567e27181d Upgrade webarchive-commons from 1.3.0 to 2.0.1 (removes httpclient 3) 2025-05-21 17:39:21 +09:00
Alex Osborne eb1205f6d5 Upgrade all tests to junit 5 2025-05-09 00:07:18 +09:00
Alex Osborne fcfef68aff FetchHTTP2: A new fetch module for HTTP/2 and HTTP/3
This uses Jetty HttpClient since it speaks both protocols, and we
already have it as a dependency via Restlet. This doesn't support all
the options of FetchHTTP, notably proxy and POST requests are missing.

Jetty currently has the HTTP/3 client marked as "experimental, not for
production use" so we disable it by default and don't ship the large
quiche native jar it requires. It does seem to work OK though, at least
in my limited testing so far. The HTTP/3 support currently only responds
to Alt-Svc headers not other ways of discovering HTTP/3 availability
(e.g. HTTPS DNS record).

Fetches that were made via HTTP/2 or HTTP/3 are annotated 'h2' and 'h3'
in the crawl.log. The messages are recorded in the WARC files using
HTTP/1.1 syntax with a WARC-Protocol header. FetchHTTP2 also currently
records HTTP/1.1 messages without transfer-encoding rather than the raw
wire messages.
2025-04-29 12:47:57 +09:00
Alex Osborne bc259728a0 Update to Jetty 12.0.16 and Restlet 2.6.0-M2
The Jetty API has changed, which mostly affects test code.

Jetty now does a strict SNI host check which unfortunately causes it to
return "SNI error" for our existing ad-hoc certificates. For now, I've
disabled it to avoid breaking existing deployments but added a
--sni-host-check command-line option so you can re-enable it if
you've configured your own certificate appropriately.
2025-04-24 17:40:20 +09:00
Alex Osborne 7f76f5abd1 FetchHTTPTest: Disable testHostHeaderDefaultPort due to random failures
Probably some of the GitHub test runners are getting blocked.
2025-04-01 15:37:21 +09:00
Alex Osborne 4e8bda1a07 ExtractorHTML: Add obeyRelNofollow option
When enabled this option causes regular links annotated with rel=nofollow to not be extracted. This is useful for sites that use rel=nofollow to hint crawler traps.
2025-01-13 15:34:38 +09:00
Alex Osborne d5b4391cce Bump java-socks-proxy-server from 1.1.0 to 4.1.2 2024-11-29 17:12:43 +09:00
Alex Osborne cbd7f37ed9 Replace littleproxy with jetty-proxy (to remove dependency on log4j)
littleproxy has not been updated since 2017 and has various out of date
dependencies. Since we're using jetty for HTTP server testing anyway, we
 may as well use it as the proxy too.
2024-10-18 17:28:03 +09:00
Alex Osborne 3d1b7e37ca Remove log4j 2024-10-17 19:25:53 +09:00
Alex Osborne 74d6b37779 Update to kryo 5.6.0
This eliminates a few more very old dependencies that aren't in Maven Central.

Our direct usage of the unsupported sun.reflect.ReflectionFactory JDK API (which newer compilers complain about) is no longer needed as Kryo now has a SerializingInstantiatorStrategy that does roughly the same thing.
2024-06-18 10:05:56 +09:00
Alex Osborne c467065b79 Add PDFParserTest 2024-02-21 14:48:50 +09:00
Alex Osborne aac74411a1 ExtractorHTML: Fix srcset by normalizing elementContext() to lowercase
This ensures that when we later compare the context in processEmbed()
we don't need to deal with variants like srcSet or SRCSET. Note that
we're already sometimes lowercasing it later in HTMLLinkContext.get().

Fixes #477.
2022-04-22 16:44:53 +09:00
Alex Osborne d796491995 FetchHTTPTest: Fix SOCKS server startup race
testSocksProxy() is failing on the GitHub action CI runs but I can't
reproduce the issue locally. I'm just guessing this is what's causing it
but this should be fixed anyway to avoid future intermittent failures.
2022-03-28 13:26:53 +09:00
Alex Osborne 0dc05408da FetchHTTPTest: Don't test IP binding on macOS utun network interfaces
This avoids a test failure on macOS machines that are running Wireguard.
2022-03-28 11:40:48 +09:00
Alex Osborne 0d6c04fda5 FetchHTTPTest: Update to junit 4
By replacing the custom TestSuite with junit 4 @BeforeClass and
@AfterClass annotations running individual tests by themselves now works
correctly.

Since FetchHTTPTest now just contains the utility code for the test
servers we rename it to FetchHTTPTestServers. FetchHTTPTests (which
contains the actual tests) can now follow the standard naming
scheme as FetchHTTPTest.
2022-03-28 11:35:45 +09:00
Jamie Hoyle dd01689ace FetchHTTP: SOCKS5 proxy support
Closes #454
2022-03-28 10:24:07 +09:00
Alex Osborne dcf9b04007 ExtractorHTML: Determine LINK tag type by parsing REL attribute
Only treat icons, stylesheets and (tentatively) resource preloads as
embedded resources. Treat most other link types as navigation links.

Previously we were treating all link tags as embedded resources
including links like 'next', 'prev', 'canonical', 'author' which could
pull in resources that should normally be considered out of scope.

For example crawling a page containing an author link lke:

   <link href="http://twitter.com/example" rel="author">

Would end up transitively pulling 200+ MB of Twitter profile pages in
multiple languages into a crawl for which twitter.com is not even
supposed to be in scope at all.

Fixes #263
2022-01-25 17:57:54 +09:00
Clemens Klein-Robbenhaar 261fa318b4 FetchHTTPRequest: handle HTTPS requests via proxy
- do not send the scheme/host/port part of the request
  even when using a proxy, if the scheme is https
- in case of a https request send over a proxy, do not
  wrap the first input/output streams (which only contain
  the data for the `CONNECT` request), but the ones after
  them, which contain the actual data

Fixes #191
2022-01-10 08:57:22 +01:00
Alex Osborne eb67cfb215 Merge pull request #423 from internetarchive/dont-extract-data-uris
Don't extract data URIs
2021-08-03 07:43:17 +09:00
Andy Jackson 4d5b2dc3fe Merge pull request #397 from ukwa/upgrade-httpclient-4-5
Upgrade httpclient to 4.5
2021-08-02 09:19:30 +01:00
Alex Osborne e33e1ff398 Extractor: ignore data URIs when adding outlinks 2021-07-30 15:57:09 +09:00
Alex Osborne 09e3ff3568 Everywhere: Fix dangling JavaDoc comments
JavaDoc comments need to be directly above a class, method or field
declaration to be used by IDEs and generated documentation. We had some
doc comments that were attached to instance initialization blocks and
thus were being ignored. This invalid doc comment positioning was
presumably an accidental consequence of the conversion of fields to
KeyedProperties.

This change moves most of the dangling doc comments to setter methods
where it can be seen by tools. There were a couple of dangling doc
comments above package statements. These are moved above the class
declaration or removed entirely when empty.
2021-07-12 21:38:48 +09:00
Alex Osborne ef3b428061 FTP: Save server IP at fetch time and use in WARC-IP-Address 2021-06-25 14:39:26 +09:00
Alex Osborne 13c0f65294 FTP: Implement a basic fetch test 2021-06-25 14:09:38 +09:00
Alex Osborne 28ea9c4ba5 HTTP: Populate WARC-IP-Address with server's IP address
Fixes #396
2021-06-25 13:34:40 +09:00
Andrew Jackson e07b1bb938 Support cookie expiration and extend testing to cover that case. 2021-06-17 14:23:42 +01:00
Andrew Jackson 81fa60d870 Upgrade HTTPClient to 4.5.x for #245 2021-06-14 23:35:46 +01:00
morokosi 13ba0b2b67 optimize imports 2020-04-30 22:40:00 +09:00
morokosi 18bee39a4c fix discarded future value 2020-04-30 22:39:51 +09:00
Clara Wiatrowski 5e948883fa Add overrides in JerichoExtractorHTMLTest 2020-04-22 15:33:23 +02:00
Clara Wiatrowski 6710c8dba3 Add parsing for HTML tags (data-src, data-srcset, data-original and data-original-set) 2020-04-10 15:59:50 +02:00
Andy Jackson 7f80b4fd98 Merge pull request #281 from ukwa/upgrade-bdb-je
WIP: Upgrade BDB JE to version 7.5.11
2020-03-04 13:36:03 +00:00
Alex Osborne 977f608c74 Merge pull request #290 from netarchivesuite/crawltrap-regex-timeout
Crawltrap regex timeout
2020-03-03 19:27:42 +09:00
Colin Rosenthal 60e4053180 Commented this test back in to make Travis happy 2020-03-03 08:52:09 +01:00
jkafader 3a8b58998c Merge pull request #285 from nlevitt/warc-writer-chain
Warc writer chain
2020-01-13 16:39:42 -08:00
Colin Rosenthal 718cc5ae32 Updated manually to new SNAPSHOT version 2019-11-15 14:34:03 +01:00
Andrew Jackson 73db3ac628 Merge branch 'master' into upgrade-bdb-je 2019-10-17 14:10:22 +01:00
Alex Osborne 2a5bd87e51 Remove testConcurrentLoad
Noah wrote in #280:

> Maybe we should just drop the test. The assumption when we wrote the
> test was that a race condition would not be so frequent in practice.
> We've seen that under the contrived conditions created by the test
> case, it is frequent. But that's ok
2019-08-16 22:11:26 +09:00
Alex Osborne a5c03d9b73 Mitigate random CookieStore.testConcurrentLoad test failures
The arbitary value `25` was used but in prace it's quite possible
for more than 25 writing threads to have checked the cookie count
limit before adding their cookie. In practice we see Travis failing
on this test quite often, every few builds in fact.

I think using `threads.length` (i.e. 200) should cover the worst
case possibility where every thread reads a stale count and tries
to add their cookie.

Fixes #274
2019-08-12 18:08:43 +09:00
Andrew Jackson 7dab6ec275 Avoid using Thread.interrupt as this freaks BDB-JE. 2019-08-11 22:03:55 +01:00