On 10-11-2012 14:42, Stan wrote:
I think loading hundreds of types from Registry when 'js' is missing
in the
default list is overkill, because most of them are not Internet-involved.
It don't takes that long, but even so It's also my opinion..., If it's
not needed, don't do it.
Because of this (I don't need the extra functionality of the
TMimeTypesList) I'm using THttpServer.OnHttpMimeContentType event.
But even so, this event is being called after an extra, IMHO not needed
if event assigned, call to the internal and obsolete
DocumentToContentType procedure
Current code:
if Assigned (FServer.MimeTypesList) then
FAnswerContentType :=
FServer.MimeTypesList.TypeFromFile(FDocument) { V7.46 }
else
FAnswerContentType := DocumentToContentType(FDocument);
TriggerMimeContentType(FDocument, FAnswerContentType); { V7.41
allow content type to be changed }
What's the scenario where I need to change the mime type after I have
searched for it already?
Better would be:
TriggerMimeContentType(FDocument, FAnswerContentType, handled);
if not handled then
if Assigned (FServer.MimeTypesList) then
FAnswerContentType :=
FServer.MimeTypesList.TypeFromFile(FDocument) { V7.46 }
else
FAnswerContentType := DocumentToContentType(FDocument);
Even better would be:
FAnswerContentType := 'application/binary';
if Assigned(FOnMimeContentType) then
FOnMimeContentType(Self, FileName, ContentType)
else
if Assigned (FServer.MimeTypesList) then
FAnswerContentType :=
FServer.MimeTypesList.TypeFromFile(FDocument) { V7.46 }
else
FAnswerContentType := DocumentToContentType(FDocument);
The component has excess of these Triggerxxx methods.
--
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