diff --git a/src/lib/constants.js b/src/lib/constants.js index 7874af5e8..f29849b44 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -86,10 +86,6 @@ export const X_REP_HINT_IMAGE = '[jpg?dimensions=2048x2048,png?dimensions=2048x2 export const X_REP_HINT_VIDEO_DASH = '[dash,mp4][filmstrip]'; export const X_REP_HINT_VIDEO_MP4 = '[mp4]'; -// X-Box-Accept-Encoding Header for requesting non-gzipped representation -export const X_BOX_ACCEPT_ENCODING_HEADER = 'x-box-accept-encoding'; -export const X_BOX_ACCEPT_ENCODING_IDENTITY = 'identity'; - export const PDFJS_CSS_UNITS = 96.0 / 72.0; // Should match CSS_UNITS in pdf_viewer.js export const PDFJS_MAX_AUTO_SCALE = 1.25; // Should match MAX_AUTO_SCALE in pdf_viewer.js export const PDFJS_WIDTH_PADDING_PX = 40; // Should match SCROLLBAR_PADDING in pdf_viewer.js diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index e550e951d..b991b3d8f 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -17,9 +17,7 @@ import { DOC_STATIC_ASSETS_VERSION, PERMISSION_DOWNLOAD, PRELOAD_REP_NAME, - STATUS_SUCCESS, - X_BOX_ACCEPT_ENCODING_HEADER, - X_BOX_ACCEPT_ENCODING_IDENTITY + STATUS_SUCCESS } from '../../constants'; import { checkPermission, getRepresentation } from '../../file'; import { get, createAssetUrlCreator, getMidpoint, getDistance, getClosestPageToPinch } from '../../util'; @@ -585,12 +583,6 @@ class DocBaseViewer extends BaseViewer { }; } - // If range requests are enabled, request the non-gzip compressed version of the representation - if (!PDFJS.disableRange) { - docInitParams.httpHeaders = docInitParams.httpHeaders || {}; - docInitParams.httpHeaders[X_BOX_ACCEPT_ENCODING_HEADER] = X_BOX_ACCEPT_ENCODING_IDENTITY; - } - // Start timing document load this.startLoadTimer(); diff --git a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js index de9cdfc71..68dd0059e 100644 --- a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js +++ b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js @@ -16,9 +16,7 @@ import { PERMISSION_DOWNLOAD, STATUS_ERROR, STATUS_PENDING, - STATUS_SUCCESS, - X_BOX_ACCEPT_ENCODING_HEADER, - X_BOX_ACCEPT_ENCODING_IDENTITY + STATUS_SUCCESS } from '../../../constants'; import { ICON_PRINT_CHECKMARK } from '../../../icons/icons'; @@ -922,30 +920,6 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { }); }); - it('should set a x-box-accept-encoding header when range requests are enabled', () => { - docBase.options.location = { - locale: 'en-GB' - }; - const isDisbled = PDFJS.disableRange; - sandbox.stub(Browser, 'isIOS').returns(false); - sandbox.stub(PDFJS, 'getDocument').returns(Promise.resolve({})); - - PDFJS.disableRange = false; - - return docBase.initViewer('').then(() => { - expect(PDFJS.getDocument).to.be.calledWith({ - url: '', - rangeChunkSize: 524288, - httpHeaders: { - [X_BOX_ACCEPT_ENCODING_HEADER]: X_BOX_ACCEPT_ENCODING_IDENTITY - } - }); - - // Reset to original value - PDFJS.disableRange = isDisbled; - }); - }); - it('should resolve the loading task and set the document/viewer', () => { const doc = { url: 'url'