On Thu, Jul 26, 2012 at 7:39 PM, Felix Halim <felix.ha...@gmail.com> wrote: > Ah yes, you are right. > > The problem seems to be the connection is closed while the http-parser > keeps on reading. > I think libuv can improve the error message (rather than assertion error). > Assertion error is like something FATAL is violated, I thought it was a bug.
libuv in general asserts on programmer bugs (i.e. the programmer doing something he shouldn't), which seems to be the case here. > So, this brings the next question: when should we close the connection? > > https://gist.github.com/1249783 > > Line 63 closes the connection while the http-parser having a parse error. > This will cause the libuv assertion to trigger since the http-parser > is still reading. > The http-parser docs says you can stop the parser by returning 1 > (except on_header_complete). > But, the parse error happened during on_read() which returns void. > So we cannot tell the http-parser to stop parsing? (while in on_read function) Sure you can. Call uv_close() or uv_read_stop(). > Another way to work around is to never close the connection until the very > end. > But this is going to be wasting a bit more resources. > > One other concern is that if the Content-Length of the POST request is > bigger than the actual length of the body, > then the server will keep on waiting the last bytes. > Is there a timeout mechanism in libuv to force close the connection > during parsing? Start a timer and close the connection when it expires. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en