class DEBUGGER__::UI_ServerBase
def greeting
def greeting case g = @sock.gets when /^info cookie:\s+(.*)$/ require 'etc' check_cookie $1 @sock.puts "PID: #{Process.pid}, $0: #{$0}, session_name: #{CONFIG[:session_name]}" @sock.puts "debug #{VERSION} on #{RUBY_DESCRIPTION}" @sock.puts "uname: #{Etc.uname.inspect}" @sock.close raise GreetingError, "HEAD request" when /^version:\s+(\S+)\s+(.+)$/ v, params = $1, $2 # TODO: protocol version if v != VERSION @sock.puts msg = "out DEBUGGER: Incompatible version (server:#{VERSION} and client:#{$1})" raise GreetingError, msg end parse_option(params) session_name = CONFIG[:session_name] session_name_str = ", session_name:#{session_name}" if session_name puts "DEBUGGER (client): Connected. PID:#{Process.pid}, $0:#{$0}#{session_name_str}" puts "DEBUGGER (client): Type `Ctrl-C` to enter the debug console." unless @need_pause_at_first puts when /^Content-Length: (\d+)/ require_relative 'server_dap' raise unless @sock.read(2) == "\r\n" self.extend(UI_DAP) @repl = false @need_pause_at_first = false dap_setup @sock.read($1.to_i) when /^GET\s\/json\sHTTP\/1.1/, /^GET\s\/json\/version\sHTTP\/1.1/, /^GET\s\/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\sHTTP\/1.1/ # The reason for not using @uuid here is @uuid is nil if users run debugger without `--open=chrome`. require_relative 'server_cdp' self.extend(UI_CDP) send_chrome_response g else raise GreetingError, "Unknown greeting message: #{g}" end end