Commit Graph
754 Commits
Author SHA1 Message Date
Alex Osborne 0782fb0481 JDK11: upgrade engine to jetty 9.4.19 and restlet 2.4.0
Jetty 9.4.12+ is required for TLS to work correctly under JDK11
(due to SSL handshake failures). In order to upgrade
Jetty we also need to upgrade Restlet.

There is one intentional change in behaviour to simplify
upgrading. We remove a workaround for an old [webkit bug]
where the browser claimed to prefer application/xml. The
bug was fixed in 2011.

[webkit bug]: https://bugs.webkit.org/show_bug.cgi?id=27267

Summary of Jetty API changes:
- package names changed such as org.mortbay -> org.eclipse
- SocketConnector and SslSocketConnector merged to ServerConnector
- HashUserRealm split into UserStore and HashLoginService
- SecurityHandler -> ConstraintSecurityHandler

Summary of Restlet API changes:
- some classes have moved package (Request, Response, Router etc)
- ServerResource replaces Resource
- represent(), acceptRepresentation() renamed to get(), post()
- constructors were replaced by an init() method
- setModifiable() was removed
- getRequest().getEntityAsForm() -> new Form(entity)
- Guard -> ChallengeAuthenticator

Fixes #275
2019-08-06 15:16:37 +09:00
Alex Osborne 9d1341c731 JDK11 support: upgrade jetty to 9.4.19 in modules tests
Fixes #268 ssl handshake_failure. Support for jdk11 was added in jetty
9.4.14 but we may as well bump to the latest stable version.

In Jetty 9 it appears the request is logged after the response is sent.
Thus it was racing with the assertions that check the client IP. So to
fix this rather stashing the 'lastRequest' we just make the server
echo the client's IP in a response header.

Some other minor tweaks were needed due to changes in Jetty behaviour:

- We stop checking the length of the raw response. It doesn't tell us
  anything and easily varies.

- Jetty now generates Set-Cookie with a space after the ;

- Jetty now lowercases the word "basic" in WWW-Authenticate header

- testLaxUrlEncoding(): Jetty now rejects bad paths with a 400 error so
  we disable the response checks. The actual request line is
  still checked which is the important thing.

Note: This patch does not affect the version of jetty used by the
Heritrix admin console. That will be tackled separately.
2019-08-05 14:35:09 +09:00
Noah Levitt 37fb6f6b7b do not drop any CrawlURI.data between processing
Without this change (or other measures), we sometimes get nulls in the
ExtractorYoutubeDL log for containing page information. We'll run this
on QA for a while and see if it causes any problems.

nlevitt [1:59 PM]
https://github.com/internetarchive/heritrix3/blob/master/modules/src/main/java/org/archive/modules/CrawlURI.java#L878
drops some stuff from `CrawlURI.data` after processing a uri, even if it needs to be processed again
there is a list of keys that shouldn’t be dropped (`persistentKeys`), but it is final and private
so if you’re writing your own heritrix module and you want to keep some information in CrawlURI.data, it usually works, except when the url is processed more than once (like when it needs a prereq like robots.txt the first time)
in practice it seems that most data is persisted, that is, most commonly used keys are in `persistentKeys`
in a crawl with pretty standard configuration i’m mostly seeing `prerequisite-uri` dropped and occasionally `fetch-completed-time` and `fetch-began-time` being dropped
i’m highly skeptical of the value of dropping keys at all and i’m tempted to get rid of this entirely, make all the keys persistent in other words
soliciting feedback (edited)

