Raise max buffer size for response body filtering

Related discussion:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/891
This commit is contained in:
Raymond Hill 2024-06-01 10:42:14 -04:00
parent ad77938f24
commit 82a3992896
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 24 additions and 30 deletions

View File

@ -19,29 +19,23 @@
Home: https://github.com/gorhill/uBlock
*/
/* globals browser */
'use strict';
/******************************************************************************/
import htmlFilteringEngine from './html-filtering.js';
import httpheaderFilteringEngine from './httpheader-filtering.js';
import logger from './logger.js';
import scriptletFilteringEngine from './scriptlet-filtering.js';
import staticNetFilteringEngine from './static-net-filtering.js';
import textEncode from './text-encode.js';
import µb from './background.js';
import * as sfp from './static-filtering-parser.js';
import * as fc from './filtering-context.js';
import { isNetworkURI } from './uri-utils.js';
import * as sfp from './static-filtering-parser.js';
import {
sessionFirewall,
sessionSwitches,
sessionURLFiltering,
} from './filtering-engines.js';
import htmlFilteringEngine from './html-filtering.js';
import httpheaderFilteringEngine from './httpheader-filtering.js';
import { isNetworkURI } from './uri-utils.js';
import logger from './logger.js';
import scriptletFilteringEngine from './scriptlet-filtering.js';
import staticNetFilteringEngine from './static-net-filtering.js';
import textEncode from './text-encode.js';
import µb from './background.js';
/******************************************************************************/
@ -695,7 +689,7 @@ const bodyFilterer = (( ) => {
'audio/x-mpegurl',
]);
const BINARY_TYPES = fc.FONT | fc.IMAGE | fc.MEDIA | fc.WEBSOCKET;
const MAX_BUFFER_LENGTH = 3 * 1024 * 1024;
const MAX_RESPONSE_BUFFER_LENGTH = 10 * 1024 * 1024;
let textDecoder, textEncoder;
let mime = '';
@ -811,7 +805,7 @@ const bodyFilterer = (( ) => {
buffer.set(session.buffer);
buffer.set(new Uint8Array(ev.data), session.buffer.byteLength);
session.buffer = buffer;
if ( session.buffer.length >= MAX_BUFFER_LENGTH ) {
if ( session.buffer.length >= MAX_RESPONSE_BUFFER_LENGTH ) {
sessions.delete(this);
this.write(session.buffer);
this.disconnect();