Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed several RegEx issues in _debugger.js which allowed users to inp…

…ut non-valid commands, resulting in confusing behaviour.
  • Loading branch information...
commit 10e96c1e80688f26c7777706b49e9ca50d5ffd2c 1 parent 8971b59
Siddharth Mahendraker authored
View
18 lib/_debugger.js
@@ -785,7 +785,7 @@ Interface.prototype.handleCommand = function(cmd) {
self._lastCommand = null;
self.tryQuit();
- } else if (/^r(un)?/.test(cmd)) {
+ } else if (/^r(un)?$/.test(cmd)) {
self._lastCommand = null;
if (self.child) {
self.restartQuestion(function(yes) {
@@ -805,7 +805,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.trySpawn();
}
- } else if (/^help/.test(cmd)) {
+ } else if (/^help$/.test(cmd)) {
console.log(helpMessage);
term.prompt();
@@ -819,7 +819,7 @@ Interface.prototype.handleCommand = function(cmd) {
term.prompt();
});
- } else if (/info +breakpoints/.test(cmd)) {
+ } else if (/^info(\s+breakpoint)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
@@ -867,7 +867,7 @@ Interface.prototype.handleCommand = function(cmd) {
term.prompt();
});
- } else if (/^backtrace/.test(cmd) || /^bt/.test(cmd)) {
+ } else if (/^b(ack)?t(race)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
@@ -905,7 +905,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.printScripts(cmd.indexOf('full') > 0);
term.prompt();
- } else if (/^c(ontinue)?/.test(cmd)) {
+ } else if (/^c(ontinue)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
@@ -916,7 +916,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.resume();
});
- } else if (/^k(ill)?/.test(cmd)) {
+ } else if (/^k(ill)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
@@ -934,7 +934,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.term.prompt();
}
- } else if (/^next/.test(cmd) || /^n/.test(cmd)) {
+ } else if (/^n(ext)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
@@ -943,7 +943,7 @@ Interface.prototype.handleCommand = function(cmd) {
// Wait for break point. (disable raw mode?)
});
- } else if (/^step/.test(cmd) || /^s/.test(cmd)) {
+ } else if (/^s(tep)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
@@ -952,7 +952,7 @@ Interface.prototype.handleCommand = function(cmd) {
// Wait for break point. (disable raw mode?)
});
- } else if (/^print/.test(cmd) || /^p/.test(cmd)) {
+ } else if (/^p(rint)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
View
33 test/test-http-bug.js
@@ -0,0 +1,33 @@
+var http = require('http');
+
+var options1 = {
+host: 'localhost',
+port: 80,
+path: '/',
+method: 'GET'
+};
+
+http.createServer(function (req, res) {
+
+ var start = new Date();
+ var myCounter = 0;
+ debugger;
+
+ var isSent = false;
+ http.request(options1, function(response) {
+ response.setEncoding('utf8');
+ debugger;
+ response.on('data', function (chunk) {
+ var end = new Date();
+ console.log(myCounter + ' BODY: ' + chunk + " time: " + (end-start) + " Request start time: " + start.getTime());
+
+ if (! isSent) {
+ isSent = true;
+ res.writeHead(200, {'Content-Type': 'application/xml'});
+ res.end(chunk);
+ }
+ });
+ }).end();
+}).listen(3013);
+
+console.log('Server running at port 3013');
View
31 test/test-supersimple.js
@@ -0,0 +1,31 @@
+var http = require('http');
+
+//create a simple debugger test and run to check list bug...
+//solve list bug if possible
+
+var options1 = {
+host: 'localhost',
+port: 80,
+path: '/'
+};
+
+http.createServer(function (req, res){
+
+ res.writeHead(200, {'Content-Type':'text/plain'});
+ res.write('Testing debugger....');
+ debugger;
+
+ http.get(options1, function(response){
+ res.setEncoding('utf8');
+ res.on('data', function(chunk){
+ console.log('Got chunk');
+ debugger;
+ });
+ });
+
+ debugger;
+ res.end('Ending test...');
+}).listen(8000);
+
+console.log('Server listening on port 8000');
+
Please sign in to comment.
Something went wrong with that request. Please try again.