Skip to content

Replace sys.log with console.log #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions proxy-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

var http = require('http');
var sys = require('sys');
var fs = require('fs');
var url = require('url');

Expand All @@ -24,7 +23,7 @@ fs.watchFile('./iplist', function (c, p) {
function update_blacklist() {
fs.stat('./blacklist', function (err, stats) {
if (!err) {
sys.log("Updating blacklist.");
console.log("Updating blacklist.");
blacklist = fs.readFileSync('./blacklist').split('\n')
.filter(function (rx) {
return rx.length
Expand All @@ -39,7 +38,7 @@ function update_blacklist() {
function update_iplist() {
fs.stat('./iplist', function (err, stats) {
if (!err) {
sys.log("Updating iplist.");
console.log("Updating iplist.");
iplist = fs.readFileSync('./iplist').split('\n')
.filter(function (rx) {
return rx.length
Expand Down Expand Up @@ -84,20 +83,20 @@ http.createServer(function (request, response) {
if (!ip_allowed(ip)) {
msg = "IP " + ip + " is not allowed to use this proxy";
deny(response, msg);
sys.log(msg);
console.log(msg);
return;
}

if (!host_allowed(request.url)) {
msg = "Host " + request.url + " has been denied by proxy configuration";
deny(response, msg);
sys.log(msg);
console.log(msg);
return;
}

var request_url = decodeURIComponent(request.url).slice(1);

sys.log(ip + ": " + request.method + " " + request_url);
console.log(ip + ": " + request.method + " " + request_url);

var request_parts = url.parse(request_url);

Expand Down Expand Up @@ -134,4 +133,3 @@ http.createServer(function (request, response) {

update_blacklist();
update_iplist();