stream-utils / raw-body

Get and validate the raw body of a readable stream

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to add a timeout option

dougwilson opened this issue · comments

It's all well and good to just wait an indefinite time for a stream to complete reading, but typically when dealing with HTTP (like this module), you probably need some kind of timeout. Right now, you can infact kind of do this if you do a bunch of work to wrap around a timer and manually emit an error event on req, for example, but this is lame.

I think there should be an optional timeout (defaults to Infinity like now). What I'm not sure of yet is how the timeout would specifically work: is the timeout a total time taken timer or an inactivity timer? Both have pros and cons.

Looking at the documentation for http://httpd.apache.org/docs/2.2/mod/mod_reqtimeout.html can provide some ideas for what could be done here.

I'm also experimenting with putting this as a separate module, and will see what I come up with in a few days :)

@dougwilson Any progress on this? We are currently seeing this issue in our API.

Hi @Klvtz I don't have a solution that is open-source at this time, unfortunately.

@dougwilson You mentioned that there's no open-source solution for this. Did you find any proprietary solution? Maybe we can reverse-engineer it.