Following your advice, I removed the Content-Length header. The file size of the downloaded zip increased. An error message indicated that I should check the binmode of the transferred file, so I changed that to the UTF-8 version. My file size increased again.

Clearly, there is still some issue with the proper transfer from server to client.

After learning this, I decided to retry the download a few times to see if the file sizes would be the same. I found the following issues, and made notes of them:

#File size, (download attempt), unzip's reported missing bytes
#4,569,935 (1) missing 942842225
#4,569,765 (2) missing 942842396
#4,571,674 (3) missing 942840486
#4,569,765 (4) missing 942842396
#4,571,656 (5) missing 942840504

As the data indicates, only the second and fourth attempts resulted in identical numbers. Note that no change to the code was made between any of the attempts.

With errata like this, I'm not sure where to look next.

Here's a current error message, for comparison.

$ unzip -v DB_ExportFile_2019-11-14.txt\(4\).zip 
Archive:  DB_ExportFile_2019-11-14.txt(4).zip

caution:  zipfile comment truncated
error DB_ExportFile_2019-11-14.txt(4).zip:  missing 942842396 bytes in zipfile
  (attempting to process anyway)
error DB_ExportFile_2019-11-14.txt(4).zip:  start of central directory not found;
  zipfile corrupt.
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

It should also be noted that the original text file, before being zipped, weighs in at about 22 MB -- far short of the number of supposed missing bytes indicated in the error message.


In reply to Re^2: Correct Perl settings for sending zipfile to browser by Anonymous Monk
in thread Correct Perl settings for sending zipfile to browser by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.