jerryscript-project / iotjs

Platform for Internet of Things with JavaScript http://www.iotjs.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid response when large file piped to http response

lauriro opened this issue · comments

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 02599f3
build: ./tools/build.py --jerry-profile=es2015-subset

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