simpleserver.pas 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2019 by the Free Pascal development team
  4. Sample HTTP server application
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$mode objfpc}
  12. {$h+}
  13. { $DEFINE USEGNUTLS}
  14. { $DEFINE USEMICROHTTP} // Note, this must match what is defined in fpsimpleserver
  15. program simpleserver;
  16. {$IFDEF USEMICROHTTP}
  17. {$UNDEF USEGNUTLS}
  18. {$ENDIF}
  19. uses
  20. {$IFDEF UNIX}
  21. cwstring,
  22. cthreads,
  23. {$ENDIF}
  24. {$IFNDEF USEMICROHTTP}
  25. {$ifdef USEGNUTLS}
  26. gnutlssockets,
  27. {$else}
  28. opensslsockets,
  29. {$endif}
  30. {$ENDIF}
  31. fpmkunit,
  32. fpsimpleserver;
  33. Type
  34. THTTPApplication = Class(TFPSimpleServerApplication);
  35. Var
  36. Application : THTTPApplication;
  37. begin
  38. Application:=THTTPApplication.Create(Nil);
  39. Application.Initialize;
  40. Application.Run;
  41. Application.Free;
  42. end.