merijnb 4 Posted April 13, 2022 One of the first things the constructor of THttpServer does is setting FName of FWSocketServer, using the current ClassName as a basis: constructor THttpServer.Create(AOwner: TComponent); begin inherited Create(AOwner); CreateSocket; {$IFDEF NO_ADV_MT} FWSocketServer.Name := ClassName + '_SrvSocket' + IntToStr(WSocketGCount); {$ELSE} FWSocketServer.Name := ClassName + '_SrvSocket' + IntToStr(SafeWSocketGCount); The name of a component can only consist of 'A'..'Z', 'a'..'z', '_', '0'..'9' as can been seen in System.SysUtils.IsValidIdent() (called from System.SysUtils.TComponent.SetName()) If you define a class, overriding form THttpServer as part of another class: type TMyClass = class(TObject) private type TMyHttpServer = class(THttpServer) The ClassName of TMyHttpServer will become TMyClass.TMyHttpServer, so it contains a dot, hence breaking the constructor of THttpServer. Fix could be to do a StringReplace() to eliminate dots in the constructor: constructor THttpServer.Create(AOwner: TComponent); begin inherited Create(AOwner); CreateSocket; {$IFDEF NO_ADV_MT} FWSocketServer.Name := StringReplace(ClassName + '_SrvSocket' + IntToStr(WSocketGCount), '.', '', [rfReplaceAll]); {$ELSE} FWSocketServer.Name := StringReplace(ClassName + '_SrvSocket' + IntToStr(SafeWSocketGCount), '.', '', [rfReplaceAll]); Share this post Link to post
merijnb 4 Posted April 13, 2022 I just noticed the title of this thread isn't what it's supposed to be, it should be bug in OverbyteIcsHttpSrv.THttpServer.Create 🙂 Share this post Link to post
Angus Robertson 577 Posted April 13, 2022 I'm not sure that this is actually a problem, since ICS already has various derived components like: THttpAppSrv = class(THttpServer) which don't give any errors. But I don't see any purpose in setting the name FWSocketServer.Name either, it might have been used for debugging a long time ago, but I've just removed it from my copy so your problem will go away, unless anything thinks the name is needed? Angus Share this post Link to post
merijnb 4 Posted April 13, 2022 4 minutes ago, Angus Robertson said: I'm not sure that this is actually a problem, since ICS already has various derived components like: THttpAppSrv = class(THttpServer) which don't give any errors. But I don't see any purpose in setting the name FWSocketServer.Name either, it might have been used for debugging a long time ago, but I've just removed it from my copy so your problem will go away, unless anything thinks the name is needed? Angus Hey Angus, I have no need for the name (I wondered why it was set), the reason THttpAppSrv doesn't have this error is because the class definition is not part of another class definition. Share this post Link to post
Fr0sT.Brutal 900 Posted April 13, 2022 Probably that was intended for design-time auto-naming Share this post Link to post