summaryrefslogtreecommitdiff
path: root/lib/http2.js
diff options
context:
space:
mode:
authorMikeal Rogers <mikeal.rogers@gmail.com>2011-08-03 15:06:16 -0700
committerBen Noordhuis <info@bnoordhuis.nl>2011-08-16 01:24:41 +0200
commit584ae7b08477fba93be4b77cb1e1511f40c95fdf (patch)
tree8b36813026c2a3a5c35bae2c9c41273e31f7cb54 /lib/http2.js
parent721f26520d7781e0ffe8a94d531b8c1a76118a8d (diff)
downloadandroid-node-v8-584ae7b08477fba93be4b77cb1e1511f40c95fdf.tar.gz
android-node-v8-584ae7b08477fba93be4b77cb1e1511f40c95fdf.tar.bz2
android-node-v8-584ae7b08477fba93be4b77cb1e1511f40c95fdf.zip
Remove http.cat. fixes #1447
Diffstat (limited to 'lib/http2.js')
-rw-r--r--lib/http2.js82
1 files changed, 0 insertions, 82 deletions
diff --git a/lib/http2.js b/lib/http2.js
index 8a5d83adfe..823525fd10 100644
--- a/lib/http2.js
+++ b/lib/http2.js
@@ -1491,85 +1491,3 @@ exports.Client = Client;
exports.createClient = function(port, host) {
return new Client(port, host);
};
-
-exports.cat = function(url, encoding_, headers_) {
- var encoding = 'utf8';
- var headers = {};
- var callback = null;
-
- console.error("http.cat will be removed in the near future. use http.get");
-
- // parse the arguments for the various options... very ugly
- if (typeof(arguments[1]) == 'string') {
- encoding = arguments[1];
- if (typeof(arguments[2]) == 'object') {
- headers = arguments[2];
- if (typeof(arguments[3]) == 'function') callback = arguments[3];
- } else {
- if (typeof(arguments[2]) == 'function') callback = arguments[2];
- }
- } else {
- // didn't specify encoding
- if (typeof(arguments[1]) == 'object') {
- headers = arguments[1];
- callback = arguments[2];
- } else {
- callback = arguments[1];
- }
- }
-
- var url = require('url').parse(url);
-
- var hasHost = false;
- if (Array.isArray(headers)) {
- for (var i = 0, l = headers.length; i < l; i++) {
- if (headers[i][0].toLowerCase() === 'host') {
- hasHost = true;
- break;
- }
- }
- } else if (typeof headers === 'Object') {
- var keys = Object.keys(headers);
- for (var i = 0, l = keys.length; i < l; i++) {
- var key = keys[i];
- if (key.toLowerCase() == 'host') {
- hasHost = true;
- break;
- }
- }
- }
- if (!hasHost) headers['Host'] = url.hostname;
-
- var content = '';
-
- var path = (url.pathname || '/') + (url.search || '') + (url.hash || '');
- var callbackSent = false;
- var req = exports.request({port: url.port || 80, host: url.hostname, path: path}, function(res) {
- if (res.statusCode < 200 || res.statusCode >= 300) {
- if (callback && !callbackSent) {
- callback(res.statusCode);
- callbackSent = true;
- }
- client.end();
- return;
- }
- res.setEncoding(encoding);
- res.addListener('data', function(chunk) { content += chunk; });
- res.addListener('end', function() {
- if (callback && !callbackSent) {
- callback(null, content);
- callbackSent = true;
- }
- });
- });
-
-
- req.addListener('error', function(err) {
- if (callback && !callbackSent) {
- callback(err);
- callbackSent = true;
- }
- });
-
- req.end();
-};