anjackson [2:39 PM]
My immediate reaction is HARD AGREE. It looks like Really Old Code though (https://github.com/internetarchive/heritrix3/blame/7d3eff5269142c77fa4b988396153f4c29d16caa/modules/src/main/java/org/archive/modules/CrawlURI.java#L878)
so the reasons for doing so may have been lost in time.
Hm, looking at usage: https://github.com/internetarchive/heritrix3/blob/a60b2ef3875ad47f57b0c6b3c0b19f86c40a12f7/engine/src/main/java/org/archive/crawler/frontier/WorkQueueFrontier.java#L954-L955
engine/src/main/java/org/archive/crawler/frontier/WorkQueueFrontier.java:954-955

                curi.processingCleanup(); // lose state that shouldn't burden
                                          // retry

I guess there's a concern that there may be state in there that is set during a fetch and may cause problems if the same CrawlURI is deferred?
But I'm not aware of anything in the fetch chain that behaves like that.

nlevitt [3:02 PM]
oh, i missed `CrawlURI.addDataPersistentMember(String)` et al. still...
2019-04-30 16:20:53 -07:00
Noah Levitt 1bd8b713c6 quiet org.mortbay.log (jetty?) logging
There is already a clause for this in logging.properties, but it's using
log4j. It was dumping stack traces every time the client was dubious of
heritrix's self-signed certificate.

Why do we have so many identical log4j.xml's? 🤷‍♂️
2019-04-30 16:17:35 -07:00
Alex Osborne dd37598470 Revert "Upgrade httpclient to 4.5.7 and handle cookies more compliantly" 2019-03-28 10:14:42 +09:00
Andrew Jackson 03da8c06cf Merge branch 'master' into upgrade-httpclient 2019-03-21 00:06:10 +00:00
Andrew Jackson 044f068d1b Removing outdated test. 2019-03-21 00:06:05 +00:00
Andrew Jackson 629a7adcb6 Disable questionalbe test. 2019-03-20 22:02:58 +00:00
Andrew Jackson 2fbe603878 Avoid deprecated flag. 2019-03-20 22:02:35 +00:00
Andrew Jackson e910bb6a5b Supply an iterator, for #245 2019-03-20 21:18:19 +00:00
Alex Osborne 7d91a1d4ee Handle missing closing paren in srcset descriptor 2019-03-16 16:02:48 +09:00
Alex Osborne 2a34fcffd6 Teach jericho extractor srcset 2019-03-16 15:47:50 +09:00
Alex Osborne e1d93e3308 Don't run srcset test against jericho, it doesn't handle it 2019-03-16 12:35:57 +09:00
Alex Osborne 90c52c3a25 Handle commas more compliantly when parsing srcset
Commas are allowed if they're in the middle of the URL. Consequently:

    srcset="a,b,,c,"   => ["a,b,,c"]
    srcset="a, b,, c," => ["a", "b", "c"]

They occur particularly commonly in data: URLs before the base64 value.

Commas are also allowed in descriptors if they are enclosed by parens:

    srcset="a (b,c),d" => ["a", "d"]

Spec: https://html.spec.whatwg.org/multipage/images.html#parsing-a-srcset-attribute
2019-03-16 11:53:37 +09:00
Andrew Jackson 667cf3ac5e As @nlevitt suggestion, a further check. 2019-02-06 21:03:49 +00:00
Andrew Jackson 949a350cd8 Add checks to guard against server sending 304 in error, for #229. 2019-02-04 10:26:12 +00:00
Noah Levitt fea6241fac implement PredicatedDecideRule.onlyDecision()
DecideRuleSequence already has the optimization that I was looking for,
namely, don't bother evaluating a DecideRule if we know it won't change
the current result. For some reason PredicatedDecideRule, which is a
parent class to most of the decide rules in heritrix, didn't implement
onlyDecision(). Certain crawl configurations could see significant
performance improvement with this change.
2018-11-15 11:13:27 -08:00
Noah Levitt a831676196 Merge pull request #209 from ukwa/relative-base-href
HtmlExtractor: allow relative hrefs in the base element
2018-09-11 15:18:48 -07:00
Noah Levitt 9c9d11d272 fix exception starting DecideRuleSequence logging
I don't know why we've never seen this before, and now we suddenly have
a case of it, but this is the exception:

2018-07-23 17:47:01.123 SEVERE thread-2875088 org.archive.crawler.framework.CrawlJob.beansException() Failed to start bean 'scope'; nested exception is java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /1/ait-h3-jobs/8144-20180723162745141/20180723174701/logs/scope.log.lck
org.springframework.context.ApplicationContextException: Failed to start bean 'scope'; nested exception is java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /1/ait-h3-jobs/8144-20180723162745141/20180723174701/logs/scope.log.lck
        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:169)
        at org.springframework.context.support.DefaultLifecycleProcessor.access$1(DefaultLifecycleProcessor.java:154)
        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:335)
        at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:143)
        at org.springframework.context.support.DefaultLifecycleProcessor.start(DefaultLifecycleProcessor.java:89)
        at org.springframework.context.support.AbstractApplicationContext.start(AbstractApplicationContext.java:1236)
        at org.archive.spring.PathSharingContext.start(PathSharingContext.java:115)
        at org.archive.crawler.framework.CrawlJob.startContext(CrawlJob.java:455)
        at org.archive.crawler.framework.CrawlJob$1.run(CrawlJob.java:428)
