Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix bug where http response.readable was never set to false

Closes GH-867.
  • Loading branch information...
commit 83727a4c86e7e7fe1b698bb22b8ab2a7f119d67d 1 parent 0f47f63
@abram abram authored ry committed
Showing with 20 additions and 0 deletions.
  1. +1 −0  lib/http.js
  2. +19 −0 test/simple/test-http-response-readable.js
View
1  lib/http.js
@@ -129,6 +129,7 @@ var parsers = new FreeList('parsers', 1000, function() {
}
if (!parser.incoming.upgrade) {
// For upgraded connections, also emit this after parser.execute
+ parser.incoming.readable = false;
parser.incoming.emit('end');
}
};
View
19 test/simple/test-http-response-readable.js
@@ -0,0 +1,19 @@
+var common = require('../common');
+var assert = require('assert');
+var http = require('http');
+
+var testServer = new http.Server(function(req, res) {
+ res.writeHead(200);
+ res.end('Hello world');
+});
+
+testServer.listen(common.PORT, function() {
+ http.get({ port: common.PORT }, function(res) {
+ assert.equal(res.readable, true, 'res.readable initially true');
+ res.on('end', function() {
+ assert.equal(res.readable, false, 'res.readable set to false after end');
+ testServer.close();
+ });
+ });
+});
+
Please sign in to comment.
Something went wrong with that request. Please try again.