As I stated in the thread you linked to, MaxConnectionReply
is implemented by TIdCmdTCPServer
, which TIdHTTPServer
does not derive from. Since you are overriding DoMaxConnectionsExceeded()
, you will have to send your own reply to the client manually, and make sure it is properly HTTP-formatted, for example:
procedure TMyHttpServer.DoMaxConnectionsExceeded(AIOHandler: TIdIOHandler);
var
Html: TIdBytes;
begin
Html := ToBytes('<html><body>500 - Too many connections</body></html>');
AIOHandler.WriteLn('HTTP/1.0 500 Too many connections');
AIOHandler.WriteLn('Content-Type: text/html');
AIOHandler.WriteLn('Content-Length: ' + IntToStr(Html));
AIOHandler.WriteLn('Connection: close');
AIOHandler.WriteLn;
AIOHandler.Write(Html);
end;