//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "IdBaseComponent"
#pragma link "IdComponent"
#pragma link "IdHTTP"
#pragma link "IdIOHandler"
#pragma link "IdIOHandlerSocket"
#pragma link "IdIOHandlerStack"
#pragma link "IdSSL"
#pragma link "IdSSLOpenSSL"
#pragma link "IdTCPClient"
#pragma link "IdTCPConnection"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
      //sslIOHandler.SSLOptions.Method := sslvSSLv23;
      //sslIOHandler.SSLOptions.Mode := sslmClient;

      //idhttps.IOHandler := sslIOHandler;
      //idhttps.HandleRedirects:=False;

      // https://hook.tistory.com/entry/Delphi-2010-XE%EC%97%90%EC%84%9C-HTTPS-%ED%94%84%EB%A1%9C%ED%86%A0%EC%BD%9C-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0
    String sUrl = "https://map.pstatic.net/nrb/styles/basic/1711013542/16/55859/25385.png";
    String sFile = "c:\\temp\\aaaaaaaaaaaa.png";
    TFileStream *fs = new TFileStream(sFile, fmCreate);
    try
    {
        IdHTTP1->HandleRedirects = true;
        IdHTTP1->Get(sUrl, fs);
        delete fs;
    }
    catch(Exception &e) {
    //ShowMessage(WhichFailedToLoad());
        Application->ShowException(&e);
    }
}
//---------------------------------------------------------------------------
