On 10-09-2010 16:43, Arno Garrels wrote:
Another thing that would be useful, if added to the code base of the
>  THttpConnection, is the possibility to send additional headers from
>  the THttpConnection.SendDocument, to define cache control, etc..
>  procedure THttpConnection.SendDocument(SendType : THttpSendType; const
>  aHeader:string='');
>  ...
>       if FLastModified<>  0 then
>           Header := Header +  'Last-Modified: ' +
>  RFC1123_Date(FLastModified) + ' GMT' + #13#10;
>       if ContEncoderHdr<>  '' then
>           Header := Header + ContEncoderHdr;  { V7.20 }
>       if aHeader>  '' then
>           Header := Header + aHeader
>       Header := Header + GetKeepAliveHdrLines + #13#10;
>  ...
Useful as well, probably the parameter should be named "CustomHeaders",
it's a bit confusing since one has to know which headers are added
by the method.

To complement this, a global PersistentHeader property, to provide a mean to specify header items that should be sent in every response, can be useful too.

Another useful change. How about setting the NameValueSeparator of the FRequestHeader stringlist to ':' ?

constructor THttpConnection.Create(AOwner: TComponent);
  FRequestHeader := TStringList.Create;
  FRequestHeader.NameValueSeparator:= ':';

This way it's easy to check the value of any of the received headers by only typing trim(RequestHeader.values[e.g. 'Origin',...]) Yes, I can do it at any time from my code, but won't hurt if done internally. The default '=' NameValueSeparator is there already, so why not use the correct one?


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