Lint
authorseebees <seebees@gmail.com>
Wed, 19 Oct 2011 23:28:44 +0000 (16:28 -0700)
committerkoichik <koichik@improvement.jp>
Sat, 22 Oct 2011 05:14:40 +0000 (14:14 +0900)
doc/api/http.markdown
doc/api/https.markdown
lib/http.js
lib/url.js
test/simple/test-http-url.parse-auth-with-header-in-request.js
test/simple/test-http-url.parse-auth.js
test/simple/test-http-url.parse-https.request.js
test/simple/test-http-url.parse-path.js
test/simple/test-http-url.parse-post.js
test/simple/test-http-url.parse-search.js
test/simple/test-url.js

index 7d5b9b52157ae0cdbfea8143f04d4544ab8b766b..4cef0c847fa2b48f884283a3e8f5032d6406379e 100644 (file)
@@ -487,21 +487,21 @@ Example:
 
 ## http.Agent
 
-In node 0.5.3+ there is a new implementation of the HTTP Agent which is used 
+In node 0.5.3+ there is a new implementation of the HTTP Agent which is used
 for pooling sockets used in HTTP client requests.
 
-Previously, a single agent instance help the pool for single host+port. The 
+Previously, a single agent instance help the pool for single host+port. The
 current implementation now holds sockets for any number of hosts.
 
-The current HTTP Agent also defaults client requests to using 
-Connection:keep-alive. If no pending HTTP requests are waiting on a socket 
-to become free the socket is closed. This means that node's pool has the 
-benefit of keep-alive when under load but still does not require developers 
+The current HTTP Agent also defaults client requests to using
+Connection:keep-alive. If no pending HTTP requests are waiting on a socket
+to become free the socket is closed. This means that node's pool has the
+benefit of keep-alive when under load but still does not require developers
 to manually close the HTTP clients using keep-alive.
 
-Sockets are removed from the agent's pool when the socket emits either a 
-"close" event or a special "agentRemove" event. This means that if you intend 
-to keep one HTTP request open for a long time and don't want it to stay in the 
+Sockets are removed from the agent's pool when the socket emits either a
+"close" event or a special "agentRemove" event. This means that if you intend
+to keep one HTTP request open for a long time and don't want it to stay in the
 pool you can do something along the lines of:
 
     http.get(options, function(res) {
@@ -509,7 +509,7 @@ pool you can do something along the lines of:
     }).on("socket", function (socket) {
       socket.emit("agentRemove");
     });
-  
+
 Alternatively, you could just opt out of pooling entirely using `agent:false`:
 
     http.get({host:'localhost', port:80, path:'/', agent:false}, function (res) {
index 7a5473cf84b0c1075f13fb29ccc84cf71e784c77..4113fe06e383498e29d33d7f72814fb31798465c 100644 (file)
@@ -69,7 +69,7 @@ The options argument has the following options
 - method: HTTP request method. Default `'GET'`.
 
 The following options can also be specified.
-However, a global [Agent](http.html#http.Agent) cannot be used. 
+However, a global [Agent](http.html#http.Agent) cannot be used.
 
 - key: Private key to use for SSL. Default `null`.
 - cert: Public x509 certificate to use. Default `null`.
index 2d298203a950dc5894b205b1e259a9362b21dc7a..9eb3b50d546500de37c40ac8eaebd4d4b86300d8 100644 (file)
@@ -1015,7 +1015,7 @@ function ClientRequest(options, cb) {
       if (options.port && +options.port !== options.defaultPort) {
         hostHeader += ':' + options.port;
       }
-      this.setHeader("Host", hostHeader);
+      this.setHeader('Host', hostHeader);
     }
   }
 
@@ -1032,9 +1032,11 @@ function ClientRequest(options, cb) {
   }
 
   if (Array.isArray(options.headers)) {
-    self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n', options.headers);
+    self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n',
+                      options.headers);
   } else if (self.getHeader('expect')) {
-    self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n', self._renderHeaders());
+    self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n',
+                      self._renderHeaders());
   }
   if (self.socketPath) {
     self._last = true;
@@ -1060,9 +1062,9 @@ function ClientRequest(options, cb) {
     }
   }
 
-  self._deferToConnect(null, null, function () {
+  self._deferToConnect(null, null, function() {
     self._flush();
-  })
+  });
 
 }
 util.inherits(ClientRequest, OutgoingMessage);
