in reply to Correct Perl settings for sending zipfile to browser
MacOS (darwin), Linux, and UNIX all have the same "\n" endings, whereas Windows/DOS uses "\r\n". Some code has been added to facilitate this variation.
Firstly, I'd get rid of that. Most Windows software will cope fine with "\n" line endings, including pretty much any spreadsheet or database software you're planning to import the tab-delimited file into. It's only a few really basic tools like Notepad that might not. Once you get your code working, if you decide you really need "\r\n" on Windows, then you can add that code back in, but for now, I'd suggest removing it. Simplifying your code will help you find where your bug is.
For now, I'd also suggest not generating a Content-Length HTTP header; perhaps it is somehow wrong and this is resulting in the browser truncating the file.
Once you've done that, compare the size of the file and the MD5 sum of the file at both the client and server end, and check they match. (Don't unlink the ZIP file at the end, so you can compare them.)
My gut feeling is that you're somehow appending some extra data at the end of the file when you send it. ZIP files are unusual in that they include header-like information at the end of the file instead of the start. This is a throwback to the days when people would write ZIP files that spanned multiple floppy disks, and the header information couldn't be written until the process was finished, so got written onto the last floppy disk. (When you unzipped the file, you needed to insert the last disk first so the header could be read, then start at the beginning and insert them all in order until you got to the last one again which would need to be read again for its non-header data.) So yeah, you've probably got some extra data like an error message or warning or even a few line break characters, at the end of your ZIP.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Correct Perl settings for sending zipfile to browser
by Anonymous Monk on Nov 15, 2019 at 01:22 UTC | |
by tobyink (Canon) on Nov 15, 2019 at 11:34 UTC |