You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to BrookStaticFileBroker by file extensions rather than by directories as of now as well. At the same time, so that we can configure separately for such cache time.
Now I use this nginx, but do not always have the opportunity to use it
The text was updated successfully, but these errors were encountered:
Is it possible to BrookStaticFileBroker by file extensions rather than by directories as of now as well.
It uses TFPMimeTypes internally which provides GetMimeType(), so maybe it's possible.
At the same time, so that we can configure separately for such cache time.
If you want an already cached logic, you should use BrookMediaTypes.pas from Brook Tardigrade (lack examples, but I could send one soon). It caches the media types into a hash table and the item finding is done by a Jenkins hash function internally.
Also, it provides type detection which could be combined to compression feature also available on Brook, for example:
FN := YourRequestedFileName;
EX := ExtractFileExt(FN);
CT := MIME.Types.Find(EX);
if MIME.Types.IsText(CT) thenbegin// process the Accept-Encoding header to accept raw DEFLATE compression through// "ARes.Compressed := <your logic>" saving data transferring in ~93% or above
ARes.Render(FN);
endelsebeginif MatchText(EX, ['.html', '.css', '.js', '.xml', '.json']) thenbegin// process the Accept-Encoding header to accept Gzip compression through// "ARes.Compressed := <your logic>" saving data transferring in ~89% or aboveend;
ARes.Download(FN);
end;
Now I use this nginx, but do not always have the opportunity to use it
I've used the Nginx logic some time ago, but I left it after BrookMediaTypes came. If you want to use it too, you can reuse your already configured mime.types file from Nginx by enabling the TBrookMIME.Provider := 'Nginx'. There are another ways, for example, you can write your own provider (reading the media types from stream, file, string, list, database, register etc.) and register it like the ones here, so you can enable it through TBrookMIME.Provider := '<Your-awesome-provider>'. Or just left Brook to detect one for your system. (I'm on openSUSE and Brook reused the one available at /etc/mime.types; on Windows I've used the default provider and this mime.types copy)
Is it possible to
BrookStaticFileBroker
by file extensions rather than by directories as of now as well. At the same time, so that we can configure separately for such cache time.Now I use this nginx, but do not always have the opportunity to use it
The text was updated successfully, but these errors were encountered: