Re: [twsocket] Proposal for new content-type in function DocumentToContentType in OverbyteIcsHttpSrv.pas

2008-04-10 Thread DZ-Jay

On Apr 9, 2008, at 03:45, Bjørnar Nielsen wrote:

 The comment about the registry was there before I made any changes. My 
 only change was to add 'text/xml' as content-type for extension 'xml'. 
 For now my only need is this extra content-type, not another way of 
 managing the list of content-types.

 When using Flash, if you have the need to do cross-domain-scripting, 
 you have to have a file called crossdomain.xml on the root, defining 
 the rules for crossdomain-scripting. And the content-type has to be 
 text/xml when downloaded to flash from a server in order to work.

I understand, but perhaps ICS could benefit from having automatic 
MIME-Type detection/handling, not only for the HTTP components, but for 
the SMTP as well.  Currently, you have to set the MIME-Type manually on 
the SMTPCli component; and any attachments are automatically set to 
application/octet-stream, regardless of whether they are plain text 
files or binaries.

So, if there is a plan to add such functionality to the ICS components, 
it is my opinion that using the Registry is the wrong thing to do.  
Indy does this, and then you depend on the host computer having the 
proper types registered.

dZ.

-- 
DZ-Jay [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

-- 
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


Re: [twsocket] Proposal for new content-type in function DocumentToContentType in OverbyteIcsHttpSrv.pas

2008-04-09 Thread Bjørnar Nielsen
Hello,

The comment about the registry was there before I made any changes. My only 
change was to add 'text/xml' as content-type for extension 'xml'. For now my 
only need is this extra content-type, not another way of managing the list of 
content-types.

When using Flash, if you have the need to do cross-domain-scripting, you have 
to have a file called crossdomain.xml on the root, defining the rules for 
crossdomain-scripting. And the content-type has to be text/xml when downloaded 
to flash from a server in order to work.

Regards Bjørnar

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of DZ-Jay
Sent: 8. april 2008 16:11
To: ICS support mailing
Subject: Re: [twsocket] Proposal for new content-type in function 
DocumentToContentType in OverbyteIcsHttpSrv.pas

On Apr 8, 2008, at 09:45, Bjørnar Nielsen wrote:
 { We probably should use the registry to find MIME type for file
 types }

Hello:
I don't agree that the Registry should be used, because then you limit
the application to those MIME types registered at the local host.  What
I propose is that a simple list of mappings between extensions and MIME
types be kept and maintained with ICS (there are many of these
available already), and that an efficient mechanism be built into the
HttpSrv to load these on start up to some sort of searchable memory
structure.  I have done this in the past using a custom Red and Black
Balanced Tree, which can then be searched to find the MIME type of a
file extension (and even its transport encoding).  I actually
implemented this for automatic file encodings of SMTP attachments.

By keeping it in a simple list, like Apache does, it can be easily
extended and maintained.

dZ.

--
DZ-Jay [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

--
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

No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.9/1364 - Release Date: 07.04.2008 
18:38


No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.10/1366 - Release Date: 08.04.2008 
17:03

-- 
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


[twsocket] Proposal for new content-type in function DocumentToContentType in OverbyteIcsHttpSrv.pas

2008-04-08 Thread Bjørnar Nielsen
Se the new content-type at the bottom (xml):



function DocumentToContentType(FileName : String) : String;

var

Ext : String;

begin

{ We probably should use the registry to find MIME type for file types }

Ext := LowerCase(ExtractFileExt(FileName));

if Length(Ext)  1 then

Ext := Copy(Ext, 2, Length(Ext));

if (Ext = 'htm') or (Ext = 'html') then

Result := 'text/html'

else if Ext = 'gif' then

Result := 'image/gif'

else if Ext = 'bmp' then

Result := 'image/bmp'

else if (Ext = 'jpg') or (Ext = 'jpeg') then

Result := 'image/jpeg'

else if (Ext = 'tif') or (Ext = 'tiff') then

Result := 'image/tiff'

else if Ext = 'txt' then

Result := 'text/plain'

else if Ext = 'css' then

Result := 'text/css'

else if Ext = 'wav' then

Result := 'audio/x-wav'

else if Ext = 'ico' then

Result := 'image/x-icon'

{ WAP support begin }

else if Ext = 'wml' then

Result := 'text/vnd.wap.wml'

else if Ext = 'wbmp' then

Result := 'image/vnd.wap.wbmp'

else if Ext = 'wmlc' then

Result := 'application/vnd.wap.wmlc'

else if Ext = 'wmlscript' then

Result := 'text/vnd.wap.wmlscript'

else if Ext = 'wmlscriptc' then

Result := 'application/vnd.wap.wmlscriptc'

{ WAP support end }

else if Ext = 'pdf' then

Result := 'application/pdf'

else if Ext = 'xml' then

Result := 'text/xml'

else

Result := 'application/binary';

end;



Regards Bjørnar


No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.9/1364 - Release Date: 07.04.2008 
18:38

-- 
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


Re: [twsocket] Proposal for new content-type in function DocumentToContentType in OverbyteIcsHttpSrv.pas

2008-04-08 Thread DZ-Jay
On Apr 8, 2008, at 09:45, Bjørnar Nielsen wrote:
 { We probably should use the registry to find MIME type for file 
 types }

Hello:
I don't agree that the Registry should be used, because then you limit 
the application to those MIME types registered at the local host.  What 
I propose is that a simple list of mappings between extensions and MIME 
types be kept and maintained with ICS (there are many of these 
available already), and that an efficient mechanism be built into the 
HttpSrv to load these on start up to some sort of searchable memory 
structure.  I have done this in the past using a custom Red and Black 
Balanced Tree, which can then be searched to find the MIME type of a 
file extension (and even its transport encoding).  I actually 
implemented this for automatic file encodings of SMTP attachments.

By keeping it in a simple list, like Apache does, it can be easily 
extended and maintained.

dZ.

-- 
DZ-Jay [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

-- 
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