diff --git a/EXAMPLES.md b/EXAMPLES.md index cc450f6..efa7832 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -23,6 +23,14 @@ Login +Logout without any parameters + + + + + + + Logout @@ -44,6 +52,13 @@ Logout + + + + + + + Poll diff --git a/README.md b/README.md index f71169d..cfea694 100644 --- a/README.md +++ b/README.md @@ -28,19 +28,19 @@ The application listens on predefined TCP port for formatted EPP frames and tran HTTP requests according to the following matrix. Application performs regex search for clTRID and an XPATH search for command name. It does not check against any XSD schema. -| EPP Command | HTTP request | Parameters | Headers | Payload Type | Cookies | -|-------------|----------------------------------|---------------------|---------------------------------------------------------------------|----------------|---------| -| hello | `GET /epp_session_url/hello` | | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | | session | -| login | `POST /epp_session_url/login` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| logout | `POST /epp_session_url/logout` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| poll | `POST /epp_command_url/poll` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| check | `POST /epp_command_url/check` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| info | `POST /epp_command_url/info` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| create | `POST /epp_command_url/create` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| delete | `POST /epp_command_url/delete` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| renew | `POST /epp_command_url/renew` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| update | `POST /epp_command_url/update` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | -| ANY (error) | `GET /epp_error_url` | `msg, code, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | query params | session | +| EPP Command | HTTP request | Parameters | Headers | Payload Type | Cookies | +|-------------|----------------------------------|----------------------------|---------------------------------------------------------------------|----------------|---------| +| hello | `GET /epp_session_url/hello` | | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | | session | +| login | `POST /epp_session_url/login` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| logout | `POST /epp_session_url/logout` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| poll | `POST /epp_command_url/poll` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| check | `POST /epp_command_url/check` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| info | `POST /epp_command_url/info` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| create | `POST /epp_command_url/create` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| delete | `POST /epp_command_url/delete` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| renew | `POST /epp_command_url/renew` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| update | `POST /epp_command_url/update` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session | +| ANY (error) | `GET /epp_error_url` | `msg, code, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | query params | session | Error route is used in case EPP frame is malformed. diff --git a/apps/epp_proxy/priv/test_backend_app/epp_server.rb b/apps/epp_proxy/priv/test_backend_app/epp_server.rb index d1b6e4a..269b74f 100644 --- a/apps/epp_proxy/priv/test_backend_app/epp_server.rb +++ b/apps/epp_proxy/priv/test_backend_app/epp_server.rb @@ -16,7 +16,10 @@ class EppServer < Roda end r.post "logout" do - render("session/logout") + # Additional check if passes empty frame + if r.params['frame'] + render("session/logout") + end end end diff --git a/apps/epp_proxy/src/epp_http_client.erl b/apps/epp_proxy/src/epp_http_client.erl index 2f0e837..f9f364f 100644 --- a/apps/epp_proxy/src/epp_http_client.erl +++ b/apps/epp_proxy/src/epp_http_client.erl @@ -82,10 +82,10 @@ request_from_map(#{command := Command, %% Return form data or an empty list. request_body(?helloCommand, _, _) -> ""; request_body(_Command, RawFrame, nomatch) -> - {multipart, [{<<"raw_frame">>, RawFrame}]}; + {multipart, [{<<"raw_frame">>, RawFrame}, {<<"frame">>, RawFrame}]}; request_body(_Command, RawFrame, ClTRID) -> {multipart, - [{<<"raw_frame">>, RawFrame}, {<<"clTRID">>, ClTRID}]}. + [{<<"raw_frame">>, RawFrame}, {<<"frame">>, RawFrame}, {<<"clTRID">>, ClTRID}]}. %% Return a list of properties that each represent a query part in a query string. %% [{"user", "eis"}]} becomes later https://example.com?user=eis diff --git a/apps/epp_proxy/test/epp_http_client_SUITE.erl b/apps/epp_proxy/test/epp_http_client_SUITE.erl index 3f3f8c8..39c35fb 100644 --- a/apps/epp_proxy/test/epp_http_client_SUITE.erl +++ b/apps/epp_proxy/test/epp_http_client_SUITE.erl @@ -61,6 +61,7 @@ command_request_builder_test_case(_Config) -> "http://localhost:9292/command/create", {multipart, [{<<"raw_frame">>,"Some XML here"}, + {<<"frame">>,"Some XML here"}, {<<"clTRID">>,"EE-123456789"}]}, [<<"session=Random; Version=1">>], [{"User-Agent",<<"EPP proxy">>}], "create"}, @@ -74,6 +75,7 @@ registry_unreachable_test_case(_Config) -> "http://localhost:9999/someurl", {multipart, [{<<"raw_frame">>,"Some XML here"}, + {<<"frame">>,"Some XML here"}, {<<"clTRID">>,"EE-123456789"}]}, [<<"session=Random; Version=1">>], [{"User-Agent",<<"EPP proxy">>}], "create"},