Ignore:
Timestamp:
Mar 18, 2022, 1:32:32 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Build with Lazarus 2.2.0.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas

    r123 r130  
    66
    77uses
    8   Classes, SysUtils, UTCPServer, UCommon, UMemoryStreamEx, UMIMEType,
     8  Classes, SysUtils, UCommon, UMemoryStreamEx, UMIMEType,
    99  Synautil, SpecializedList, SpecializedDictionary, Syncobjs;
    1010
     
    120120procedure HTTPExceptionHide(Obj: TObject; Addr: Pointer; FrameCount: Longint; Frames: PPointer);
    121121
    122 
    123122resourcestring
    124123  SEmptyHTTPHandler = 'No handler defined for HTTP server.';
    125124  SFileNotFound = 'File %s not found.';
    126125  SPageNotFound = 'Page %s not found.';
     126
    127127
    128128implementation
     
    212212procedure THTTPServer.Run;
    213213begin
    214 
    215214end;
    216215
     
    278277destructor THTTPResponse.Destroy;
    279278begin
    280   Content.Free;
    281   Headers.Free;
    282   Cookies.Free;
    283   inherited Destroy;
     279  FreeAndNil(Content);
     280  FreeAndNil(Headers);
     281  FreeAndNil(Cookies);
     282  inherited;
    284283end;
    285284
     
    339338destructor THTTPRequest.Destroy;
    340339begin
    341   Content.Free;
    342   Post.Free;
    343   Query.Free;
    344   Path.Free;
    345   Headers.Free;
    346   Cookies.Free;
    347   inherited Destroy;
     340  FreeAndNil(Content);
     341  FreeAndNil(Post);
     342  FreeAndNil(Query);
     343  FreeAndNil(Path);
     344  FreeAndNil(Headers);
     345  FreeAndNil(Cookies);
     346  inherited;
    348347end;
    349348
     
    366365        Add(Pair[0], Pair[1]);
    367366    end;
    368 
    369367  finally
    370368    Parts.Free;
     
    436434destructor THTTPSessionStorage.Destroy;
    437435begin
    438   inherited Destroy;
     436  inherited;
    439437end;
    440438
     
    470468var
    471469  Message: string;
    472   i: LongInt;
     470  I: LongInt;
    473471  hstdout: ^Text;
    474472begin
     
    483481   end
    484482  else
    485     Writeln(hstdout^, 'Exception object ', Obj.ClassName, ' is not of class Exception.<br/>');
    486   Writeln(hstdout^, BackTraceStrFunc(Addr) + '<br/>');
     483    WriteLn(hstdout^, 'Exception object ', Obj.ClassName, ' is not of class Exception.<br/>');
     484  WriteLn(hstdout^, BackTraceStrFunc(Addr) + '<br/>');
    487485  if (FrameCount > 0) then
    488486    begin
    489       for i := 0 to FrameCount - 1 do
     487      for I := 0 to FrameCount - 1 do
    490488        if I < Length(TArrayOfPointer(Frames)) then
    491           Writeln(hstdout^, BackTraceStrFunc(TArrayOfPointer(Frames)[i]) + '<br/>');
    492     end;
    493   Writeln(hstdout^, '');
     489          WriteLn(hstdout^, BackTraceStrFunc(TArrayOfPointer(Frames)[I]) + '<br/>');
     490    end;
     491  WriteLn(hstdout^, '');
    494492end;
    495493
     
    499497var
    500498  Message: string;
    501   i: LongInt;
     499  I: LongInt;
    502500  hstdout: ^Text;
    503501  hstderr: ^Text;
     
    508506  WriteLn(hstdout^);
    509507  WriteLn(hstdout^, 'Error occured during page generation.');
    510   Writeln(hstderr^, 'An unhandled exception occurred at $', HexStr(PtrUInt(Addr), SizeOf(PtrUInt) * 2), ' :');
     508  WriteLn(hstderr^, 'An unhandled exception occurred at $', HexStr(PtrUInt(Addr), SizeOf(PtrUInt) * 2), ' :');
    511509  if Obj is exception then
    512510   begin
    513511     Message := Exception(Obj).ClassName + ' : ' + Exception(Obj).Message;
    514      Writeln(hstderr^, Message);
     512     WriteLn(hstderr^, Message);
    515513   end
    516514  else
    517     Writeln(hstderr^, 'Exception object ', Obj.ClassName, ' is not of class Exception.');
    518   Writeln(hstderr^, BackTraceStrFunc(Addr));
     515    WriteLn(hstderr^, 'Exception object ', Obj.ClassName, ' is not of class Exception.');
     516  WriteLn(hstderr^, BackTraceStrFunc(Addr));
    519517  if (FrameCount > 0) then
    520518    begin
    521       for i := 0 to FrameCount - 1 do
     519      for I := 0 to FrameCount - 1 do
    522520        if I < Length(TArrayOfPointer(Frames)) then
    523           Writeln(hstderr^, BackTraceStrFunc(TArrayOfPointer(Frames)[i]));
    524     end;
    525   Writeln(hstderr^, '');
     521          WriteLn(hstderr^, BackTraceStrFunc(TArrayOfPointer(Frames)[I]));
     522    end;
     523  WriteLn(hstderr^, '');
    526524end;
    527525
Note: See TracChangeset for help on using the changeset viewer.