jerryscript-project / iotjs

Platform for Internet of Things with JavaScript http://www.iotjs.net
Other
2.58k stars 440 forks source link

Invalid response when large file piped to http response #1974

Open lauriro opened 2 years ago

lauriro commented 2 years ago

When file larger than a kernel page is piped to http response, first page is missing and second page is sent twice, resulting a corrupt file.

minimal example: https://github.com/lauriro/iotjs-buffer-error-example commit 02599f35810cfa6ea5495bbc42194ed576b969de build: ./tools/build.py --jerry-profile=es2015-subset

lauriro commented 2 years ago

I created a fs.js in example repo.

$ iotjs fs.js 4kb.txt
Same true
...
$ node fs.js 4kb.txt
Same false

Iotjs reuses buffer and refill it before it is written to underlying system stream