mirror of https://github.com/lukechilds/node.git
Browse Source
Made this test in response to this thread: http://groups.google.com/group/nodejs/browse_thread/thread/f82835007a277de2/ But Node appears to be working correctly.v0.7.4-release
Ryan Dahl
14 years ago
1 changed files with 34 additions and 0 deletions
@ -0,0 +1,34 @@ |
|||
var common = require("../common"); |
|||
var assert = require('assert'); |
|||
|
|||
var http = require('http'); |
|||
var net = require('net'); |
|||
|
|||
// Create a TCP server
|
|||
var srv = net.createServer(function(c) { |
|||
c.write('bad http - should trigger parse error\r\n'); |
|||
|
|||
console.log("connection"); |
|||
|
|||
c.addListener('end', function() { c.end(); }); |
|||
}); |
|||
srv.listen(common.PORT, '127.0.0.1'); |
|||
|
|||
var hc = http.createClient(common.PORT, '127.0.0.1'); |
|||
hc.request('GET', '/').end(); |
|||
|
|||
var parseError = false; |
|||
|
|||
hc.on('error', function (e) { |
|||
console.log("got error from client"); |
|||
srv.close(); |
|||
assert.ok(e.message.indexOf("Parse Error") >= 0); |
|||
parseError = true; |
|||
}); |
|||
|
|||
|
|||
process.addListener('exit', function() { |
|||
assert.ok(parseError); |
|||
}); |
|||
|
|||
|
Loading…
Reference in new issue