Pdf-Viewer: [BUG] Missing Content-Length for PDF behind Cloudflare

šŸ“ Describe the Bug

PDF behind Cloudflare does not work because Content-Length is not available. Library logs java.io.IOException: Incomplete download.

Cloudflare removes information about Content-Length when Accept-Encoding have gzip value. Maybe you can remove gzip value from that header?

šŸ“– Library Version

  • Since 2.1.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I’m in a similar situation where the content length is unavailable from my file server. Is there another way to check that the file download is complete apart from the content length here https://github.com/afreakyelf/Pdf-Viewer/blob/a2f11aa01fbfa4bdfaee5c7789c6504acb6c519f/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfDownloader.kt#L107?