From f91988979f340000a416dfbdd7488b9ae84ee419 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 29 Jun 2011 20:24:16 +0200 Subject: [PATCH] Don't send a HTTP/1.1 status line to HTTP/1.0 clients. Fixes #1234. --- lib/http.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/http.js b/lib/http.js index 3bb24cbef7..1db953ce2c 100644 --- a/lib/http.js +++ b/lib/http.js @@ -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)) {