#1 2022-08-26 18:14:30

tbo
Member
Registered: 2015-04-20
Posts: 335

Out of interest question

Why did you put all favicon things in unit mormot.rest.http.server and not in unit mormot.net.server. This unit contains e.g. PrivKeyCertPfx. The favicon actually has nothing to do with REST. In my third-party demo MustacheEditor only with HttpServer it would be welcome too. Then you would not have to write the following in function DoReject:

procedure THttpAsyncConnection.DoReject(status: integer);
...
  if (fHttp.CommandUri <> '/favicon.ico') and
     fServer.Async.Banned.BanIP(fRemoteIP4) then

...but write this:

  if not UrlFavicon(Pointer(fHttp.CommandUri)) and
    fServer.Async.Banned.BanIP(fRemoteIP4) then

Shouldn't the function be better named UrlPathFavicon(), because that's what's being checked?

Sorry if I am too inquisitive.

With best regards
Thomas

Offline

#2 2022-08-26 21:48:27

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: Out of interest question

You can easily serve /favicon.ico in the HTTP server, but it was not easy with the REST server, which use TOrmModel.Root for its URI checks, and /favicon.ico is at the / level with no /root/.
Therefore it is only in the REST server.

UrFavicon() is a low-level function which could indeed be moved and used in DoReject().
It is a work in progress.

But an URL is already a path, isn't it?

Offline

#3 2022-08-26 22:01:07

tbo
Member
Registered: 2015-04-20
Posts: 335

Re: Out of interest question

ab wrote:

But an URL is already a path, isn't it?

When I write in English, I struggle with every word. My intuition says UrlPathFavicon(), but you are right.

Have a nice weekend.

With best regards
Thomas

Offline

#4 2022-08-27 08:29:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: Out of interest question

Offline

Board footer

Powered by FluxBB