This still hasn't been fixed. Any news on the situation?
Op woensdag 5 mei 2010 20:38:54 UTC+7 schreef Tautologistics het volgende:
>
> Just an FYI about this quirk I just encountered. I close the
> connection is the server response is bigger than I want but was not
> getting an "end" event on the response. Here's the workaround:
>
> request.addListener('response', function (response) {
> sys.debug("RESPONSE");
>
> response.setEncoding('utf8');
> var responseAborted = false;
> var contentLength = response.headers["content-length"] ||
> 0;
> function abort () {
> if (!responseAborted) {
> response.connection.addListener("close",
> function () {
> sys.debug("CLOSE");
> response.emit("end", true);
> });
> responseAborted = true;
> response.connection.end();
> }
> }
>
> if (contentLength > 1024) {
> abort();
> } else {
> var contentLengthRecv = 0;
> response.addListener('data', function (chunk) {
> contentLengthRecv += chunk.length;
> sys.debug("DATA " + contentLength + ":" +
> contentLengthRecv);
> if (contentLengthRecv > 1024) {
> abort();
> }
> });
> }
> response.addListener('end', function (forceClosed) {
> sys.debug("END");
> });
> });
> request.end();
>
> --
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To post to this group, send email to [email protected] <javascript:>.
>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en.
>
>
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en