From 9d717f6bef74a1c555f891961faf0f32fd3cf82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Sat, 14 May 2011 16:06:32 +0200 Subject: [PATCH] Update http.ServerRequest docs The documentation for 'end' was wrong, and 'close' now has an `err` parameter. --- doc/api/http.markdown | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/api/http.markdown b/doc/api/http.markdown index e16d384b7a..f8da15106d 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -142,9 +142,29 @@ body chunk is a string. The body encoding is set with `function () { }` -Emitted exactly once for each message. No arguments. After -emitted no other events will be emitted on the request. +Emitted exactly once for each request. After that, no more `'data'` events +will be emitted on the request. +### Event: 'close' + +`function (err) { }` + +Indicates that the underlaying connection was terminated before +`response.end()` was called or able to flush. + +The `err` parameter is always present and indicates the reason for the timeout: + +`err.code === 'timeout'` indicates that the underlaying connection timed out. +This may happen because all incoming connections have a default timeout of 2 +minutes. + +`err.code === 'aborted'` means that the client has closed the underlaying +connection prematurely. + +Just like `'end'`, this event occurs only once per request, and no more `'data'` +events will fire afterwards. + +Note: `'close'` can fire after `'end'`, but not vice versa. ### request.method