Skip to content

Commit ab0559f

Browse files
author
Grahame Grieve
committed
fix problem processing content on tx endpoint
1 parent 7f71f9f commit ab0559f

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

server/web_server.pas

+13-20
Original file line numberDiff line numberDiff line change
@@ -949,28 +949,21 @@ procedure TFhirWebServer.PlainRequest(AContext: TIdContext;
949949

950950
procedure TFhirWebServer.ProcessFile(sender: TObject; session: TFhirSession; named, path: String; secure: boolean; variables: TFslMap<TFHIRObject>; var result: String);
951951
var
952-
s, n: String;
952+
s, n, h, t: String;
953+
i : integer;
953954
begin
954955
s := SourceProvider.getSource(named);
955-
s := s.Replace('[%id%]', Common.Name, [rfReplaceAll]);
956-
s := s.Replace('[%specurl%]', 'http://hl7.org/fhir', [rfReplaceAll]);
957-
s := s.Replace('[%web%]', WebDesc(secure), [rfReplaceAll]);
958-
s := s.Replace('[%admin%]', Common.AdminEmail, [rfReplaceAll]);
959-
s := s.Replace('[%logout%]', 'User: [n/a]', [rfReplaceAll]);
960-
s := s.Replace('[%endpoints%]', endpointList, [rfReplaceAll]);
961-
if Common.StatedPort = 80 then
962-
s := s.Replace('[%host%]', Common.Host, [rfReplaceAll])
963-
else
964-
s := s.Replace('[%host%]', Common.Host + ':' + inttostr(Common.StatedPort), [rfReplaceAll]);
965-
966-
if Common.StatedSSLPort = 443 then
967-
s := s.Replace('[%securehost%]', Common.Host, [rfReplaceAll])
968-
else
969-
s := s.Replace('[%securehost%]', Common.Host + ':' + inttostr(Common.StatedSSLPort), [rfReplaceAll]);
970-
if variables <> nil then
971-
for n in variables.Keys do
972-
s := s.Replace('[%' + n + '%]', variables[n].primitiveValue, [rfReplaceAll]);
973-
s := s.Replace('[%ver%]', 'n/a', [rfReplaceAll]);
956+
i := s.IndexOf('[%');
957+
while (i > -1) do
958+
begin
959+
h := s.subString(0, i);
960+
s := s.subString(i);
961+
i := s.indexOf('%]');
962+
t := s.subString(i+2);
963+
n := s.Substring(2, i-2);
964+
s := h + insertValue(n, secure, variables) + t;
965+
i := s.IndexOf('[%');
966+
end;
974967
result := s;
975968
end;
976969

0 commit comments

Comments
 (0)