Don't send a HTTP/1.1 status line to HTTP/1.0 clients.
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 29 Jun 2011 18:24:16 +0000 (20:24 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Mon, 4 Jul 2011 23:41:30 +0000 (01:41 +0200)
Fixes #1234.

lib/http.js

index 3bb24cb..1db953c 100644 (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)) {