Caused by: java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /1/ait-h3-jobs/8144-20180723162745141/20180723174701/logs/scope.log.lck
        at org.archive.crawler.reporting.CrawlerLoggerModule.setupSimpleLog(CrawlerLoggerModule.java:298)
        at org.archive.modules.deciderules.DecideRuleSequence.start(DecideRuleSequence.java:174)
        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:166)
        ... 8 more
Caused by: java.nio.file.NoSuchFileException: /1/ait-h3-jobs/8144-20180723162745141/20180723174701/logs/scope.log.lck
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:177)
        at java.nio.channels.FileChannel.open(FileChannel.java:287)
        at java.nio.channels.FileChannel.open(FileChannel.java:335)
        at java.util.logging.FileHandler.openFiles(FileHandler.java:478)
        at java.util.logging.FileHandler.<init>(FileHandler.java:344)
        at org.archive.io.GenerationFileHandler.<init>(GenerationFileHandler.java:63)
        at org.archive.io.GenerationFileHandler.makeNew(GenerationFileHandler.java:158)
        at org.archive.crawler.reporting.CrawlerLoggerModule.setupLogFile(CrawlerLoggerModule.java:275)
        at org.archive.crawler.reporting.CrawlerLoggerModule.setupSimpleLog(CrawlerLoggerModule.java:296)
        ... 10 more
2018-07-27 09:49:17 +09:00
Andrew Jackson 8384a59b47 Fix up tests to account for new Base URI behaviour. 2018-07-06 15:15:53 +01:00
Andrew Jackson 8bf23081fa Only set the BaseURI if not set already. 2018-07-05 13:34:17 +01:00
Andrew Jackson 14148cc7a8 Same fix for JerichoExtractorHTML. 2018-07-05 09:40:21 +01:00
Andrew Jackson 42181b8585 Test case and fix for internetarchive/heritrix3#208. 2018-07-04 16:18:46 +01:00
Kenji Nagahashi a7b7c6cf5a fix for test failures in a workspace on NFS-mounted filesystem
ContentDigestHistoryTest does not close BdbModule. It results in failure to delete bdb directory in following tests.
Added tearDown() method that closes BdbModule.
2017-12-08 17:15:03 -08:00
Barbara Miller 998edf3479 max size for extracted form elements 2017-11-16 08:48:06 -08:00
Alex Osborne d6d7f1b162 Fix ArrayIndexOutOfBoundsException when all lines are blank 2017-11-01 10:05:26 +09:00
Alex Osborne 68ceceedd2 Use simpler read 500k chars and split method suggested by @nlevitt
While we temporarily use a little more memory this version is a lot
less codes. It also allows us to do away with the BufferedReader.
2017-11-01 09:29:28 +09:00
Alex Osborne 1fae77c64d Enforce robots.txt character limit per char not per line
Since we were only enforcing the size limit after reading each
line a single very long line could cause us to to run out of
memory.

This change enforces the character limit on each read character
not just on line boundaries.

