lib/ronin/web/cli/commands/reverse_proxy.rb in ronin-web-1.0.0.beta2 vs lib/ronin/web/cli/commands/reverse_proxy.rb in ronin-web-1.0.0.beta3
- old
+ new
@@ -43,11 +43,11 @@
# Rewrite response bodies
# -h, --help Print help information
#
# @api private
#
- class Proxy < Command
+ class ReverseProxy < Command
include Core::CLI::Logging
command_name 'reverse-proxy'
@@ -140,10 +140,17 @@
print_body(response.body) if options[:show_body]
end
end
log_info "Starting proxy server on #{options[:host]}:#{options[:port]} ..."
- proxy.run!(host: options[:host], port: options[:port])
+
+ begin
+ proxy.run!(host: options[:host], port: options[:port])
+ rescue Errno::EADDRINUSE => error
+ log_error(error.message)
+ exit(1)
+ end
+
log_info "shutting down ..."
end
#
# Prints a request or response body.