httpclient for linux demo

program DelphiScalableHttp;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  Grijjy.Http in '..\..\GrijjyFoundation\Grijjy.Http.pas',
  Grijjy.Uri in '..\..\GrijjyFoundation\Grijjy.Uri.pas',
  Grijjy.OpenSSL in '..\..\GrijjyFoundation\Grijjy.OpenSSL.pas',
  Grijjy.OpenSSL.API in '..\..\GrijjyFoundation\Grijjy.OpenSSL.API.pas',
  Grijjy.MemoryPool in '..\..\GrijjyFoundation\Grijjy.MemoryPool.pas';

var
  Response: TBytes;
  HTTP: TgoHttpClient;

begin
  try
    HTTP := TgoHttpClient.Create;
    try
      if HTTP.Get('http://www.grijjy.com', Response) then
        Writeln(TEncoding.ASCII.GetString(Response));
    finally
      HTTP.Free;
    end;

    // http2
    HTTP := TgoHttpClient.Create(True);
    try
      if HTTP.Get('https://nghttp2.org', Response) then
        Writeln(TEncoding.ASCII.GetString(Response));
    finally
      HTTP.Free;
    end;

    // wait
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

  

相关文章:

  • 2021-10-12
  • 2021-11-23
  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
猜你喜欢
  • 2021-09-15
  • 2022-02-17
  • 2021-10-19
  • 2021-06-18
  • 2021-10-05
  • 2022-12-23
  • 2021-05-25
相关资源
相似解决方案