Unit1.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "IdBaseComponent"
  8. #pragma link "IdComponent"
  9. #pragma link "IdHTTP"
  10. #pragma link "IdIOHandler"
  11. #pragma link "IdIOHandlerSocket"
  12. #pragma link "IdIOHandlerStack"
  13. #pragma link "IdSSL"
  14. #pragma link "IdSSLOpenSSL"
  15. #pragma link "IdTCPClient"
  16. #pragma link "IdTCPConnection"
  17. #pragma resource "*.dfm"
  18. TForm1 *Form1;
  19. //---------------------------------------------------------------------------
  20. __fastcall TForm1::TForm1(TComponent* Owner)
  21. : TForm(Owner)
  22. {
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TForm1::Button1Click(TObject *Sender)
  26. {
  27. //sslIOHandler.SSLOptions.Method := sslvSSLv23;
  28. //sslIOHandler.SSLOptions.Mode := sslmClient;
  29. //idhttps.IOHandler := sslIOHandler;
  30. //idhttps.HandleRedirects:=False;
  31. // 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
  32. String sUrl = "https://map.pstatic.net/nrb/styles/basic/1711013542/16/55859/25385.png";
  33. String sFile = "c:\\temp\\aaaaaaaaaaaa.png";
  34. TFileStream *fs = new TFileStream(sFile, fmCreate);
  35. try
  36. {
  37. IdHTTP1->HandleRedirects = true;
  38. IdHTTP1->Get(sUrl, fs);
  39. delete fs;
  40. }
  41. catch(Exception &e) {
  42. //ShowMessage(WhichFailedToLoad());
  43. Application->ShowException(&e);
  44. }
  45. }
  46. //---------------------------------------------------------------------------