We also correct the count of processed characters in the warning
message, which was not counting newline and linefeed characters.
2017-10-31 18:41:00 +09:00
Barbara Miller f0d1c0422b Merge pull request #187 from nlevitt/robots-allow-failed-fetch
treat a failed fetch (e.g. socket timeout) of robots.txt the same way…
2017-10-13 11:23:54 -07:00
Andrew Jackson aee83dfe26 Allow DNS settings to be overridden via sheets. 2017-10-13 10:29:15 +01:00
Andrew Jackson e7ce1f56b4 Ensure disabling JavaDNS always fails over to the InetAddress approach. 2017-10-12 23:33:54 +01:00
Andrew Jackson d178c689de Add some comments to try to avoid misuse. 2017-10-12 22:13:00 +01:00
Andrew Jackson b0594ac0f4 Allow JavaDNS to be disabled and use that to avoid issues in StatisticsSelfTest. 2017-10-12 21:29:34 +01:00
Andrew Jackson f7a5376fbe Merge branch 'master' into fix-ci-and-add-java-8 2017-10-12 09:31:47 +01:00
Noah Levitt ae8a0ef95f update webarchive-commons dependency to incorporate fix to warc size calculation, and uncomment test that exercises the fix 2017-10-11 14:54:37 -07:00
Andrew Jackson 46fa54da0c Set an appropriate Content Size when using non-DNS resolves. 2017-10-11 17:08:15 +01:00
Noah Levitt 84debcfe4d treat a failed fetch (e.g. socket timeout) of robots.txt the same way as http errors: full allow 2017-10-06 12:00:31 -07:00
Noah Levitt 3892c17b56 ughhh appease java 8 javadoc rules 2017-06-15 17:29:22 -07:00
Noah Levitt 87a15bddc8 Merge pull request #168 from internetarchive/gh-167
fix for race-condition when first using the WARC writers https://gith…
2017-06-07 18:15:19 -07:00
Neil Minton 10541184b5 Clean up after code review.
- Parse with string split instead of regex.
- Move srcset logic up to processEmbed(CrawlURI, CharSequence, CharSequence, Hop).
2017-06-02 11:53:16 -07:00
Neil Minton 4c0e52af61 Add parsing for srcset attributes.
- Includes Unit Tests
2017-05-01 17:17:05 -07:00
Noah Levitt 0b4671c291 fix for race-condition when first using the WARC writers https://github.com/internetarchive/heritrix3/issues/167 2016-08-15 13:36:33 -07:00
Noah Levitt cf9498d2ed clear the history store at the beginning of testBasics(), because the other test might have run first 2016-06-07 14:12:20 -05:00
Noah Levitt bc8b0baa59 Merge remote-tracking branch 'origin/master' into fix-test-errors
* origin/master:
  Setup TravisCI
  Set fetch status on curis when testing link extraction
  No link extraction on URI not successfully downloaded
  Fixes issue #158 : Noisy alerts about 401s without auth challenge (#159)
  Make Content-Location header url INFERRED not REFFER hop type since Content-Location is not for redirection (#151)
  fixes for kafka 0.9 (?)
  upgrade to kafka 0.9
  somewhat ugly fix to handle exceptions from the bean browser like java.lang.RuntimeException: not implemented at org.archive.modules.fetcher.BdbCookieStore$RestrictedCollectionWrappedList.get(BdbCookieStore.java:92)
2016-06-07 13:09:51 -05:00
Kristinn Sigurðsson 70867efdac Set fetch status on curis when testing link extraction 2016-05-03 15:58:50 +00:00
Kristinn Sigurðsson 08e3d055cf No link extraction on URI not successfully downloaded 2016-05-03 14:40:24 +00:00
Kristinn Sigurðsson c5848ae803 Fixes issue #158 : Noisy alerts about 401s without auth challenge (#159)
* Fixes issue #158 : Noisy alerts about 401s without auth challenge

* Update test to account for non-fatal-error log not being empty on
non-auth 401s.
2016-05-02 10:15:32 -07:00
Hunter a02a32cdfe Make Content-Location header url INFERRED not REFFER hop type since Content-Location is not for redirection (#151) 2016-04-13 15:19:21 -07:00
Andrew Jackson 48f5e71e76 Add delay to avoid race condition during test. 2016-04-07 21:48:20 +01:00
Andrew Jackson cdb79b8868 Fix serialisation tests by defaulting to TreeMaps. 2016-04-02 20:35:37 +01:00