diff --git a/README.md b/README.md index ffd56f5ab..9b813357e 100644 --- a/README.md +++ b/README.md @@ -79,9 +79,10 @@ For development configuration, add: EPPEngine On EPPCommandRoot /proxy/command EPPSessionRoot /proxy/session + EPPErrorRoot /proxy/error + ProxyPass /proxy/ http://localhost:8989/epp/ - EPPErrorRoot /cgi-bin/epp/error EPPAuthURI implicit EPPReturncodeHeader X-EPP-Returncode @@ -115,6 +116,10 @@ Wait for the greeting message on the STD, then send EPP/TCP frame: * Run tests: `rake` * Run all but EPP tests: `rake test:other` +To see internal errors while testing EPP +* `unicorn -E test -p 8989` +* `rake spec:epp` + --- Configuration on plain TCP EPP is as follows: diff --git a/app/controllers/concerns/epp/common.rb b/app/controllers/concerns/epp/common.rb index e0434dd89..788ef91be 100644 --- a/app/controllers/concerns/epp/common.rb +++ b/app/controllers/concerns/epp/common.rb @@ -12,8 +12,4 @@ module Epp::Common def parsed_frame Nokogiri::XML(params[:frame]).remove_namespaces! end - - def error - render 'error' - end end diff --git a/app/controllers/epp/errors_controller.rb b/app/controllers/epp/errors_controller.rb new file mode 100644 index 000000000..db4cd6c11 --- /dev/null +++ b/app/controllers/epp/errors_controller.rb @@ -0,0 +1,7 @@ +class Epp::ErrorsController < ApplicationController + include Epp::Common + + def error + render '/epp/error' + end +end diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder index e69de29bb..a7ac956df 100644 --- a/app/views/epp/error.xml.builder +++ b/app/views/epp/error.xml.builder @@ -0,0 +1,12 @@ +xml.instruct! +xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do + xml.response do + xml.result('code' => params[:code]) do + xml.msg(params[:msg], 'lang' => 'en') + end + end + + xml.trID do + xml.clTRID params[:clTRID] + end +end diff --git a/config/routes.rb b/config/routes.rb index 4b27e41e6..41e3f3d9c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,6 +2,7 @@ Rails.application.routes.draw do namespace(:epp) do match 'session/:command', to: 'sessions#proxy', defaults: { format: :xml }, via: [:get, :post] match 'command/:command', to: 'commands#proxy', defaults: { format: :xml }, via: [:post, :get] + get 'error/:command', to: 'errors#error', defaults: { format: :xml } end # The priority is based upon order of creation: first created -> highest priority.