To reproduce
-
Create or link a large (10s of MB) binary file to /tmp/big.zip.
-
Run
-
Fetch the data with curl:
curl -O http://localhost:8080
==> fails in chunky parser at random points during download
-
Fetch the data with wget:
==> works
(Chrome fails mid-stream similarly to curl. It may use libcurl.)
Replied on the Google Groups thread: http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919
To be clear, cat isn't the point. I would not have used spawn('cat') just to read a file. That's just the simplest subprocess to use in this example. In reality I'm generating compressed streams (e.g. zip).
And no, I'm not setting content length, because it is not known ahead of time. That is intentional. In my understanding it is optional, and only required as a hint to aid e.g. download manager GUIs in displaying useful progress bars, not for the correctness of the actual transaction.