mirror of https://github.com/nodejs/node.git
Get test-http-response-no-headers.js to pass
Main fix was in 3abebf which added HTTP/0.9 support to http parser. Changed test because HTTP 1.1 mandates keep-alive when no headers are given. Fixes #1711v0.7.4-release
parent
246805d386
commit
6e1e9e2fcb
|
@ -24,7 +24,11 @@ var assert = require('assert');
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
var net = require('net');
|
var net = require('net');
|
||||||
|
|
||||||
var expected = 'I AM THE WALRUS';
|
var expected = {
|
||||||
|
'0.9': 'I AM THE WALRUS',
|
||||||
|
'1.0': 'I AM THE WALRUS',
|
||||||
|
'1.1': '',
|
||||||
|
}
|
||||||
|
|
||||||
var gotExpected = false;
|
var gotExpected = false;
|
||||||
|
|
||||||
|
@ -34,7 +38,7 @@ function test(httpVersion, callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
var server = net.createServer(function(conn) {
|
var server = net.createServer(function(conn) {
|
||||||
var reply = 'HTTP/' + httpVersion + ' 200 OK\r\n\r\n' + expected;
|
var reply = 'HTTP/' + httpVersion + ' 200 OK\r\n\r\n' + expected[httpVersion];
|
||||||
|
|
||||||
conn.write(reply, function() {
|
conn.write(reply, function() {
|
||||||
conn.destroy();
|
conn.destroy();
|
||||||
|
@ -55,7 +59,7 @@ function test(httpVersion, callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
res.on('end', function() {
|
res.on('end', function() {
|
||||||
assert.equal(body, expected);
|
assert.equal(body, expected[httpVersion]);
|
||||||
gotExpected = true;
|
gotExpected = true;
|
||||||
server.close();
|
server.close();
|
||||||
if (callback) process.nextTick(callback);
|
if (callback) process.nextTick(callback);
|
||||||
|
|
Loading…
Reference in New Issue