Ignore:
Timestamp:
Dec 26, 2011, 12:07:37 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Testování varianty HTTP serveru jako přímé obsluhy přes TCP. Momentálně není odděleno generování stránek pro použití z více vláken.
  • Upraveno: Třída uchování jména počítač nyní pro převod do IPv4 používá ověření správnosti namísto přímého převodu a zahlášení výjimky.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Components/CoolWeb/WebServer/UWebApp.pas

    r67 r68  
    77uses
    88  Classes, SysUtils, CustApp, SpecializedList, UWebPage, UHTTPSessionFile,
    9   UHTTPServer, UHTTPServerCGI;
     9  UHTTPServer;
    1010
    1111type
     12  THTTPServerType = (stCGI, stTCP);
     13
    1214  TRegistredPage = class
    1315    Name: string;
     
    2628  private
    2729    FOnInitialize: TNotifyEvent;
     30    FServerType: THTTPServerType;
    2831    procedure DoRun; override;
    2932    function DumpExceptionCallStack(E: Exception): string;
    3033    procedure HTTPServerRequest(HandlerData: THTTPHandlerData);
     34    procedure SetServerType(AValue: THTTPServerType);
    3135  public
    3236    Pages: TRegistredPageList;
     
    3943    destructor Destroy; override;
    4044    property OnInitialize: TNotifyEvent read FOnInitialize write FOnInitialize;
     45    property ServerType: THTTPServerType read FServerType write SetServerType;
    4146  end;
    4247
     
    4954
    5055implementation
     56
     57uses
     58  UHTTPServerCGI, UHTTPServerTCP;
    5159
    5260resourcestring
     
    133141    end else Response.Content.WriteString(SPageNotFound);
    134142  end;
     143end;
     144
     145procedure TWebApp.SetServerType(AValue: THTTPServerType);
     146begin
     147  if FServerType = AValue then Exit;
     148  FServerType := AValue;
     149  HTTPServer.Free;
     150  case FServerType of
     151    stCGI: HTTPServer := THTTPServerCGI.Create(nil);
     152    stTCP: HTTPServer := THTTPServerTCP.Create(nil);
     153  end;
     154  HTTPServer.OnRequest := HTTPServerRequest;
    135155end;
    136156
Note: See TracChangeset for help on using the changeset viewer.