mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
860 B
41 lines
860 B
14 years ago
|
var common = require('../common');
|
||
|
var assert = require('assert');
|
||
|
var http = require('http');
|
||
|
|
||
13 years ago
|
var requestGotEnd = false;
|
||
|
var responseGotEnd = false;
|
||
14 years ago
|
|
||
|
var server = http.createServer(function(req, res) {
|
||
|
res.writeHead(200);
|
||
|
res.write('a');
|
||
|
|
||
|
req.on('close', function() {
|
||
13 years ago
|
console.error('request aborted');
|
||
|
requestGotEnd = true;
|
||
|
});
|
||
|
res.on('close', function() {
|
||
|
console.error('response aborted');
|
||
|
responseGotEnd = true;
|
||
14 years ago
|
});
|
||
|
});
|
||
|
server.listen(common.PORT);
|
||
|
|
||
13 years ago
|
server.on('listening', function() {
|
||
13 years ago
|
console.error('make req');
|
||
14 years ago
|
http.get({
|
||
|
port: common.PORT
|
||
|
}, function(res) {
|
||
13 years ago
|
console.error('got res');
|
||
14 years ago
|
res.on('data', function(data) {
|
||
13 years ago
|
console.error('destroy res');
|
||
14 years ago
|
res.destroy();
|
||
|
server.close();
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
|
||
|
process.on('exit', function() {
|
||
13 years ago
|
assert.ok(requestGotEnd);
|
||
|
assert.ok(responseGotEnd);
|
||
14 years ago
|
});
|