Well, I simply changed the source code and added a callback. It's normally
not the way to go, but well, sometimes it's the easiest way.

I'm talking about mostly "automatically" served files so calling
senddocument is out of the question. 
Overriding said function would mean, I would have to duplicate the code and
with each update of ICS I would have to check all my projects for this
overriden function. Not very practical. It's easier to change the ICS code
once every update...

Persistant headers are not usefull cause only certain Mimetype need special
headers and as an another use example: the "Date" header should reflect the
current (GMT) time, not the one when you started the server. With this
callback, you could handle time sensitive headers also.

The best way to go would normally be to implement a callback in the ICS http
server similar to the one which was added not too long ago for the
MimeContentType. :)

And I believe this is not just a special scenario for our apps. 
According to Pagespeed and feedback from our users this relative simple
change (Date and Expire headers) improved the response times of the
webserver and the display speed of the pages a lot. Just because all the js
libs, the css and image file are now taken from the cache and not downloaded
every time (IE seem to be a special case, according to the network monitor
of the IE9 the static files get a 304 answer which is in NO way send by ICS
http ;) ).

Lars


> -----Original Message-----
> From: twsocket-boun...@elists.org 
> [mailto:twsocket-boun...@elists.org] On Behalf Of RTT
> Sent: Sunday, December 11, 2011 1:18 AM
> To: ICS support mailing
> Subject: Re: [twsocket] Setting additional Header fields 
> depending on the mimetype in the HTTP Server
> 
> 
> If you call the SendDocument yourself, you can use this 
> overload version
> 
> procedure SendDocument(SendType: THttpSendType; const CustomHeaders: 
> string); overload; virtual; { V7.29 }
> 
> If not, you can override it and pass your custom header in 
> the CustomHeaders parameter, calling the inherited 
> SendDocument. This way you don't need to duplicate that function code.
> 
> Or you can use the PersistentHeader property. Just fill it 
> with your custom headers, before the send, and clear after 
> done if additional sends don't need it anymore.
> 
> > Hello,
> >
> > I need to add for certain mime content types special headers to the 
> > HTTP header. As an example for static resources the 
> "Expires" or "Cache-Control"
> > headers.
> >
> > Unfortunatly I haven't found a way to do this without 
> overriding (and
> > duplicating) the SendDocument function. Did I miss 
> something obvious 
> > or is there no way to add custom headers depending on the 
> mime content type?
> >
> > Thanks
> > Lars
> >
> > --
> > 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
> >
> 
> --
> 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
> 

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

Reply via email to