Merge pull request #9465 from Snuffleupagus/streams-unify-disableRange-contentLength
Attempt to unify the `disableRange`/`contentLength` handling in the various network streams
This commit is contained in:
commit
b3557483cb
@ -74,14 +74,14 @@ class PDFFetchStreamReader {
|
||||
this._withCredentials = source.withCredentials;
|
||||
this._contentLength = source.length;
|
||||
this._headersCapability = createPromiseCapability();
|
||||
this._disableRange = source.disableRange;
|
||||
this._disableRange = source.disableRange || false;
|
||||
this._rangeChunkSize = source.rangeChunkSize;
|
||||
if (!this._rangeChunkSize && !this._disableRange) {
|
||||
this._disableRange = true;
|
||||
}
|
||||
|
||||
this._isRangeSupported = !source.disableRange;
|
||||
this._isStreamingSupported = !source.disableStream;
|
||||
this._isRangeSupported = !source.disableRange;
|
||||
|
||||
this._headers = new Headers();
|
||||
for (let property in this._stream.httpHeaders) {
|
||||
@ -112,8 +112,9 @@ class PDFFetchStreamReader {
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
|
||||
this._contentLength = suggestedLength;
|
||||
this._isRangeSupported = allowRangeRequests;
|
||||
// Setting right content length.
|
||||
this._contentLength = suggestedLength || this._contentLength;
|
||||
|
||||
this._filename = extractFilenameFromHeader(getResponseHeader);
|
||||
|
||||
|
@ -355,7 +355,6 @@ PDFNetworkStreamFullRequestReader.prototype = {
|
||||
const getResponseHeader = (name) => {
|
||||
return fullRequestXhr.getResponseHeader(name);
|
||||
};
|
||||
|
||||
let { allowRangeRequests, suggestedLength, } =
|
||||
validateRangeRequestCapabilities({
|
||||
getResponseHeader,
|
||||
@ -364,12 +363,11 @@ PDFNetworkStreamFullRequestReader.prototype = {
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
|
||||
// Setting right content length.
|
||||
this._contentLength = suggestedLength || this._contentLength;
|
||||
|
||||
if (allowRangeRequests) {
|
||||
this._isRangeSupported = true;
|
||||
}
|
||||
// Setting right content length.
|
||||
this._contentLength = suggestedLength || this._contentLength;
|
||||
|
||||
this._filename = extractFilenameFromHeader(getResponseHeader);
|
||||
|
||||
|
@ -304,11 +304,9 @@ class PDFNodeStreamFullReader extends BaseFullReader {
|
||||
disableRange: this._disableRange,
|
||||
});
|
||||
|
||||
if (allowRangeRequests) {
|
||||
this._isRangeSupported = true;
|
||||
}
|
||||
this._isRangeSupported = allowRangeRequests;
|
||||
// Setting right content length.
|
||||
this._contentLength = suggestedLength;
|
||||
this._contentLength = suggestedLength || this._contentLength;
|
||||
|
||||
this._filename = extractFilenameFromHeader(getResponseHeader);
|
||||
};
|
||||
|
@ -28,8 +28,8 @@ var PDFDataTransportStream = (function PDFDataTransportStreamClosure() {
|
||||
}
|
||||
|
||||
this._pdfDataRangeTransport = pdfDataRangeTransport;
|
||||
this._isRangeSupported = !(params.disableRange);
|
||||
this._isStreamingSupported = !(params.disableStream);
|
||||
this._isStreamingSupported = !params.disableStream;
|
||||
this._isRangeSupported = !params.disableRange;
|
||||
this._contentLength = params.length;
|
||||
|
||||
this._fullRequestReader = null;
|
||||
|
Loading…
Reference in New Issue
Block a user