I also find myself with the need to edit the DocumentToContentType
function, each time I update my local copy of ICS.
This has not being addressed yet, so how about if, instead of the more
complex implementation proposed here, an assignable
OnDocumentToContentType property is added to the httpserver, so users
can provide their own implementation of the DocumentToContentType
function, if they need to provide other content types.
The function is only called from the THttpConnection.SendDocument, so it
will go as:
procedure THttpConnection.SendDocument(SendType : THttpSendType; const
CustomHeaders : String);
....
if assigned(FServer.FOnDocumentToContentType) then
FAnswerContentType :=FServer.FOnDocumentToContentType(FDocument)
else
FAnswerContentType := DocumentToContentType(FDocument);
..
Hi Lars,
Lars Gehre wrote:
Hi,
after getting chewed out (again!) for forgetting to extend the
"DocumentToContentType" function after an update of ICS, I like to
suggest an improvement.
As base use a THashedStringlist (or something similar).
Fill the list with the default extension/contentType names and values
pairs and provide a public "RegisterContentType" procedure to add
customized content types to the list.
It might be actually faster (sorted list) than the old function...
I agree.
Maybe this is also the time to add "use the registry to find MIME
type for file types" ;)
AFAIK this is rather slow and if there were an option to register
custom MIME types one could feed them from the registry into the
hashlist once on server start?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be