separate fetch api for autofetch bbehavior + additional improvements on partial responses: (#736)

Chromium now interrupts fetch() if abort() is called or page is
navigated, so autofetch behavior using native fetch() is less than
ideal. This PR adds support for __bx_fetch() command for autofetch
behavior (supported in browsertrix-behaviors 0.6.6) to fetch separately
from browser's reguar fetch()
- __bx_fetch() starts a fetch, but does not return content to browser,
doesn't need abort(), unaffected by page navigation, but will still try
to use browser network stack when possible, making it more efficient for
background fetching.
- if network stack fetch fails, fallback to regular node fetch() in the
crawler.
Additional improvements for interrupted fetch:
- don't store truncated media responses, even for 200
- avoid doing duplicate async fetching if response already handled (eg.
fetch handled in multiple contexts)
- fixes #735, where fetch was interrupted, resulted in an empty response
This commit is contained in:
Ilya Kreymer 2024-12-31 13:52:12 -08:00 committed by GitHub
parent fb8ed18f82
commit d923e11436
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 90 additions and 47 deletions

View file

@ -18,7 +18,7 @@
"dependencies": {
"@novnc/novnc": "1.4.0",
"@webrecorder/wabac": "^2.20.7",
"browsertrix-behaviors": "^0.6.5",
"browsertrix-behaviors": "^0.6.6",
"client-zip": "^2.4.5",
"css-selector-parser": "^3.0.5",
"fetch-socks": "^1.3.0",
@ -37,7 +37,7 @@
"tsc": "^2.0.4",
"undici": "^6.18.2",
"uuid": "8.3.2",
"warcio": "^2.4.2",
"warcio": "^2.4.3",
"ws": "^7.4.4",
"yargs": "^17.7.2"
},
@ -67,7 +67,7 @@
},
"resolutions": {
"wrap-ansi": "7.0.0",
"warcio": "^2.4.2",
"warcio": "^2.4.3",
"@novnc/novnc": "1.4.0"
}
}