AW: TIdHTTPServer: Programmabsturz bei langwieriger ResponseInfo-Berechnung
Das müsste so reichen:
Delphi-Quellcode:
Als Client habe ich Google Chrome verwendet (mit ein paar Tabs, die den Webserver anfragen). Aber auch jeder andere Browser sollte es tun. Spätestens, wenn du in den Tabs schnell ein paar mal F5 drückst, sollte das Server-Programm abstürzen.
unit http;
{$mode objfpc}{$H+} interface uses Classes, SysUtils, IdHTTPServer, IdCustomHTTPServer, IdContext, IdSocketHandle, IdGlobal; type THTTPServer = class(TIdHTTPServer) private _newPort : Word; public constructor Create(port : Word); procedure InitComponent; override; procedure DoCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); override; end; implementation constructor THTTPServer.Create(port: Word); begin _newPort := port; inherited Create; end; procedure THTTPServer.InitComponent; var Binding: TIdSocketHandle; begin inherited; Bindings.Clear; Binding := Bindings.Add; Binding.IP := '0.0.0.0'; Binding.Port := _newPort; Binding.IPVersion := Id_IPv4; end; procedure THTTPServer.DoCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); begin AResponseInfo.ContentText := 'Test'; Sleep(4000); end; end. Ich bin mittlerweile bei Synapse. Damit scheint das ganze zu funktionieren (erste Einschätzung). |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz