Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../assets/pdf/build
File: script.js
};
[14000] Fix | Delete
const length = parseInt(getResponseHeader("Content-Length"), 10);
[14001] Fix | Delete
if (!Number.isInteger(length)) {
[14002] Fix | Delete
return returnValues;
[14003] Fix | Delete
}
[14004] Fix | Delete
returnValues.suggestedLength = length;
[14005] Fix | Delete
if (length <= 2 * rangeChunkSize) {
[14006] Fix | Delete
return returnValues;
[14007] Fix | Delete
}
[14008] Fix | Delete
if (disableRange || !isHttp) {
[14009] Fix | Delete
return returnValues;
[14010] Fix | Delete
}
[14011] Fix | Delete
if (getResponseHeader("Accept-Ranges") !== "bytes") {
[14012] Fix | Delete
return returnValues;
[14013] Fix | Delete
}
[14014] Fix | Delete
const contentEncoding = getResponseHeader("Content-Encoding") || "identity";
[14015] Fix | Delete
if (contentEncoding !== "identity") {
[14016] Fix | Delete
return returnValues;
[14017] Fix | Delete
}
[14018] Fix | Delete
returnValues.allowRangeRequests = true;
[14019] Fix | Delete
return returnValues;
[14020] Fix | Delete
}
[14021] Fix | Delete
function extractFilenameFromHeader(getResponseHeader) {
[14022] Fix | Delete
const contentDisposition = getResponseHeader("Content-Disposition");
[14023] Fix | Delete
if (contentDisposition) {
[14024] Fix | Delete
let filename = getFilenameFromContentDispositionHeader(contentDisposition);
[14025] Fix | Delete
if (filename.includes("%")) {
[14026] Fix | Delete
try {
[14027] Fix | Delete
filename = decodeURIComponent(filename);
[14028] Fix | Delete
} catch {}
[14029] Fix | Delete
}
[14030] Fix | Delete
if (isPdfFile(filename)) {
[14031] Fix | Delete
return filename;
[14032] Fix | Delete
}
[14033] Fix | Delete
}
[14034] Fix | Delete
return null;
[14035] Fix | Delete
}
[14036] Fix | Delete
function createResponseStatusError(status, url) {
[14037] Fix | Delete
if (status === 404 || status === 0 && url.startsWith("file:")) {
[14038] Fix | Delete
return new MissingPDFException('Missing PDF "' + url + '".');
[14039] Fix | Delete
}
[14040] Fix | Delete
return new UnexpectedResponseException(`Unexpected server response (${status}) while retrieving PDF "${url}".`, status);
[14041] Fix | Delete
}
[14042] Fix | Delete
function validateResponseStatus(status) {
[14043] Fix | Delete
return status === 200 || status === 206;
[14044] Fix | Delete
}
[14045] Fix | Delete
[14046] Fix | Delete
;// CONCATENATED MODULE: ./src/display/fetch_stream.js
[14047] Fix | Delete
[14048] Fix | Delete
[14049] Fix | Delete
[14050] Fix | Delete
[14051] Fix | Delete
[14052] Fix | Delete
[14053] Fix | Delete
[14054] Fix | Delete
[14055] Fix | Delete
[14056] Fix | Delete
[14057] Fix | Delete
function createFetchOptions(headers, withCredentials, abortController) {
[14058] Fix | Delete
return {
[14059] Fix | Delete
method: "GET",
[14060] Fix | Delete
headers,
[14061] Fix | Delete
signal: abortController.signal,
[14062] Fix | Delete
mode: "cors",
[14063] Fix | Delete
credentials: withCredentials ? "include" : "same-origin",
[14064] Fix | Delete
redirect: "follow"
[14065] Fix | Delete
};
[14066] Fix | Delete
}
[14067] Fix | Delete
function createHeaders(httpHeaders) {
[14068] Fix | Delete
const headers = new Headers();
[14069] Fix | Delete
for (const property in httpHeaders) {
[14070] Fix | Delete
const value = httpHeaders[property];
[14071] Fix | Delete
if (value === undefined) {
[14072] Fix | Delete
continue;
[14073] Fix | Delete
}
[14074] Fix | Delete
headers.append(property, value);
[14075] Fix | Delete
}
[14076] Fix | Delete
return headers;
[14077] Fix | Delete
}
[14078] Fix | Delete
function getArrayBuffer(val) {
[14079] Fix | Delete
if (val instanceof Uint8Array) {
[14080] Fix | Delete
return val.buffer;
[14081] Fix | Delete
}
[14082] Fix | Delete
if (val instanceof ArrayBuffer) {
[14083] Fix | Delete
return val;
[14084] Fix | Delete
}
[14085] Fix | Delete
warn(`getArrayBuffer - unexpected data format: ${val}`);
[14086] Fix | Delete
return new Uint8Array(val).buffer;
[14087] Fix | Delete
}
[14088] Fix | Delete
class PDFFetchStream {
[14089] Fix | Delete
constructor(source) {
[14090] Fix | Delete
this.source = source;
[14091] Fix | Delete
this.isHttp = /^https?:/i.test(source.url);
[14092] Fix | Delete
this.httpHeaders = this.isHttp && source.httpHeaders || {};
[14093] Fix | Delete
this._fullRequestReader = null;
[14094] Fix | Delete
this._rangeRequestReaders = [];
[14095] Fix | Delete
}
[14096] Fix | Delete
get _progressiveDataLength() {
[14097] Fix | Delete
return this._fullRequestReader?._loaded ?? 0;
[14098] Fix | Delete
}
[14099] Fix | Delete
getFullReader() {
[14100] Fix | Delete
assert(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
[14101] Fix | Delete
this._fullRequestReader = new PDFFetchStreamReader(this);
[14102] Fix | Delete
return this._fullRequestReader;
[14103] Fix | Delete
}
[14104] Fix | Delete
getRangeReader(begin, end) {
[14105] Fix | Delete
if (end <= this._progressiveDataLength) {
[14106] Fix | Delete
return null;
[14107] Fix | Delete
}
[14108] Fix | Delete
const reader = new PDFFetchStreamRangeReader(this, begin, end);
[14109] Fix | Delete
this._rangeRequestReaders.push(reader);
[14110] Fix | Delete
return reader;
[14111] Fix | Delete
}
[14112] Fix | Delete
cancelAllRequests(reason) {
[14113] Fix | Delete
this._fullRequestReader?.cancel(reason);
[14114] Fix | Delete
for (const reader of this._rangeRequestReaders.slice(0)) {
[14115] Fix | Delete
reader.cancel(reason);
[14116] Fix | Delete
}
[14117] Fix | Delete
}
[14118] Fix | Delete
}
[14119] Fix | Delete
class PDFFetchStreamReader {
[14120] Fix | Delete
constructor(stream) {
[14121] Fix | Delete
this._stream = stream;
[14122] Fix | Delete
this._reader = null;
[14123] Fix | Delete
this._loaded = 0;
[14124] Fix | Delete
this._filename = null;
[14125] Fix | Delete
const source = stream.source;
[14126] Fix | Delete
this._withCredentials = source.withCredentials || false;
[14127] Fix | Delete
this._contentLength = source.length;
[14128] Fix | Delete
this._headersCapability = Promise.withResolvers();
[14129] Fix | Delete
this._disableRange = source.disableRange || false;
[14130] Fix | Delete
this._rangeChunkSize = source.rangeChunkSize;
[14131] Fix | Delete
if (!this._rangeChunkSize && !this._disableRange) {
[14132] Fix | Delete
this._disableRange = true;
[14133] Fix | Delete
}
[14134] Fix | Delete
this._abortController = new AbortController();
[14135] Fix | Delete
this._isStreamingSupported = !source.disableStream;
[14136] Fix | Delete
this._isRangeSupported = !source.disableRange;
[14137] Fix | Delete
this._headers = createHeaders(this._stream.httpHeaders);
[14138] Fix | Delete
const url = source.url;
[14139] Fix | Delete
fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {
[14140] Fix | Delete
if (!validateResponseStatus(response.status)) {
[14141] Fix | Delete
throw createResponseStatusError(response.status, url);
[14142] Fix | Delete
}
[14143] Fix | Delete
this._reader = response.body.getReader();
[14144] Fix | Delete
this._headersCapability.resolve();
[14145] Fix | Delete
const getResponseHeader = name => response.headers.get(name);
[14146] Fix | Delete
const {
[14147] Fix | Delete
allowRangeRequests,
[14148] Fix | Delete
suggestedLength
[14149] Fix | Delete
} = validateRangeRequestCapabilities({
[14150] Fix | Delete
getResponseHeader,
[14151] Fix | Delete
isHttp: this._stream.isHttp,
[14152] Fix | Delete
rangeChunkSize: this._rangeChunkSize,
[14153] Fix | Delete
disableRange: this._disableRange
[14154] Fix | Delete
});
[14155] Fix | Delete
this._isRangeSupported = allowRangeRequests;
[14156] Fix | Delete
this._contentLength = suggestedLength || this._contentLength;
[14157] Fix | Delete
this._filename = extractFilenameFromHeader(getResponseHeader);
[14158] Fix | Delete
if (!this._isStreamingSupported && this._isRangeSupported) {
[14159] Fix | Delete
this.cancel(new AbortException("Streaming is disabled."));
[14160] Fix | Delete
}
[14161] Fix | Delete
}).catch(this._headersCapability.reject);
[14162] Fix | Delete
this.onProgress = null;
[14163] Fix | Delete
}
[14164] Fix | Delete
get headersReady() {
[14165] Fix | Delete
return this._headersCapability.promise;
[14166] Fix | Delete
}
[14167] Fix | Delete
get filename() {
[14168] Fix | Delete
return this._filename;
[14169] Fix | Delete
}
[14170] Fix | Delete
get contentLength() {
[14171] Fix | Delete
return this._contentLength;
[14172] Fix | Delete
}
[14173] Fix | Delete
get isRangeSupported() {
[14174] Fix | Delete
return this._isRangeSupported;
[14175] Fix | Delete
}
[14176] Fix | Delete
get isStreamingSupported() {
[14177] Fix | Delete
return this._isStreamingSupported;
[14178] Fix | Delete
}
[14179] Fix | Delete
async read() {
[14180] Fix | Delete
await this._headersCapability.promise;
[14181] Fix | Delete
const {
[14182] Fix | Delete
value,
[14183] Fix | Delete
done
[14184] Fix | Delete
} = await this._reader.read();
[14185] Fix | Delete
if (done) {
[14186] Fix | Delete
return {
[14187] Fix | Delete
value,
[14188] Fix | Delete
done
[14189] Fix | Delete
};
[14190] Fix | Delete
}
[14191] Fix | Delete
this._loaded += value.byteLength;
[14192] Fix | Delete
this.onProgress?.({
[14193] Fix | Delete
loaded: this._loaded,
[14194] Fix | Delete
total: this._contentLength
[14195] Fix | Delete
});
[14196] Fix | Delete
return {
[14197] Fix | Delete
value: getArrayBuffer(value),
[14198] Fix | Delete
done: false
[14199] Fix | Delete
};
[14200] Fix | Delete
}
[14201] Fix | Delete
cancel(reason) {
[14202] Fix | Delete
this._reader?.cancel(reason);
[14203] Fix | Delete
this._abortController.abort();
[14204] Fix | Delete
}
[14205] Fix | Delete
}
[14206] Fix | Delete
class PDFFetchStreamRangeReader {
[14207] Fix | Delete
constructor(stream, begin, end) {
[14208] Fix | Delete
this._stream = stream;
[14209] Fix | Delete
this._reader = null;
[14210] Fix | Delete
this._loaded = 0;
[14211] Fix | Delete
const source = stream.source;
[14212] Fix | Delete
this._withCredentials = source.withCredentials || false;
[14213] Fix | Delete
this._readCapability = Promise.withResolvers();
[14214] Fix | Delete
this._isStreamingSupported = !source.disableStream;
[14215] Fix | Delete
this._abortController = new AbortController();
[14216] Fix | Delete
this._headers = createHeaders(this._stream.httpHeaders);
[14217] Fix | Delete
this._headers.append("Range", `bytes=${begin}-${end - 1}`);
[14218] Fix | Delete
const url = source.url;
[14219] Fix | Delete
fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {
[14220] Fix | Delete
if (!validateResponseStatus(response.status)) {
[14221] Fix | Delete
throw createResponseStatusError(response.status, url);
[14222] Fix | Delete
}
[14223] Fix | Delete
this._readCapability.resolve();
[14224] Fix | Delete
this._reader = response.body.getReader();
[14225] Fix | Delete
}).catch(this._readCapability.reject);
[14226] Fix | Delete
this.onProgress = null;
[14227] Fix | Delete
}
[14228] Fix | Delete
get isStreamingSupported() {
[14229] Fix | Delete
return this._isStreamingSupported;
[14230] Fix | Delete
}
[14231] Fix | Delete
async read() {
[14232] Fix | Delete
await this._readCapability.promise;
[14233] Fix | Delete
const {
[14234] Fix | Delete
value,
[14235] Fix | Delete
done
[14236] Fix | Delete
} = await this._reader.read();
[14237] Fix | Delete
if (done) {
[14238] Fix | Delete
return {
[14239] Fix | Delete
value,
[14240] Fix | Delete
done
[14241] Fix | Delete
};
[14242] Fix | Delete
}
[14243] Fix | Delete
this._loaded += value.byteLength;
[14244] Fix | Delete
this.onProgress?.({
[14245] Fix | Delete
loaded: this._loaded
[14246] Fix | Delete
});
[14247] Fix | Delete
return {
[14248] Fix | Delete
value: getArrayBuffer(value),
[14249] Fix | Delete
done: false
[14250] Fix | Delete
};
[14251] Fix | Delete
}
[14252] Fix | Delete
cancel(reason) {
[14253] Fix | Delete
this._reader?.cancel(reason);
[14254] Fix | Delete
this._abortController.abort();
[14255] Fix | Delete
}
[14256] Fix | Delete
}
[14257] Fix | Delete
[14258] Fix | Delete
;// CONCATENATED MODULE: ./src/display/network.js
[14259] Fix | Delete
[14260] Fix | Delete
[14261] Fix | Delete
[14262] Fix | Delete
[14263] Fix | Delete
const OK_RESPONSE = 200;
[14264] Fix | Delete
const PARTIAL_CONTENT_RESPONSE = 206;
[14265] Fix | Delete
function network_getArrayBuffer(xhr) {
[14266] Fix | Delete
const data = xhr.response;
[14267] Fix | Delete
if (typeof data !== "string") {
[14268] Fix | Delete
return data;
[14269] Fix | Delete
}
[14270] Fix | Delete
return stringToBytes(data).buffer;
[14271] Fix | Delete
}
[14272] Fix | Delete
class NetworkManager {
[14273] Fix | Delete
constructor(url, args = {}) {
[14274] Fix | Delete
this.url = url;
[14275] Fix | Delete
this.isHttp = /^https?:/i.test(url);
[14276] Fix | Delete
this.httpHeaders = this.isHttp && args.httpHeaders || Object.create(null);
[14277] Fix | Delete
this.withCredentials = args.withCredentials || false;
[14278] Fix | Delete
this.currXhrId = 0;
[14279] Fix | Delete
this.pendingRequests = Object.create(null);
[14280] Fix | Delete
}
[14281] Fix | Delete
requestRange(begin, end, listeners) {
[14282] Fix | Delete
const args = {
[14283] Fix | Delete
begin,
[14284] Fix | Delete
end
[14285] Fix | Delete
};
[14286] Fix | Delete
for (const prop in listeners) {
[14287] Fix | Delete
args[prop] = listeners[prop];
[14288] Fix | Delete
}
[14289] Fix | Delete
return this.request(args);
[14290] Fix | Delete
}
[14291] Fix | Delete
requestFull(listeners) {
[14292] Fix | Delete
return this.request(listeners);
[14293] Fix | Delete
}
[14294] Fix | Delete
request(args) {
[14295] Fix | Delete
const xhr = new XMLHttpRequest();
[14296] Fix | Delete
const xhrId = this.currXhrId++;
[14297] Fix | Delete
const pendingRequest = this.pendingRequests[xhrId] = {
[14298] Fix | Delete
xhr
[14299] Fix | Delete
};
[14300] Fix | Delete
xhr.open("GET", this.url);
[14301] Fix | Delete
xhr.withCredentials = this.withCredentials;
[14302] Fix | Delete
for (const property in this.httpHeaders) {
[14303] Fix | Delete
const value = this.httpHeaders[property];
[14304] Fix | Delete
if (value === undefined) {
[14305] Fix | Delete
continue;
[14306] Fix | Delete
}
[14307] Fix | Delete
xhr.setRequestHeader(property, value);
[14308] Fix | Delete
}
[14309] Fix | Delete
if (this.isHttp && "begin" in args && "end" in args) {
[14310] Fix | Delete
xhr.setRequestHeader("Range", `bytes=${args.begin}-${args.end - 1}`);
[14311] Fix | Delete
pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;
[14312] Fix | Delete
} else {
[14313] Fix | Delete
pendingRequest.expectedStatus = OK_RESPONSE;
[14314] Fix | Delete
}
[14315] Fix | Delete
xhr.responseType = "arraybuffer";
[14316] Fix | Delete
if (args.onError) {
[14317] Fix | Delete
xhr.onerror = function (evt) {
[14318] Fix | Delete
args.onError(xhr.status);
[14319] Fix | Delete
};
[14320] Fix | Delete
}
[14321] Fix | Delete
xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
[14322] Fix | Delete
xhr.onprogress = this.onProgress.bind(this, xhrId);
[14323] Fix | Delete
pendingRequest.onHeadersReceived = args.onHeadersReceived;
[14324] Fix | Delete
pendingRequest.onDone = args.onDone;
[14325] Fix | Delete
pendingRequest.onError = args.onError;
[14326] Fix | Delete
pendingRequest.onProgress = args.onProgress;
[14327] Fix | Delete
xhr.send(null);
[14328] Fix | Delete
return xhrId;
[14329] Fix | Delete
}
[14330] Fix | Delete
onProgress(xhrId, evt) {
[14331] Fix | Delete
const pendingRequest = this.pendingRequests[xhrId];
[14332] Fix | Delete
if (!pendingRequest) {
[14333] Fix | Delete
return;
[14334] Fix | Delete
}
[14335] Fix | Delete
pendingRequest.onProgress?.(evt);
[14336] Fix | Delete
}
[14337] Fix | Delete
onStateChange(xhrId, evt) {
[14338] Fix | Delete
const pendingRequest = this.pendingRequests[xhrId];
[14339] Fix | Delete
if (!pendingRequest) {
[14340] Fix | Delete
return;
[14341] Fix | Delete
}
[14342] Fix | Delete
const xhr = pendingRequest.xhr;
[14343] Fix | Delete
if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
[14344] Fix | Delete
pendingRequest.onHeadersReceived();
[14345] Fix | Delete
delete pendingRequest.onHeadersReceived;
[14346] Fix | Delete
}
[14347] Fix | Delete
if (xhr.readyState !== 4) {
[14348] Fix | Delete
return;
[14349] Fix | Delete
}
[14350] Fix | Delete
if (!(xhrId in this.pendingRequests)) {
[14351] Fix | Delete
return;
[14352] Fix | Delete
}
[14353] Fix | Delete
delete this.pendingRequests[xhrId];
[14354] Fix | Delete
if (xhr.status === 0 && this.isHttp) {
[14355] Fix | Delete
pendingRequest.onError?.(xhr.status);
[14356] Fix | Delete
return;
[14357] Fix | Delete
}
[14358] Fix | Delete
const xhrStatus = xhr.status || OK_RESPONSE;
[14359] Fix | Delete
const ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
[14360] Fix | Delete
if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
[14361] Fix | Delete
pendingRequest.onError?.(xhr.status);
[14362] Fix | Delete
return;
[14363] Fix | Delete
}
[14364] Fix | Delete
const chunk = network_getArrayBuffer(xhr);
[14365] Fix | Delete
if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
[14366] Fix | Delete
const rangeHeader = xhr.getResponseHeader("Content-Range");
[14367] Fix | Delete
const matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
[14368] Fix | Delete
pendingRequest.onDone({
[14369] Fix | Delete
begin: parseInt(matches[1], 10),
[14370] Fix | Delete
chunk
[14371] Fix | Delete
});
[14372] Fix | Delete
} else if (chunk) {
[14373] Fix | Delete
pendingRequest.onDone({
[14374] Fix | Delete
begin: 0,
[14375] Fix | Delete
chunk
[14376] Fix | Delete
});
[14377] Fix | Delete
} else {
[14378] Fix | Delete
pendingRequest.onError?.(xhr.status);
[14379] Fix | Delete
}
[14380] Fix | Delete
}
[14381] Fix | Delete
getRequestXhr(xhrId) {
[14382] Fix | Delete
return this.pendingRequests[xhrId].xhr;
[14383] Fix | Delete
}
[14384] Fix | Delete
isPendingRequest(xhrId) {
[14385] Fix | Delete
return xhrId in this.pendingRequests;
[14386] Fix | Delete
}
[14387] Fix | Delete
abortRequest(xhrId) {
[14388] Fix | Delete
const xhr = this.pendingRequests[xhrId].xhr;
[14389] Fix | Delete
delete this.pendingRequests[xhrId];
[14390] Fix | Delete
xhr.abort();
[14391] Fix | Delete
}
[14392] Fix | Delete
}
[14393] Fix | Delete
class PDFNetworkStream {
[14394] Fix | Delete
constructor(source) {
[14395] Fix | Delete
this._source = source;
[14396] Fix | Delete
this._manager = new NetworkManager(source.url, {
[14397] Fix | Delete
httpHeaders: source.httpHeaders,
[14398] Fix | Delete
withCredentials: source.withCredentials
[14399] Fix | Delete
});
[14400] Fix | Delete
this._rangeChunkSize = source.rangeChunkSize;
[14401] Fix | Delete
this._fullRequestReader = null;
[14402] Fix | Delete
this._rangeRequestReaders = [];
[14403] Fix | Delete
}
[14404] Fix | Delete
_onRangeRequestReaderClosed(reader) {
[14405] Fix | Delete
const i = this._rangeRequestReaders.indexOf(reader);
[14406] Fix | Delete
if (i >= 0) {
[14407] Fix | Delete
this._rangeRequestReaders.splice(i, 1);
[14408] Fix | Delete
}
[14409] Fix | Delete
}
[14410] Fix | Delete
getFullReader() {
[14411] Fix | Delete
assert(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once.");
[14412] Fix | Delete
this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);
[14413] Fix | Delete
return this._fullRequestReader;
[14414] Fix | Delete
}
[14415] Fix | Delete
getRangeReader(begin, end) {
[14416] Fix | Delete
const reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
[14417] Fix | Delete
reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
[14418] Fix | Delete
this._rangeRequestReaders.push(reader);
[14419] Fix | Delete
return reader;
[14420] Fix | Delete
}
[14421] Fix | Delete
cancelAllRequests(reason) {
[14422] Fix | Delete
this._fullRequestReader?.cancel(reason);
[14423] Fix | Delete
for (const reader of this._rangeRequestReaders.slice(0)) {
[14424] Fix | Delete
reader.cancel(reason);
[14425] Fix | Delete
}
[14426] Fix | Delete
}
[14427] Fix | Delete
}
[14428] Fix | Delete
class PDFNetworkStreamFullRequestReader {
[14429] Fix | Delete
constructor(manager, source) {
[14430] Fix | Delete
this._manager = manager;
[14431] Fix | Delete
const args = {
[14432] Fix | Delete
onHeadersReceived: this._onHeadersReceived.bind(this),
[14433] Fix | Delete
onDone: this._onDone.bind(this),
[14434] Fix | Delete
onError: this._onError.bind(this),
[14435] Fix | Delete
onProgress: this._onProgress.bind(this)
[14436] Fix | Delete
};
[14437] Fix | Delete
this._url = source.url;
[14438] Fix | Delete
this._fullRequestId = manager.requestFull(args);
[14439] Fix | Delete
this._headersReceivedCapability = Promise.withResolvers();
[14440] Fix | Delete
this._disableRange = source.disableRange || false;
[14441] Fix | Delete
this._contentLength = source.length;
[14442] Fix | Delete
this._rangeChunkSize = source.rangeChunkSize;
[14443] Fix | Delete
if (!this._rangeChunkSize && !this._disableRange) {
[14444] Fix | Delete
this._disableRange = true;
[14445] Fix | Delete
}
[14446] Fix | Delete
this._isStreamingSupported = false;
[14447] Fix | Delete
this._isRangeSupported = false;
[14448] Fix | Delete
this._cachedChunks = [];
[14449] Fix | Delete
this._requests = [];
[14450] Fix | Delete
this._done = false;
[14451] Fix | Delete
this._storedError = undefined;
[14452] Fix | Delete
this._filename = null;
[14453] Fix | Delete
this.onProgress = null;
[14454] Fix | Delete
}
[14455] Fix | Delete
_onHeadersReceived() {
[14456] Fix | Delete
const fullRequestXhrId = this._fullRequestId;
[14457] Fix | Delete
const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
[14458] Fix | Delete
const getResponseHeader = name => fullRequestXhr.getResponseHeader(name);
[14459] Fix | Delete
const {
[14460] Fix | Delete
allowRangeRequests,
[14461] Fix | Delete
suggestedLength
[14462] Fix | Delete
} = validateRangeRequestCapabilities({
[14463] Fix | Delete
getResponseHeader,
[14464] Fix | Delete
isHttp: this._manager.isHttp,
[14465] Fix | Delete
rangeChunkSize: this._rangeChunkSize,
[14466] Fix | Delete
disableRange: this._disableRange
[14467] Fix | Delete
});
[14468] Fix | Delete
if (allowRangeRequests) {
[14469] Fix | Delete
this._isRangeSupported = true;
[14470] Fix | Delete
}
[14471] Fix | Delete
this._contentLength = suggestedLength || this._contentLength;
[14472] Fix | Delete
this._filename = extractFilenameFromHeader(getResponseHeader);
[14473] Fix | Delete
if (this._isRangeSupported) {
[14474] Fix | Delete
this._manager.abortRequest(fullRequestXhrId);
[14475] Fix | Delete
}
[14476] Fix | Delete
this._headersReceivedCapability.resolve();
[14477] Fix | Delete
}
[14478] Fix | Delete
_onDone(data) {
[14479] Fix | Delete
if (data) {
[14480] Fix | Delete
if (this._requests.length > 0) {
[14481] Fix | Delete
const requestCapability = this._requests.shift();
[14482] Fix | Delete
requestCapability.resolve({
[14483] Fix | Delete
value: data.chunk,
[14484] Fix | Delete
done: false
[14485] Fix | Delete
});
[14486] Fix | Delete
} else {
[14487] Fix | Delete
this._cachedChunks.push(data.chunk);
[14488] Fix | Delete
}
[14489] Fix | Delete
}
[14490] Fix | Delete
this._done = true;
[14491] Fix | Delete
if (this._cachedChunks.length > 0) {
[14492] Fix | Delete
return;
[14493] Fix | Delete
}
[14494] Fix | Delete
for (const requestCapability of this._requests) {
[14495] Fix | Delete
requestCapability.resolve({
[14496] Fix | Delete
value: undefined,
[14497] Fix | Delete
done: true
[14498] Fix | Delete
});
[14499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function