I'm now working with HttpCli and after examining OverbyteIcsHttpProt unit I
have several suggestions
1) Excess ancient defines
While only D7+ is supported currently in ICS7, there are some legacy defines:
{$IFNDEF COMPILER7_UP}
'Sorry, we do not want to support ancient compilers any longer'
{$ENDIF}
{$IFDEF DELPHI6_UP} << useless
{$WARN SYMBOL_PLATFORM OFF}
{$WARN SYMBOL_LIBRARY OFF}
{$WARN SYMBOL_DEPRECATED OFF}
{$ENDIF}
{$IFDEF BCB3_UP} << {$IFDEF BCB} ?
{$ObjExportAll On}
{$ENDIF}
There's even some code for DELPHI1!
2) $IF defines
While COMPILER##_UP defines are used for determining compiler version, there
are some checks with $IF like {$IF CompilerVersion < 21}. Maybe it's better to
change compiler detection to IF-s? IF-s are supported in D7, the only thing
this version requires is defining a const CompilerVersion = 15.
3) HTTPCliWindowProc
function HTTPCliWindowProc is never used, maybe it should be removed?
4) THttpBigInt
THttpBigInt type - is it really needed?
5) Header value names
Such header value names as 'Content-Length: ' are repeated several times
throughout the unit, I think they should be declared as constants.
6) Current http doc properties clearing
There's a block of code which clears http doc properties, it is repeated three
times: once in THttpCli.InternalClear and twice in
THttpCli.LocationSessionClosed.
{ Clear header from previous operation }
FRcvdHeader.Clear;
FHeaderLineCount := 0;
FBodyLineCount := 0;
FContentLength := -1;
FContentType := ''; { 25/09/1999 }
FTransferEncoding := ''; { 28/12/2003 }
{$IFDEF UseContentCoding}
FContentEncoding := '';
{$ENDIF}
I'd extract this into separate method (what would ease addition of new http doc
properties)
7) Last-modified and Date header fields
I slightly modified RFC1123_Date and RFC1123_StrToDate and added
auto-conversion of Last-modified and Date header fields into HttpCli's
TDateTime fields. If you're interested, I can send my modifications to ICS team.
--
Anton
--
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