From fd415c64cab08c44ba4614240f74226b04f6a496 Mon Sep 17 00:00:00 2001 From: Jeff Lawson Date: Sat, 11 Feb 2012 02:15:52 -0600 Subject: [PATCH] switch from sys to util, for compliance with newer Node.JS --- node-rss.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/node-rss.js b/node-rss.js index 9c1cb05..79b319d 100644 --- a/node-rss.js +++ b/node-rss.js @@ -13,7 +13,7 @@ Rob Righter - @robrighter http://github.com/robrighter/node-xml **********************************************************************/ -var sys = require('sys'), http = require('http'); +var util = require('util'), http = require('http'); var xml = require("./node-xml"); // variable for holding the callback function which is passed to the @@ -87,10 +87,10 @@ var parser = new xml.SaxParser(function(cb) { // @TODO handle warnings and errors properly cb.onWarning(function(msg) { - sys.puts(''+msg+""); + util.puts(''+msg+""); }); cb.onError(function(msg) { - sys.puts(''+JSON.stringify(msg)+""); + util.puts(''+JSON.stringify(msg)+""); }); }); @@ -120,7 +120,7 @@ exports.parseURL = function(url, cb) { function get_rss(url) { var u = require('url'), http = require('http'); var parts = u.parse(url); - //sys.puts(JSON.stringify(parts)); + //util.puts(JSON.stringify(parts)); // set the default port to 80 if(!parts.port) { parts.port = 80; } @@ -130,8 +130,8 @@ exports.parseURL = function(url, cb) { var client = http.createClient(parts.port, parts.hostname); var request = client.request('GET', parts.pathname, {'host': parts.hostname}); request.addListener('response', function (response) { - //sys.puts('STATUS: ' + response.statusCode); - //sys.puts('HEADERS: ' + JSON.stringify(response.headers)); + //util.puts('STATUS: ' + response.statusCode); + //util.puts('HEADERS: ' + JSON.stringify(response.headers)); // check to see the type of status switch(response.statusCode) { @@ -149,10 +149,10 @@ exports.parseURL = function(url, cb) { case 301: case 302: if(redirection_level > 10) { - sys.puts("too many redirects"); + util.puts("too many redirects"); } else { - sys.puts("redirect to "+response.headers.location); + util.puts("redirect to "+response.headers.location); get_rss(response.headers.location); } break; @@ -160,7 +160,7 @@ exports.parseURL = function(url, cb) { /* response.setEncoding('utf8'); response.addListener('data', function (chunk) { - //sys.puts('BODY: ' + chunk); + //util.puts('BODY: ' + chunk); }); */ break;