Don't send a HTTP/1.1 status line to HTTP/1.0 clients.

Fixes #1234.
This commit is contained in:
Ben Noordhuis 2011-06-29 20:24:16 +02:00
parent 092fc42fbf
commit 8dc87731c7

View File

@ -771,6 +771,8 @@ function ServerResponse(req) {
this.useChunkedEncodingByDefault = false;
this.shouldKeepAlive = false;
}
this._httpVersion = req.httpVersion;
}
util.inherits(ServerResponse, OutgoingMessage);
@ -831,8 +833,9 @@ ServerResponse.prototype.writeHead = function(statusCode) {
headers = obj;
}
var statusLine = 'HTTP/1.1 ' + statusCode.toString() + ' ' +
reasonPhrase + CRLF;
var statusLine = 'HTTP/' + this._httpVersion
+ ' ' + statusCode.toString()
+ ' ' + reasonPhrase + CRLF;
if (statusCode === 204 || statusCode === 304 ||
(100 <= statusCode && statusCode <= 199)) {