Send frame as request paramater as well

Here's what happens: When a client sends simple command without any
values in XML, registry can drop the `raw_frame` parameter
completely. If so, it relies on `frame` parameter being passed on to
create XML document.

https://github.com/internetee/registry/blame/ad823391b75509d5be20ee6ef217aa4f35a4c994/lib/epp_constraint.rb#L14

Fix involves sending the XML string twice, as `frame` and
`raw_frame`, the same as `mod_epp` did.
This commit is contained in:
Maciej Szlosarczyk 2019-07-17 10:47:52 +03:00
parent f00a17b89f
commit e99733aaf0
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
5 changed files with 36 additions and 16 deletions

View file

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

View file

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

View file

@ -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"},