other/websockify.js: arg cleanup, remove deprecated call.

Change deprecated path.exists call to fs.exists.

Confirmed that this runs with node v0.8.9
This commit is contained in:
Joel Martin 2012-09-21 08:19:40 -05:00
parent 471b504799
commit 8b3125bcf3
1 changed files with 5 additions and 4 deletions

View File

@ -73,7 +73,7 @@ http_request = function (request, response) {
var uri = url.parse(request.url).pathname var uri = url.parse(request.url).pathname
, filename = path.join(argv.web, uri); , filename = path.join(argv.web, uri);
path.exists(filename, function(exists) { fs.exists(filename, function(exists) {
if(!exists) { if(!exists) {
return http_error(response, 404, "404 Not Found"); return http_error(response, 404, "404 Not Found");
} }
@ -95,9 +95,10 @@ http_request = function (request, response) {
}; };
// parse source and target arguments into parts // parse source and target arguments into parts
source_arg = argv._[0].toString();
target_arg = argv._[1].toString();
try { try {
source_arg = argv._[0].toString();
target_arg = argv._[1].toString();
var idx; var idx;
idx = source_arg.indexOf(":"); idx = source_arg.indexOf(":");
if (idx >= 0) { if (idx >= 0) {
@ -119,7 +120,7 @@ try {
throw("illegal port"); throw("illegal port");
} }
} catch(e) { } catch(e) {
console.error("wsproxy.py [source_addr:]source_port target_addr:target_port"); console.error("wsproxy.py [--web web_dir] [source_addr:]source_port target_addr:target_port");
process.exit(2); process.exit(2);
} }