diff --git a/Gemfile.lock b/Gemfile.lock index 6ec4224bd..3e411fa8c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -398,7 +398,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.4) + rexml (3.2.5) ruby2_keywords (0.0.4) rubyzip (2.3.0) sass-rails (6.0.0) diff --git a/app/controllers/epp/base_controller.rb b/app/controllers/epp/base_controller.rb index 99c0ead35..f12bd1bd2 100644 --- a/app/controllers/epp/base_controller.rb +++ b/app/controllers/epp/base_controller.rb @@ -103,7 +103,7 @@ module Epp @errors += obj.errors[:epp_errors] end - if params[:parsed_frame].at_css('update') + if params[:parsed_frame]&.at_css('update') @errors.each_with_index do |errors, index| if errors[:code] == '2304' && errors[:value].present? && diff --git a/app/controllers/epp/errors_controller.rb b/app/controllers/epp/errors_controller.rb index e4b179464..6cb689166 100644 --- a/app/controllers/epp/errors_controller.rb +++ b/app/controllers/epp/errors_controller.rb @@ -6,5 +6,10 @@ module Epp epp_errors << { code: params[:code], msg: params[:msg] } render_epp_response '/epp/error' end + + def command_handler + epp_errors << { code: '2000', msg: 'Unknown command' } + render_epp_response '/epp/error' + end end end diff --git a/config/routes.rb b/config/routes.rb index 4e78b7c0f..68bee9bfe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -36,6 +36,7 @@ Rails.application.routes.draw do post 'command/poll', to: 'polls#poll', as: 'poll', constraints: EppConstraint.new(:poll) get 'error/:command', to: 'errors#error' + get 'error', to: 'errors#command_handler' end namespace :repp do