Render error message from the app, instead of mod_epp

This commit is contained in:
Martin Lensment 2014-06-25 15:38:18 +03:00
parent 9f30ec3cc7
commit 8c1ea03f95
5 changed files with 26 additions and 5 deletions

View file

@ -79,9 +79,10 @@ For development configuration, add:
EPPEngine On EPPEngine On
EPPCommandRoot /proxy/command EPPCommandRoot /proxy/command
EPPSessionRoot /proxy/session EPPSessionRoot /proxy/session
EPPErrorRoot /proxy/error
ProxyPass /proxy/ http://localhost:8989/epp/ ProxyPass /proxy/ http://localhost:8989/epp/
EPPErrorRoot /cgi-bin/epp/error
EPPAuthURI implicit EPPAuthURI implicit
EPPReturncodeHeader X-EPP-Returncode EPPReturncodeHeader X-EPP-Returncode
</VirtualHost> </VirtualHost>
@ -115,6 +116,10 @@ Wait for the greeting message on the STD, then send EPP/TCP frame:
* Run tests: `rake` * Run tests: `rake`
* Run all but EPP tests: `rake test:other` * 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: Configuration on plain TCP EPP is as follows:

View file

@ -12,8 +12,4 @@ module Epp::Common
def parsed_frame def parsed_frame
Nokogiri::XML(params[:frame]).remove_namespaces! Nokogiri::XML(params[:frame]).remove_namespaces!
end end
def error
render 'error'
end
end end

View file

@ -0,0 +1,7 @@
class Epp::ErrorsController < ApplicationController
include Epp::Common
def error
render '/epp/error'
end
end

View file

@ -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

View file

@ -2,6 +2,7 @@ Rails.application.routes.draw do
namespace(:epp) do namespace(:epp) do
match 'session/:command', to: 'sessions#proxy', defaults: { format: :xml }, via: [:get, :post] match 'session/:command', to: 'sessions#proxy', defaults: { format: :xml }, via: [:get, :post]
match 'command/:command', to: 'commands#proxy', defaults: { format: :xml }, via: [:post, :get] match 'command/:command', to: 'commands#proxy', defaults: { format: :xml }, via: [:post, :get]
get 'error/:command', to: 'errors#error', defaults: { format: :xml }
end end
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.