11-09-2020, 02:54 PM
Hi Alexandre,
I use following code to disable unsupported browsers but keep support for some apps using a rest api
In IW15.2.20 requesting the restapi gives a AV because aSession is nil like stated in the release notes.
Can I test the request in this function in another way?
I use following code to disable unsupported browsers but keep support for some apps using a rest api
Code:
// Step 1. OnBrowserCheck
procedure TIWServerController.IWServerControllerBaseBrowserCheck(
aSession: TIWApplication; var rBrowser: TBrowser);
begin
// REST method is often called from a non-browser. change this so the call is accepted
if (rBrowser is TOther) and aSession.Request.PathInfo.StartsWith('/restapi/')
then begin
rBrowser.Free;
// accept the unknown browser as Firefox (probably the best idea)
rBrowser := TFireFox.Create(TFireFox.MIN_VERSION);
end
// handle unknown and non-supported browsers, they don't belong there (often script kiddies)
else if not rBrowser.IsSupported
then begin
rBrowser.Free; // free current browser object because it will throw an exception otherways
rBrowser := TFireFox.Create(TFireFox.MIN_VERSION);
TerminateSession(aSession, 403, 'Forbidden');
end;
end;
In IW15.2.20 requesting the restapi gives a AV because aSession is nil like stated in the release notes.
Can I test the request in this function in another way?