mirror of
https://github.com/bitinflow/localtunnel.git
synced 2026-03-20 17:05:54 +00:00
add _request_ event to print basic request information
This commit is contained in:
@@ -30,8 +30,6 @@ TunnelCluster.prototype.open = function() {
|
||||
var local_host = opt.local_host || 'localhost';
|
||||
var local_port = opt.local_port;
|
||||
|
||||
var debug_logs = opt.debug_logs;
|
||||
|
||||
debug('establishing tunnel %s:%s <> %s:%s', local_host, local_port, remote_host, remote_port);
|
||||
|
||||
// connection to localtunnel server
|
||||
@@ -116,15 +114,12 @@ TunnelCluster.prototype.open = function() {
|
||||
}
|
||||
|
||||
remote.on('data', function(data) {
|
||||
if (debug_logs) {
|
||||
var match = data.toString().match(/^(\w+) (\S+)/);
|
||||
if (match) {
|
||||
console.log(
|
||||
new Date().toString(),
|
||||
`method=${match[1]}`,
|
||||
`path=${match[2]}`
|
||||
);
|
||||
}
|
||||
const match = data.toString().match(/^(\w+) (\S+)/);
|
||||
if (match) {
|
||||
self.emit('request', {
|
||||
method: match[1],
|
||||
path: match[2],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user