@@ -1095,7 +1097,7 @@ function createHangUpError() {
 
 ClientRequest.prototype.onSocket = function(socket) {
   var req = this;
-  process.nextTick(function () {
+  process.nextTick(function() {
     var parser = parsers.alloc();
     req.socket = socket;
     req.connection = socket;
index f6d86316519695e7f2ee0b76065038a42e2e149c..7a28e0064ba168801e2ba9011124e3dce1e0e1f6 100644 (file)
@@ -234,7 +234,7 @@ function urlParse(url, parseQueryString, slashesDenoteHost) {
     }
     out.hostname = newOut.join('.');
 
-    out.host =  (out.hostname || '') +
+    out.host = (out.hostname || '') +
         ((out.port) ? ':' + out.port : '');
     out.href += out.host;
   }
@@ -419,7 +419,7 @@ function urlResolveObject(source, relative) {
     //to support http.request
     if (source.pathname !== undefined || source.search !== undefined) {
       source.path = (source.pathname ? source.pathname : '') +
-                 (source.search ? source.search : '');
+                    (source.search ? source.search : '');
     }
     source.slashes = source.slashes || relative.slashes;
     source.href = urlFormat(source);
@@ -504,7 +504,7 @@ function urlResolveObject(source, relative) {
     //to support http.request
     if (source.pathname !== undefined || source.search !== undefined) {
       source.path = (source.pathname ? source.pathname : '') +
-                 (source.search ? source.search : '');
+                    (source.search ? source.search : '');
     }
     source.href = urlFormat(source);
     return source;
@@ -590,7 +590,7 @@ function urlResolveObject(source, relative) {
   //to support request.http
   if (source.pathname !== undefined || source.search !== undefined) {
     source.path = (source.pathname ? source.pathname : '') +
-               (source.search ? source.search : '');
+                  (source.search ? source.search : '');
   }
   source.auth = relative.auth || source.auth;
   source.slashes = source.slashes || relative.slashes;
index 6abb8f99dee8e564fd40f5a9096d8408e847d1d1..5ac789068e68a2b466a6cc4b4b1dd853913e428d 100644 (file)
@@ -22,7 +22,6 @@
 var common = require('../common');
 var assert = require('assert');
 var http = require('http');
-var https = require('https');
 var url = require('url');
 
 var testURL = url.parse('http://asdf:qwer@localhost:' + common.PORT);
@@ -45,7 +44,7 @@ var server = http.createServer(function(request, response) {
   server.close();
 });
 
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
   // make the request
   http.request(testURL).end();
 });
index 0aa43fcae6cadf57f7e7e2a20b52adf8ce3578bb..dfa88331902ea8ca8b71522aac6edc05c4060e8a 100644 (file)
@@ -22,7 +22,6 @@
 var common = require('../common');
 var assert = require('assert');
 var http = require('http');
-var https = require('https');
 var url = require('url');
 
 var testURL = url.parse('http://asdf:qwer@localhost:' + common.PORT);
@@ -40,7 +39,7 @@ var server = http.createServer(function(request, response) {
   server.close();
 });
 
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
   // make the request
   http.request(testURL).end();
 });
index f16646057b4b502d65b9445b1047853f2289c986..6756db548732727ca611847b02a7123fa4137f8d 100644 (file)
@@ -47,7 +47,7 @@ var server = https.createServer(httpsOptions, function(request, response) {
   server.close();
 });
 
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
   // make the request
   var clientRequest = https.request(testURL);
   // since there is a little magic with the agent
index ec97d87a4d2063d502eec530fc5a1b75921ce3c0..8ef09520c6e43a95db3d73a503c877e4dece2e11 100644 (file)
@@ -22,7 +22,6 @@
 var common = require('../common');
 var assert = require('assert');
 var http = require('http');
-var https = require('https');
 var url = require('url');
 
 var testURL = url.parse('http://localhost:' + common.PORT + '/asdf');
@@ -40,7 +39,7 @@ var server = http.createServer(function(request, response) {
   server.close();
 });
 
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
   // make the request
   http.request(testURL).end();
 });
index a51f061c180a9b3c279c542a0718f7f3458521f8..be93166d532c292df10112fb84a8dbedfa91c302 100644 (file)
@@ -29,13 +29,13 @@ var testURL = url.parse('http://localhost:' + common.PORT + '/asdf?qwer=zxcv');
 testURL.method = 'POST';
 
 function check(request) {
-   //url.parse should not mess with the method
-    assert.strictEqual(request.method, 'POST');
-    //everything else should be right
-    assert.strictEqual(request.url, '/asdf?qwer=zxcv');
-    //the host header should use the url.parse.hostname
-    assert.strictEqual(request.headers.host,
-                       testURL.hostname + ':' + testURL.port);
+  //url.parse should not mess with the method
+  assert.strictEqual(request.method, 'POST');
+  //everything else should be right
+  assert.strictEqual(request.url, '/asdf?qwer=zxcv');
+  //the host header should use the url.parse.hostname
+  assert.strictEqual(request.headers.host,
+      testURL.hostname + ':' + testURL.port);
 }
 
 var server = http.createServer(function(request, response) {
@@ -46,7 +46,7 @@ var server = http.createServer(function(request, response) {
   server.close();
 });
 
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
   // make the request
   http.request(testURL).end();
 });
index 2c7ca5c82c78a9e744b10bed1b756bc8d645f01c..3b6727d0bf6320b705af79de5c3f2fdf979b3154 100644 (file)
@@ -40,7 +40,7 @@ var server = http.createServer(function(request, response) {
   server.close();
 });
 
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
   // make the request
   http.request(testURL).end();
 });
index ca6782ed9b56bf2b9a31f0d2a3ce55368c1b6e73..c89545d640ab627aaf618ed00f401de0c66050fa 100644 (file)
@@ -989,7 +989,7 @@ relativeTests.forEach(function(relativeTest) {
 if (relativeTests2[181][0] === './/g' &&
     relativeTests2[181][1] === 'f:/a' &&
     relativeTests2[181][2] === 'f://g') {
-  relativeTests2.splice(181,1);
+  relativeTests2.splice(181, 1);
 }
 relativeTests2.forEach(function(relativeTest) {
   var actual = url.resolveObject(url.parse(relativeTest[1]), relativeTest[0]),